User:Thetrick/my helper/script.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Thetrick/my helper/script. |
//<pre><nowiki>
/*************** MY Helper **************/
/* see [[User:Thetrick/my_helper]] */
importScript("User:Thetrick/tfd_helper/automodtfdh.js");
var tfdh_advanced;
/* this function runs at load */
function my_helper() {
/* call auto mod first, exit if it did processing */
if (auto_mod_tfdh())
return;
if (tfdh_advanced == null)
tfdh_advanced = false;
/* add these to the tabs at the top */
if (tfdh_advanced && wgCanonicalNamespace == 'Template' && wgIsArticle == true) {
amtfdh_add_li('cactions', 'javascript:add_doc_sub()', 'add doc. sub.', 'myh1', 'Add Template:Documentation subpage to a doc page');
}
/* add these to the sidebar if a template */
if (tfdh_advanced && wgCanonicalNamespace == 'Template' && wgIsArticle == true) {
amtfdh_add_li('tb', 'javascript:remove_tfd()', 'MYh: remove TfD', 'myh2', 'Remove a TfD tag from a failed TfD if the admin overlooked it');
amtfdh_add_li('tb', 'javascript:remove_uncat()', 'MYh: remove uncat.', 'myh3', 'Remove an uncategorized tag for a reason');
}
}
/* myh1 - doc subpage template and place for categories to a doc page */
function add_doc_sub() {
window.location.href = amtfdh_make_url(wgPageName, '{{Documentation subpage}}\n<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->\n', '\n<includeonly>\n<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->\n\n\n</includeonly>', 'Added Template:Documentation subpage') + "&tfdpreview=true";
}
/* myh2 - remove a tfd tag from a failed tfd */
function remove_tfd() {
var rmv_rsn = window.prompt("Explain why this TfD should be removed from " + wgPageName + " (e.g. failed Tfd, article created with tag, etc.)", "");
if (!rmv_rsn)
return;
window.location.href = amtfdh_make_url(wgPageName, '', '', 'Removed invalid TfD tag because ' + rmv_rsn) + "&tfdfind={{tfd}}";
}
/* myh3 - remove a uncat tag from a hopelessly munged template */
function remove_uncat() {
var rmv_rsn = window.prompt("Explain why the uncategorized tag should be removed from " + wgPageName + ":", "");
if (!rmv_rsn)
return;
window.location.href = amtfdh_make_url(wgPageName, '', '', 'Removed uncategorized tag because ' + rmv_rsn) + "&tfdfind={{uncat}}";
}
/* run a register function */
$(my_helper);
//bits of test code sit here
// var yes_no = window.prompt('Here is the url', am_make_url(here, here, here, here));
// return;
//</nowiki></pre>