Template:Deltab
This template should always be substituted (i.e., use {{subst:Deltab}} ). |
This code will add an "X deletion" tab to your edit screen. When you press that tab, the following line will be automatically added to the page (using {{subst:deletion sorting}}):
- Note: This debate has been included in the list of X-related deletion discussions. -- ~~~~
X is whatever topic area you have specified. For instance, if you selected "China," the line would be:
- Note: This debate has been included in the list of China-related deletion discussions. -- ~~~~
This script only works for pages in the Wikipedia: namespace if they have "for discussion" or "for deletion" in their pagenames (for example, Wikipedia:Articles for deletion or Wikipedia:Categories for discussion).
Use
To use this script, add the following line to your monobook.js file and then clear your cache:
{{subst:Deltab|X}}
Replace X with your area of interest. Thus, if your area of interest is China, you would type:
{{subst:Deltab|China}}
Alternatively, you can add the above code to a different subpage of yours - the name does not matter, as long as it ends in .js - and then add this line to your monobook.js:
importScript('User:Your_user_name/name_of_page.js');
So, for instance, if you named the page "delsort.js" (and your username happened to be "Example"), you would add this to your monobook.js:
importScript('User:Example/delsort.js');
Save changes, flush your cache and you're ready to start tagging discussions!
Acknowledgments
Sources: User:RandyWang/autovgdeletion, User:Dinoguy1000/scripts/amdelsort.js and User:Dinoguy1000/scripts/delsort.js (with help from User:Ioeth)
Code
[edit]<onlyinclude>
/***** Begin deletion-sorting code ***************************************
Substituted from [[Template:Deltab]]
From code by [[User:Raylu|raylu]], updates made by [[User:Dinoguy1000]]
This script adds a "{{{1}}} Deletion" tab to the top of XfD pages
when in edit mode.
*/
function addDelsortMessage() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.rtrim();
document.editform.wpTextbox1.value += '\{\{subst:deletion sorting|{{{1}}}| -- \~\~\~\~\}\}\n';
if( document.editform.wpSummary.value.match(/[^\*\/\s][^\/\s]?\s*$/) ){ document.editform.wpSummary.value += '; '; }
document.editform.wpSummary.value += 'tagged as a {{{1}}}-related deletion ([[Template:Deltab|script-assisted]])';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
addOnloadHook(function() {
if( wgNamespaceNumber == 4 && wgTitle.match( / for d(elet|iscuss)ion/ ) && ( wgAction == "edit" || wgAction == "submit" ) ) {
addPortletLink( 'p-cactions', 'javascript:addDelsortMessage()', '{{{1}}} deletion', 'ca-{{{1}}}deletion', '{{{1}}} Deletion', '' );
}
});
/***** End deletion-sorting code *****************************************/
</onlyinclude>