Template:Deltab
From Wikipedia, the free encyclopedia
This code will add a "X deletion" tab to your edit screen. When you press that tab, the following line will be automatically added to the page:
- 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. -- ~~~~
Please note that this does not work in User: space.
[edit] Use
To use this script, add the following line to your monobook.js file and then flush your cache (shift-clicking your Reload button or pressing ctrl-F5):
{{subst:Deltab|X}}
Replace X with your area of interest. Thus, if your area of interest is China, you would type:
{{subst:Deltab|China}}
Save changes, flush your cache and you're ready to start tagging discussions!
[edit] Acknowledgments
Sources: User:RandyWang/autovgdeletion, Wikipedia:WikiProject User scripts/Scripts/Add tab, Wikipedia:WikiProject User scripts/Scripts/Add LI link
[edit] Code
</noinclude>
<!-- Begin deletion-sorting code -->
// From code by [[User:Raylu|raylu]]
//
//
// This script adds a "{{{1}}} Deletion" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.
function dodeletion() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'delsort' + '|' + '{{{1}}}' + '}' + '}' + ' ' + '--' + ' ' + '~' + '~' + '~' + '~';
document.editform.wpSummary.value = 'Tagged as a {{{1}}}-related deletion.';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function adddeletion() {
addTab("javascript:dodeletion()", "{{{1}}} deletion", "ca-{{{1}}}deletion", "{{{1}}} Deletion", "");
akeytt();
}
addOnloadHook(function() {
if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
return;
}
if (document.title.indexOf("Editing ") != -1) {
addOnloadHook(adddeletion);
}
});
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key)
};
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
<!--End deletion-sorting code -->
<noinclude>

