User:CBDunkerson/standard.js

// function addlink(url, name) { var na = document.createElement('a'); na.setAttribute('href', '/wiki/' + url);

var txt = document.createTextNode(name); na.appendChild(txt); return na; }

function addexplicitlink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url);

var txt = document.createTextNode(name); na.appendChild(txt); return na; }

function add_id_link(url, name, id) { var na = document.createElement('a'); na.setAttribute('href', url);

var txt = document.createTextNode(name); na.appendChild(txt);

na.id = id; return na; }

function pipe(td) { td.appendChild(document.createTextNode(' | ')); }

function replace { var s = prompt('Search regexp?'); if (s) {     var r = prompt('Replace regexp?'); var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, 'g'), r); } }

function header_vfd { var start = document.title.indexOf('/'), end = document.title.indexOf(' - Edit this page - Wikipedia, the free encyclopedia'); document.editform.wpTextbox1.value = '===' + document.title.substring(start + 1, end) + '===\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'header'; }

function template(tm) { document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = ''; }

function user_talk_template(tm, sum) { if (document.editform.wpTextbox1.value.length > 0) document.editform.wpTextbox1.value += '\n'; document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + ' ~\n'; document.editform.wpSummary.value = sum; }

function makebutton(lbl, action) { var button = document.createElement('input'); button.type = 'button'; button.value = lbl; button.setAttribute('onClick', action); return button; }

function strip_namespace(target) { var colon = target.indexOf(':'); if (colon != -1) {     var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category'); var ns = target.substring(0, colon); if (ns == '' || ns == 'Talk') return target.substring(colon + 1); else for (var i = 0; i < spaces.length; ++i) {           if (ns == spaces[i]                || ns == spaces[i] + '_talk') return target.substring(colon + 1); }   }

return target; }

function cleanup { var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var date = new Date; template('cleanup-date|' + months[date.getUTCMonth] + ' ' + date.getUTCFullYear); }

function vfd { document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'afd';

var target = document.editform.action; target = target.substring(target.indexOf('title=') + 6,                           target.lastIndexOf('&action=submit'));

var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var date = new Date; date = date.getUTCFullYear + '_' + months[date.getUTCMonth] + '_' + date.getUTCDate;

var pagename = strip_namespace(target);

window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/' + pagename + '&action=edit&fakeaction=vfdsub&faketarget=' + target,             'Afd ' + unescape(target),              'status,toolbar,location,menubar,directories,resizeable,scrollbars'); window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/Log/' + date + '&action=edit&fakeaction=vfdlist&faketarget=' + pagename,             'AfdLog ' + unescape(target),              'status,toolbar,location,menubar,directories,resizeable,scrollbars'); }

function transwiki_log { var title = prompt('Title?'); if (title) {     var target = prompt('To project?') if (target) {         if (target == 'k' || target == 'K' || target == 'd' || target == 'D') target = 'wikt'; else if (target == 's' || target == 'S') target = 'wikisource'; else if (target == 'c' || target == 'C') target = 'commons';

var txt = document.editform.wpTextbox1; var vfdd = prompt('Afd at? (y/Y for Articles for deletion/' + title + ', or empty for none');         if (vfdd == 'y' || vfdd == 'Y')            vfdd = ' (AfD)';          else if (vfdd == 'n' || vfdd == 'N' || vfdd == )            vfdd = ;          else            vfdd = ' (AfD)';          txt.value += '*' + title + ' &rarr; ' + target + ':Transwiki:' + title + ' ~' + vfdd;          document.editform.wpSummary.value =  + title + ' transwikied to ' + target + ':Transwiki:' + title +  + vfdd;        }    } }

function transwiki_to { var target = prompt('Transwiki to?\nwiKt/Books/Source/Commons/Meta/Quote'); if (target == 'k' || target == 'K' || target == 'd' || target == 'D') target = 'en.wiktionary'; else if (target == 'b' || target == 'B') target = 'en.wikibooks'; else if (target == 's' || target == 'S') target = 'wikisource'; else if (target == 'c' || target == 'C') target = 'commons.wikimedia'; else if (target == 'm' || target == 'M') target = 'meta.wikimedia'; else if (target == 'q' || target == 'Q') target = 'en.wikiquote'; else {     window.alert('Unknown target.'); return; }

var url = new String(document.location); url = url.replace(/en\.wikipedia/, target); url = url.replace(/index\.php\?title=/, 'index.php?title=Transwiki:'); window.location = url; }

function interwiki(lk, td, a, host, abbrev) { host = lk.replace(/source/, host); td.insertBefore(addexplicitlink(host, abbrev), a); if (abbrev == 'D' || abbrev == 'd') {     td.insertBefore(document.createTextNode('/'), a); td.insertBefore(addexplicitlink(host.toLowerCase, 'lc'), a); } td.insertBefore(document.createTextNode(' | '), a); }

function dbtranswiki { var target = prompt('Transwikied to project?'); if (target == 'k' || target == 'K' || target == 'd' || target == 'D') target = 'wikt'; else if (target == 's' || target == 'S') target = 'wikisource'; else if (target == 'c' || target == 'C') target = 'commons'; else if (target == '') return; var title = document.editform.action; title = title.substring(title.indexOf('title=') + 6,                         title.lastIndexOf('&action=submit')); title = title.replace(/_/g, ' ');

if (target) template('db|Afd result to transwiki; transwiki to ' + target + ':Transwiki:' + title            + ' complete, with author information at ' + target + ':Talk:Transwiki:' + title + ''); }

function link_ul_edit(isnull) { var uls = document.getElementsByTagName('ul'); var edit = isnull ? '&action=edit&fakeaction=nulledit' : '&action=edit'; for (var i = 0; i < uls.length; ++i) {     var lis = uls[i].getElementsByTagName('li'); for (var j = 0; j < lis.length; ++j) {         var as = lis[j].getElementsByTagName('a'); for (var k = 0; k < as.length; ++k) if (as[k].getAttribute('href').match(/^(.*)\/wiki\/(.*)$/)) {               as[k].setAttribute('href', RegExp.$1 + '/w/index.php?title=' + RegExp.$2 + edit); as[k].setAttribute('class', as[k].getAttribute('class') + ' modified'); }       }    }

if (isnull) {     document.getElementById('link_ul_edit').style.display = 'inline'; document.getElementById('link_ul_null_edit').style.display = 'none'; } else {     document.getElementById('link_ul_edit').style.display = 'none'; document.getElementById('link_ul_null_edit').style.display = 'inline'; } }

function close_vfd { var result = prompt('Result?'); var txt = document.editform.wpTextbox1; txt.value = ' " + result + ". ~\n" + txt.value + '\n'; txt = document.editform.wpSummary;  txt.value = 'close discussion: ' + result; }

function add_revert_links_history(lis) { var i, j, spans, user, next, tgt, revertee = ''; for (i = 0; i < lis.length; ++i) {     user = 0; spans = lis[i].getElementsByTagName('span'); for (j = 0; j < spans.length; ++j) if (spans[j].getAttribute('class').indexOf('history-user') >= 0) {           user = spans[j]; break; }

if (!user) continue;

date = user.previousSibling.previousSibling; tgt = date.getAttribute('href') + '&action=edit&fakeaction=revert&fakeuser=' + user.firstChild.firstChild.data + '&fakedate=' + date.firstChild.data; if (revertee != '' && revertee != ' ') tgt += '&fakerevertee=' + revertee; tgt += '&faketarget=';

lis[i].insertBefore(addexplicitlink(tgt + 'edits', 'Revert'), date); lis[i].insertBefore(document.createTextNode(' '), date);

if (revertee == '') revertee = user.firstChild.firstChild.data; else if (revertee != user.firstChild.firstChild.data) revertee = ' '; } }

function morelinks { var lk = 0; var a;

try {     lk = document.getElementById('pagehistory'); } catch (a) {     lk = 0; }

if (lk) add_revert_links_history(lk.getElementsByTagName('li'));

var table = document.getElementById('topbar').getElementsByTagName('table')[0]; var tds = table.getElementsByTagName('td'); var td = tds[1]; var lks = td.getElementsByTagName('a'); var txt; var deleted_edits = 0;

for (a = 0; a < lks.length; ++a) {     txt = lks[a].childNodes[0].data; if (txt == 'Main Page') {         lks[a].childNodes[0].data = 'New pages'; lks[a].setAttribute('href', '/w/index.php?title=Special:Newpages&limit=500'); }     else if (txt == 'Recent changes') {         lks[a].childNodes[0].data = 'New images'; lks[a].setAttribute('href', '/w/index.php?title=Special:Newimages&hidebots=0'); }     else if (txt == 'Edit this page') {         txt = lks[a].getAttribute('href'); lk = lks[a + 1]; td.insertBefore(addexplicitlink(txt + '&section=new', 'Comment'), lk); td.insertBefore(document.createTextNode(' | '), lk); td.insertBefore(addexplicitlink(txt + '&fakeaction=nulledit', 'null'), lk); td.insertBefore(document.createTextNode(' | '), lk); }     else if (txt == 'Page history') {         // Rename to 'History', add a link to Special:Undelete/pagename after it. Works even for non-administrators! lks[a].childNodes[0].data = 'History'; txt = lks[a].getAttribute('href').replace(/&action=history$/, '').replace(/title=/, 'title=Special:Undelete/'); deleted_edits = addexplicitlink(txt, '(deleted)'); td.insertBefore(deleted_edits, lks[a].nextSibling); td.insertBefore(document.createTextNode(' | '), lks[a].nextSibling); ++a; }   }

// Handy links to reload user js and css if (document.title.indexOf('User:CBDunkerson/standard') >= 0) {     a = td.getElementsByTagName('p')[0]; td.insertBefore(document.createTextNode(' | '), a); td.insertBefore(addexplicitlink('/w/index.php?title=User:CBDunkerson/standard.js&action=raw&ctype=text/javascript', 'js'), a); td.insertBefore(document.createTextNode(' | '), a); td.insertBefore(addexplicitlink('/w/index.php?title=User:CBDunkerson/standard.css&action=raw&ctype=text/css', 'css'), a); } else if (document.title.indexOf('Category:') == 0 || document.title.indexOf('Image:') == 0 || new String(document.location).indexOf('Special:Whatlinkshere') >= 0) {     a = td.getElementsByTagName('p')[0]; td.insertBefore(document.createTextNode(' | '), a); td.insertBefore(add_id_link('javascript:link_ul_edit(true)', 'null', 'link_ul_null_edit'), a); td.insertBefore(add_id_link('javascript:link_ul_edit(false)', 'edit', 'link_ul_edit'), a); }

// Remove second line, preserving 'Current revision' and 'n deleted edits' (on the first line) and 'You have new messages' (replacing (Talk) in upper right) if present td = td.getElementsByTagName('p')[0]; while (td.hasChildNodes) {     lk = td.firstChild; if (lk.nodeName == 'A' && lk.firstChild.data == 'Current revision') {         a = tds[1].getElementsByTagName('p')[0]; tds[1].insertBefore(document.createTextNode(' | '), a); tds[1].insertBefore(addexplicitlink(lk.href, 'Current'), a); }     else if (lk.nodeName == 'STRONG' && lk.firstChild.data == 'You have ') {         lks = tds[2].getElementsByTagName('a'); for (a = 0; a < lks.length; ++a) if (lks[a].firstChild.data == 'Talk') {               lks[a].firstChild.data = 'New Messages'; lks[a].setAttribute('style', 'font-style: italic;'); lks[a].setAttribute('href', '/w/index.php?title=User_talk:CBDunkerson&action=history'); }       }      else if (lk.nodeType == Node.TEXT_NODE && (lk.data == ' | View ' || lk.data == ' | View or restore ')) {         if (deleted_edits) deleted_edits.firstChild.data = '(' + lk.nextSibling.firstChild.data + ')'; else {             a = tds[1].getElementsByTagName('p')[0]; tds[1].insertBefore(document.createTextNode(' | '), a); tds[1].insertBefore(lk.nextSibling, a); }       }      td.removeChild(td.firstChild); }

if (document.title.indexOf('Editing ') == 0) {     pipe(td); td.appendChild(addexplicitlink('javascript:replace', 'Replace')); pipe(td);

if (document.title.indexOf('Editing User talk:') == 0) {         td.appendChild(addexplicitlink('javascript:user_talk_template("test", "your test")', 'Test')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("test2", "")', '2')); td.appendChild(document.createTextNode('/')); td.appendChild(addexplicitlink('javascript:user_talk_template("test2a", "")', 'a')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("test3", "")', '3')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("test4", "")', '4')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("spam", "")', 'Spam')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("spam2", "")', '2')); td.appendChild(document.createTextNode('/')); td.appendChild(addexplicitlink('javascript:user_talk_template("spam2a", "")', 'a')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("spam3", "")', '3')); pipe(td); td.appendChild(addexplicitlink('javascript:user_talk_template("nothanks|" + prompt("Copyvio at?"), "no thanks")', 'Nothanks')); }     else {         if (document.title.indexOf('Editing Wikipedia:Transwiki log') == 0) td.appendChild(addexplicitlink('javascript:transwiki_log', 'Log entry')); else if (document.title.indexOf('Editing Wikipedia:Votes for deletion') == 0                  || document.title.indexOf('Editing Wikipedia:Pages for deletion') == 0                   || document.title.indexOf('Editing Wikipedia:Articles for deletion') == 0) {             td.appendChild(addexplicitlink('javascript:header_vfd', 'Header')); pipe(td); td.appendChild(addexplicitlink('javascript:close_vfd', 'Close')); }         else { /*             td.appendChild(addexplicitlink('javascript:template("db-nonsense")', 'Nons')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db|test")', 'Test')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db|vandalism")', 'Vand')); td.appendChild(document.createTextNode('/')); td.appendChild(addexplicitlink('javascript:template("db-attack")', 'Disp')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db-repost")', 'Again')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db-empty")', 'Cntxt')); td.appendChild(document.createTextNode('/')); td.appendChild(addexplicitlink('javascript:template("db|rephrasing of title")', 'Title')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db|external link only")', 'Ext')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db|attempt to correspond")', 'Corr')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db|redirect to non-existent page")', 'BrkRedir')); pipe(td); td.appendChild(addexplicitlink('javascript:dbtranswiki', 'AFDTrWki')); pipe(td); td.appendChild(addexplicitlink('javascript:template("db-bio")', 'NnBio')); pipe(td); td.appendChild(addexplicitlink('javascript:cleanup', 'cleanup')); pipe(td); td.appendChild(addexplicitlink('javascript:transwiki_to', 'TranswikiTo')); }       }

var action = ''; var target = ''; var user = ''; var date = ''; var revertee = ''; if (location.search) {         var l = location.search.substring(1).split('&'); for (var i = 0; i < l.length; ++i) {             var eq = l[i].indexOf('='); var name = l[i].substring(0, eq); if (name == 'fakeaction') action = l[i].substring(eq + 1); else if (name == 'faketarget') target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' '); else if (name == 'fakedate') date = unescape(l[i].substring(eq + 1)); else if (name == 'fakeuser') user = unescape(l[i].substring(eq + 1)); else if (name == 'fakerevertee') revertee = unescape(l[i].substring(eq + 1)); }       }

if (action == 'vfdlist') {         document.editform.wpTextbox1.value += '\n'; document.editform.wpSummary.value =  + target + ; }     else if (action == 'vfdsub') {         if (document.editform.wpTextbox1.value.length > 0) {             target = document.editform.action; target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' '); window.alert('There is an old afd at the default location already.\n\n' +                          'Please either move it out of the way (and update existing links to it), or file the afd by hand in another location (such as ' +                           target + ' (2)).'); }         else document.editform.wpTextbox1.value += '===' + target + '===\n'; }     else if (action == 'nulledit') {         var f = document.editform; //f.wpWatchthis.checked = false; f.wpMinoredit.checked = true; f.wpSummary.value = 'null edit'; f.wpSave.click; }     else if (action == 'revert') {         if (target == 'edits' && revertee == '') target = ''; else target += ' ';

var f = document.editform; if (revertee != '') f.wpSummary.value = 'Reverted edits by ' + revertee + '(talk) to last version by ' + user; else f.wpSummary.value = 'Reverted edits back to ' + date + ' edit by ' + user; f.wpMinoredit.checked = true;

if (target != '') f.wpSave.click; }     else {         pipe(td); td.appendChild(addexplicitlink('javascript:vfd', 'Afd')); }   }

// Interwiki links td = tds[2]; a = td.firstChild; lk = new String(document.location).replace(/en.wikipedia/, 'source').replace(/Special:Whatlinkshere&target=/, ''); interwiki(lk, td, a, 'en.wikipedia', 'W'); interwiki(lk, td, a, 'en.wiktionary', 'd'); interwiki(lk, td, a, 'en.wikinews', 'n'); interwiki(lk, td, a, 'en.wikibooks', 'b'); interwiki(lk, td, a, 'wikisource', 's'); interwiki(lk, td, a, 'commons.wikimedia', 'c'); interwiki(lk, td, a, 'meta.wikimedia', 'm'); interwiki(lk, td, a, 'en.wikiquote', 'q'); }

// Change section links in vfd log pages to edit the entire subpage, instead of its section function vfdsectionlinks(thispage) { var divs = document.getElementsByTagName('div'); var a; var url; var pos; for (var x = 0; x < divs.length; ++x) if (divs[x].className == 'editsection') {       a = divs[x].getElementsByTagName('a')[0]; url = a.getAttribute('href'); pos = url.indexOf('action=edit&section='); if (pos != -1) {           url = url.substring(0, pos + 11); if (url.indexOf(thispage) < 0) a.setAttribute('href', url); }     } }

function resize_editbox(delta) { if (document.title.indexOf('Editing ') == 0) {     var tb = document.editform.wpTextbox1; if (delta == 1) switch (tb.rows) { // Pretty ad-hoc, but so what? case 5: tb.rows = 10; break; case 10: tb.rows = 15; break; case 15: tb.rows = 20; break; case 20: tb.rows = 25; break; case 25: tb.rows = 35; break; case 35: tb.rows = 50; break; }     else if (delta == -1) switch (tb.rows) {           case 10: tb.rows = 5; break; case 15: tb.rows = 10; break; case 20: tb.rows = 15; break; case 25: tb.rows = 20; break; case 35: tb.rows = 25; break; case 50: tb.rows = 35; break; }     else {         var div = document.createElement('div'); div.setAttribute('style', 'text-align:center; float:right;'); div.appendChild(makebutton('-', 'resize_editbox(-1)')); div.appendChild(document.createElement('br')); div.appendChild(makebutton('+', 'resize_editbox(1)'));

var art = document.getElementById('article'); art.insertBefore(div, art.firstChild); }   } }

function cesarb_fixDiffOverflowTableCell(cell) { var div = document.createElement('div'); div.style.overflow = 'auto'; cell.insertBefore(div, cell.firstChild);

while (div.nextSibling) div.appendChild(div.nextSibling); }

function cesarb_fixDiffOverflowTable(table) { var cells = table.getElementsByTagName('td');

for (var i = 0; i < cells.length; i++) {     var cell = cells[i]; var classes = cell.className.split(' ');

for (var j = 0; j < classes.length; j++) if (classes[j] == 'diff-context' || classes[j] == 'diff-addedline' || classes[j] == 'diff-deletedline' || classes[j] == 'diff-otitle' || classes[j] == 'diff-ntitle') {           cesarb_fixDiffOverflowTableCell(cell); break; }   } }

function cesarb_fixDiffOverflowLoadListener(evt) { var tables = document.getElementsByTagName('table');

loop: for (var i = 0; i < tables.length; i++) {     var table = tables[i]; var classes = table.className.split(' ');

for (var j = 0; j < classes.length; j++) if (classes[j] == 'diff') {           cesarb_fixDiffOverflowTable(table); break loop; }   } }

function toggle_undelete(init) { var f = document.getElementById('undelete'); if (f) {     if (init) {         var h2 = f.getElementsByTagName('h2')[0]; if (h2) f.insertBefore(makebutton('Invert', 'toggle_undelete(0)'), h2); }     else {         var inputs = f.getElementsByTagName('input'); var i;         for (i = 0; i < inputs.length; ++i) if (inputs[i].type == 'checkbox') inputs[i].checked = !inputs[i].checked; }   } }

function delete_button(csd, txt, crit, display_orig) { var f = document.getElementById('deleteconfirm'); if (f) {     if (display_orig == -1) {         var pgname = document.getElementById('article').getElementsByTagName('p')[0].firstChild.data; pgname = pgname.replace(new RegExp('^\\(Deleting "', 'g'), );         pgname = strip_namespace(pgname.replace(new RegExp('"\\)$', 'g'), )); var table = f.getElementsByTagName('table')[0]; var tbody = table.getElementsByTagName('tbody')[0]; var box = tbody.getElementsByTagName('tr')[0]; var tr = document.createElement('tr'); var td = document.createElement('td'); tr.appendChild(td); td = document.createElement('td');

var criterion = document.createElement('span'); criterion.id = 'criterion'; f.appendChild(criterion);

var orig_reason = document.createElement('span'); orig_reason.id = 'orig_reason'; orig_reason.style.display = 'none'; orig_reason.appendChild(document.createTextNode(f.wpReason.value)); f.appendChild(orig_reason);

td.appendChild(makebutton('Default',         'delete_button("default", "", "", 1)')); td.appendChild(makebutton('U1:subpage',      'delete_button("U1", "owner request", "Personal subpages, upon request by their owner.", 1)')); td.appendChild(makebutton('U2:user/talk',    'delete_button("U2", "owner request", "User and talk pages on request of the user, where there is no significant abuse, and no administrative need to retain the page. A redirect (to the users new name, or to Wikipedia:Missing Wikipedians) should be created to avoid red links and confusion.", 1)')); td.appendChild(makebutton('U3:ip talk',      'delete_button("U3", "talk page of ip; no longer relevant", "User talk pages of non-logged in users where the message is no longer relevant (This is to avoid confusing new users who happen to edit with that same IP address).", 1)'));

td.appendChild(makebutton('C1:empty',        'delete_button("C1", "empty 72 hours, no content other than parent categories", "Empty categories (no articles or subcategories for at least 72 hours) whose only content has consisted of links to parent categories.  Does NOT apply to categories listed on WP:CFD.", 1)')); td.appendChild(makebutton('C2:rename',       'delete_button("C2", "empty, speedy rename", "Empty categories (no articles or subcategories) that have qualified for speedy renaming.  Must have been listed at Wikipedia:Categories_for_deletion#Speedy_renaming for a minimum of 48 hours.", 1)')); td.appendChild(makebutton('C3:template',     'delete_button("C3", "populated solely by Template:", "If a category is solely populated from a template (e.g. Category:Wikipedia cleanup from ) and the template is deleted per deletion policy, the category can also be deleted without further discussion.", 1)')); td.appendChild(makebutton('Copyvio',         'delete_button("", "Copyvio; listed on WP:CP since ; ", "", 0)'));

td.appendChild(document.createElement('br'));

td.appendChild(makebutton('I1:redundant',    'delete_button("I1", "redundant copy of Image:", "An image which is a redundant (all pixels the same or scaled-down) copy of something else on Wikipedia and as long as all inward links have been changed to the image being retained.  Does not include images saved in a different file format or moved to Commons.", 1)')); td.appendChild(makebutton('I2:corrupt',      'delete_button("I2", "corrupt or empty", "A corrupt or empty image.", 1)')); td.appendChild(makebutton('I3:non-com/permis','delete_button("I3", "noncommercial/permission-only image", "Images licensed as for non-commercial use only or used with permission which were uploaded on or after May 19, 2005.", 1)')); td.appendChild(makebutton('I4:source/license','delete_button("I4", "no source/unknown license", "Images in category Images with unknown source or Images with unknown copyright status which have been tagged with a template that places them in the category for more than 7 days, regardless of when uploaded.", 1)')); td.appendChild(makebutton('I5:or-fu',        'delete_button("I5", "orphan fair use", "Copyrighted images uploaded without permission of the copyright holder, or under a license which does not permit commercial use, which are not used in any article, and which has been tagged with a template which places them in Category:Orphaned fairuse images for more than seven days (so-called orphaned fair use images). Reasonable exceptions may be made for images uploaded for an upcoming article. The templates  and  place an image in this category.", 1)'));

td.appendChild(makebutton('R1:broken',       'delete_button("R1", "non-existent target", "They refer to non-existent pages.  Before deleting such a redirect, its a good idea to check to see if the redirect can be made useful by changing its target.", 1)')); td.appendChild(makebutton('R2:userspace',    'delete_button("R2", "redirect to user: space", "They redirect from the main article space to the User: space.", 1)')); td.appendChild(makebutton('R3:for move',     'delete_button("R3", "for page move", "Consensus is that it should be removed to make way for a non-controversial page move.", 1)')); td.appendChild(makebutton('R4:typo',         'delete_button("R4", "typo", "Were created very recently as a result of a typo (during a page move or as a proactive measure).  This does not include common misspellings or misnomers, or plurals where the singular is appropriate, as redirects from those are considered useful.", 1)'));

td.appendChild(document.createElement('br'));

td.appendChild(makebutton('A1:empty',        'delete_button("A1", "insufficient context", "Very short articles providing little or no context (e.g., He is a funny man that has created Factory and the Hacienda. And, by the way, his wife is great.). Limited content is not in itself a reason to delete if there is enough context to allow expansion.", 1)')); td.appendChild(makebutton('A2:foreign',      'delete_button("A2", "foreign language article existing on another Wikimedia project", "Foreign language articles that already exist on another Wikimedia project, as a result of having been copied and pasted into Wikipedia after their creation elsewhere, or as a result of having been moved via the transwiki system.", 1)')); td.appendChild(makebutton('A3:ext.lk',       'delete_button("A3", "zero content", "Any article whose contents consist only of an external link, See also section, book reference, category tag, template tag, interwiki link, or rephrasing of the title.", 1)')); td.appendChild(makebutton('A4:correspond',   'delete_button("A4", "attempt to correspond", "Any article which consists only of attempts to correspond with the person or group named by its title.", 1)')); td.appendChild(makebutton('A5:transwiki',    'delete_button("A5", "transwiki complete", "Any article that has been discussed at Articles for Deletion (or Miscellany for deletion), where the outcome was to transwiki, and where the transwikification has been properly performed and the author information recorded.", 1)')); td.appendChild(makebutton('A6:attack',       'delete_button("A6", "article serves no purpose but to disparage its subject", "Articles which serve no purpose but to disparage their subject (insult pages, e.g., OMFG! Joe Random is a l0ser n00bface lolol!!!11).", 0)')); td.appendChild(makebutton('A7:nnbio',        'delete_button("A7", "nnbio", "An article about a real person that does not assert that persons importance or significance. If the assertion is disputed or controversial, it should be taken to AFD instead. For details, see Wikipedia:Deletion of vanity articles.", 1)')); td.appendChild(makebutton('A8:copyvio',      'delete_button("A8", "copyvio from ", "An article that is a blatant copyright infringement and meets these parameters: Material is unquestionably copied from the website of a commercial content provider (e.g. encyclopedia, news service) and; The article and its entire history contains only copyright violation material, excluding tags, templates, and minor edits and; Uploader makes no assertion of permission or fair use, and none seems likely and; The material is identified within 48 hours of upload and is almost or totally un-wikified (to diminish mirror problem).  Notification: When tagging a page for deletion under this criterion, a user should notify the pages creator using wording similar to  or an equivalent message. Before deleting any page under this criterion, an admin should verify that the page creator has been notifed - if not, the admin should do so. If the creator was not logged in and did not use a consistent IP address, such notification is unneeded. ", 0)'));

td.appendChild(document.createElement('br'));

td.appendChild(makebutton('G1:nonsense',     'delete_button("G1", "patent nonsense", "No meaningful content or history, text unsalvageably incoherent (e.g., random characters). This does not include: copyvios, bad writing, partisan screeds, religious excogitations, immature material, flame bait, obscene remarks, vandalism (although pure vandalism is speediable under CSD G3), badly translated material, hoaxes, or fancruft, unless the material is actually unsalvageably incoherent. Please see patent nonsense.", 1)')); td.appendChild(makebutton('G2:test',         'delete_button("G2", "test page", "Test pages (e.g., Can I really create a page here?).", 1)')); td.appendChild(makebutton('G3:vandalism',    'delete_button("G3", "vandalism", "Pure vandalism (see also dealing with vandalism). This includes redirects created during cleanup of page move vandalism.", 0)')); td.appendChild(makebutton('G4:again',        'delete_button("G4", "repost of deleted content (Articles for deletion/' + pgname + ')", "A substantially identical copy, by any title, of a page that was deleted according to the deletion policy. Note that: Administrators faced with a recreation of previously speedily deleted content must determine that it did in fact meet a criterion for speedy deletion and had been appropriately deleted before they delete it again; and, This does not apply to content in userspace or to content undeleted according to the undeletion policy.", 0)')); td.appendChild(makebutton('G5:banned',       'delete_button("G5", "created by banned User:", "Contributions made by a banned user after they were banned, unless the user has been unbanned. This is slightly controversial!", 1)')); td.appendChild(makebutton('G6:history merge', 'delete_button("G6", "history merge", "Temporarily deleting a page in order to merge page histories after a cut and paste move.", 0)')); td.appendChild(makebutton('G7:request',      'delete_button("G7", "author request", "Any page which is requested for deletion by the original author, provided the author reasonably explains that it was created by mistake, and the page was edited only by its author.", 0)')); td.appendChild(makebutton('G8:orphan talk',  'delete_button("G8", "talk page of deleted page", "Talk pages of already deleted pages unless they contain records of the deletion discussion and are linked from Wikipedia:Archived delete debates (this doesnt apply if the deletion discussion is logged elsewhere, like an AfD sub-page or other log).", 0)'));

tr.appendChild(td); tbody.insertBefore(tr, box); }     else {         var criterion = document.getElementById('criterion'); if (criterion) {             while (criterion.hasChildNodes) criterion.removeChild(criterion.firstChild); criterion.appendChild(document.createTextNode(crit));

var orig_reason = document.getElementById('orig_reason').firstChild.data; if (csd == 'default') f.wpReason.value = orig_reason; else {                 var v = ''; if (csd != '') v = '' + csd + ': '; if (!display_orig) orig_reason = ''; if (txt !=  && orig_reason != ) txt += '; '; f.wpReason.value = v + txt + orig_reason; }           }        }    } }

function do_onload { cesarb_fixDiffOverflowLoadListener; resize_editbox(0); morelinks; if (document.title.indexOf('Wikipedia:Articles for deletion/Log/2') != -1) vfdsectionlinks('Wikipedia:Articles for deletion/Log/2'); else if (document.title.indexOf('Wikipedia:Featured picture candidates') != -1) vfdsectionlinks('/w/index.php?title=Wikipedia:Featured_picture_candidates&action=edit'); else if (document.title == 'View and restore deleted pages - Wikipedia, the free encyclopedia') toggle_undelete(1); else if (document.title == 'Confirm delete - Delete - Wikipedia, the free encyclopedia') delete_button(, , '', -1); }

if (window.addEventListener) window.addEventListener('load', do_onload, false); else if (window.attachEvent) window.attachEvent('onload', do_onload); //

// User:Lupin/popups.js - please include this line mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'             + '&action=raw&ctype=text/javascript&dontcountme=s');