From Wikipedia, the free encyclopedia
Jump to: navigation, search

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}}):

X is whatever topic area you have specified. For instance, if you selected "China," the line would be:

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).


To use this script, add the following line to your monobook.js file and then clear your cache:


Replace X with your area of interest. Thus, if your area of interest is China, you would type:


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:


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:


Save changes, flush your cache and you're ready to start tagging discussions!


Sources: User:RandyWang/autovgdeletion, User:Dinoguy1000/scripts/amdelsort.js and User:Dinoguy1000/scripts/delsort.js (with help from User:Ioeth)



/***** 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;

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 *****************************************/