User:Cryptic/standard.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
//<pre><nowiki> var hide_spoilers_initially = false; var hide_endspoiler_tag = false; /*</nowiki></pre> ==function addlink(url, name, node, prev)== <pre><nowiki>*/ function addlink(url, name, node, prev) { var na = document.createElement('a'); na.setAttribute('href', '/wiki/' + url); var txt = document.createTextNode(name); na.appendChild(txt); if (node) if (prev) node.insertBefore(na, prev); else node.appendChild(na); else return na; } /*</nowiki></pre> ==function addexplicitlink(url, name, node, prev)== <pre><nowiki>*/ function addexplicitlink(url, name, node, prev) { var na = document.createElement('a'); na.setAttribute('href', url); var txt = document.createTextNode(name); na.appendChild(txt); if (node) if (prev) node.insertBefore(na, prev); else node.appendChild(na); else return na; } /*</nowiki></pre> ==function add_id_link(url, name, id, node, prev)== <pre><nowiki>*/ function add_id_link(url, name, id, node, prev) { var na = document.createElement('a'); na.setAttribute('href', url); var txt = document.createTextNode(name); na.appendChild(txt); na.id = id; if (node) if (prev) node.insertBefore(na, prev); else node.appendChild(na); else return na; } /*</nowiki></pre> ==function pipe(node, txt, prev)== <pre><nowiki>*/ function pipe(node, txt, prev) { if (node) if (prev) node.insertBefore(document.createTextNode(txt ? txt : ' | '), prev); else node.appendChild(document.createTextNode(txt ? txt : ' | ')); else return document.createTextNode(' | '); } /*</nowiki></pre> ==function set_cookie(name, value, expires, path, domain, secure)== <pre><nowiki>*/ function set_cookie(name, value, expires, path, domain, secure) { document.cookie = name + '=' + escape(value) + (expires ? '; expires=' + expires.toGMTString() : '') + (path ? '; path=' + path : '; path=/') + (domain ? '; domain=' + domain : '') + (secure ? '; secure' : ''); } /*</nowiki></pre> ==function set_cookie_no_escape(name, value, expires, path, domain, secure)== <pre><nowiki>*/ function set_cookie_no_escape(name, value, expires, path, domain, secure) { document.cookie = name + '=' + value + (expires ? '; expires=' + expires.toGMTString() : '') + (path ? '; path=' + path : '; path=/') + (domain ? '; domain=' + domain : '') + (secure ? '; secure' : ''); } /*</nowiki></pre> ==function get_cookie(name)== <pre><nowiki>*/ function get_cookie(name) { var dc = document.cookie; var prefix = name + '='; var begin = dc.indexOf('; ' + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(';', begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } /*</nowiki></pre> ==function delete_cookie(name, path, domain)== <pre><nowiki>*/ function delete_cookie(name, path, domain) { if (getCookie(name)) document.cookie = name + '=' + (path ? '; path=' + path : '') + (domain ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT'; } /*</nowiki></pre> ==function replace()== <pre><nowiki>*/ function replace() { var s = prompt('Search regexp?'); if (s) { s = s.replace(new RegExp('\\n', 'g'), '\n'); var r = prompt('Replace regexp?').replace(new RegExp('\\n', 'g'), '\n'); var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, 'g'), r); } } /*</nowiki></pre> ==function set_preset_search_n_replace()== <pre><nowiki>*/ function set_preset_search_n_replace() { var preset_search = prompt('Search regexp?'); if (!preset_search) { delete_cookie('preset_search'); delete_cookie('preset_replace'); delete_cookie('preset_summary'); return; } var preset_replace = prompt('Replace with?'); var preset_summary = prompt('Summary?'); if (!preset_summary) { delete_cookie('preset_search'); delete_cookie('preset_replace'); delete_cookie('preset_summary'); return; } preset_search = preset_search.replace(new RegExp('\\n', 'g'), '\n'); preset_replace = preset_replace.replace(new RegExp('\\n', 'g'), '\n'); set_cookie('preset_search', preset_search); set_cookie('preset_replace', preset_replace); set_cookie('preset_summary', preset_summary); } /*</nowiki></pre> ==function preset_search_n_replace()== <pre><nowiki>*/ function preset_search_n_replace() { var f = document.editform; var txt = f.wpTextbox1; var preset_search = get_cookie('preset_search'); var preset_replace = get_cookie('preset_replace'); var preset_summary = get_cookie('preset_summary'); txt.value = txt.value.replace(new RegExp(preset_search, 'g'), preset_replace); if (f.wpSummary.value.indexOf(preset_summary) < 0) f.wpSummary.value += preset_summary; f.wpMinoredit.checked = true; f.wpDiff.click(); } /*</nowiki></pre> ==function set_preset_insertion(num)== <pre><nowiki>*/ function set_preset_insertion(num) { var preset_insertion = prompt('Insert what?'); if (!preset_insertion) { delete_cookie('preset_insertion_' + num); delete_cookie('preset_summary_' + num); delete_cookie('preset_label_' + num); return; } var preset_summary = prompt('Summary?'); if (!preset_summary) { delete_cookie('preset_insertion_' + num); delete_cookie('preset_summary_' + num); delete_cookie('preset_label_' + num); return; } var preset_label = prompt('Label?'); if (!preset_label) { delete_cookie('preset_insertion_' + num); delete_cookie('preset_summary_' + num); delete_cookie('preset_label_' + num); return; } set_cookie('preset_insertion_' + num, preset_insertion); set_cookie('preset_summary_' + num, preset_summary); set_cookie('preset_label_' + num, preset_label); } /*</nowiki></pre> ==function set_preset_go(num)== <pre><nowiki>*/ function set_preset_go(num) { var preset_go = prompt('Go where?'); if (!preset_go) { delete_cookie('preset_go_to_' + num); delete_cookie('preset_go_label_' + num); return; } var preset_label = prompt('Label?'); if (!preset_label) { delete_cookie('preset_go_to_' + num); delete_cookie('preset_go_label_' + num); return; } set_cookie('preset_go_to_' + num, preset_go); set_cookie('preset_go_label_' + num, preset_label); } /*</nowiki></pre> ==function unlk_per_afd()== <pre><nowiki>*/ function unlk_per_afd() { var f = document.editform; var txt = f.wpTextbox1; var last_whatlinkshere = get_cookie('last_whatlinkshere'); var last_afd = get_cookie('last_afd'); txt.value = txt.value.replace(new RegExp('\\[\\[ *(' + last_whatlinkshere + ') *\\]\\]', 'gi'), '$1'); txt.value = txt.value.replace(new RegExp('\\[\\[ *' + last_whatlinkshere + ' *\\|([^\\]]*)\\]\\]', 'gi'), '$1'); var summary = 'unlk [[' + last_whatlinkshere + ']] per [[' + last_afd + '|afd]]'; if (f.wpSummary.value.indexOf(summary) < 0) f.wpSummary.value += summary; f.wpMinoredit.checked = true; f.wpDiff.click(); } /*</nowiki></pre> ==function header_xfd(equals)== <pre><nowiki>*/ function header_xfd(equals) { var start = wgPageName.indexOf('/'); document.editform.wpTextbox1.value = equals + '[[' + document.title.substring(start + 1) + ']]' + equals + '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'header'; } /*</nowiki></pre> ==function oldafdfull()== <pre><nowiki>*/ function oldafdfull() { var date = prompt('Date?'); if (!date) return; if (date.match(/^ *([0-9]+) +([A-Z][a-z]+) +(200[0-9]) *$/)) date = '[[' + RegExp.$1 + ' ' + RegExp.$2 + ']] [[' + RegExp.$3 + ']]'; else if (date.match(/^ *([A-Z][a-z]+) +([0-9]+) +(200[0-9]) *$/)) date = '[[' + RegExp.$1 + ' ' + RegExp.$2 + ']] [[' + RegExp.$3 + ']]'; else { alert('Unrecognized date'); return; } template('oldafdfull|date=' + date + '|result=\'\'\'keep\'\'\'|votepage={{subst:PAGENAME}}'); } /*</nowiki></pre> ==function add_at_top(txt, sum)== <pre><nowiki>*/ function add_at_top(txt, sum) { document.editform.wpTextbox1.value = txt + '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = sum; } /*</nowiki></pre> ==function template(tm)== <pre><nowiki>*/ function template(tm) { add_at_top('{{' + tm + '}}', '{{' + tm + '}}'); } /*</nowiki></pre> ==function user_talk_template(tm, sum)== <pre><nowiki>*/ 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 + '{{subst:' + tm + '}} ~~~~\n'; document.editform.wpSummary.value = sum; } /*</nowiki></pre> ==function makebutton(lbl, action)== <pre><nowiki>*/ function makebutton(lbl, action) { var button = document.createElement('input'); button.type = 'button'; button.value = lbl; button.setAttribute('onClick', action); return button; } /*</nowiki></pre> ==function strip_namespace(target)== <pre><nowiki>*/ 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; } /*</nowiki></pre> ==function transwiki_log()== <pre><nowiki>*/ 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 [[Wikipedia:Articles for deletion/' + title + ']], or empty for none'); if (vfdd == 'y' || vfdd == 'Y') vfdd = ' ([[Wikipedia:Articles for deletion/' + title + '|AfD]])'; else if (vfdd == 'n' || vfdd == 'N' || vfdd == '') vfdd = ''; else vfdd = ' ([[Wikipedia:Articles for deletion/' + vfdd + '|AfD]])'; txt.value += '*[[' + title + ']] → [[' + target + ':Transwiki:' + title + ']] ~~~~' + vfdd; document.editform.wpSummary.value = '[[' + title + ']] transwikied to [[' + target + ':Transwiki:' + title + ']]' + vfdd; } } } /*</nowiki></pre> ==function transwiki_to()== <pre><nowiki>*/ 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; } /*</nowiki></pre> ==function interwiki(lk, td, a, host, abbrev)== <pre><nowiki>*/ function interwiki(lk, td, a, host, abbrev) { host = lk.replace(/source/, host); addexplicitlink(host, abbrev, td, a); if (abbrev == 'D' || abbrev == 'd') { pipe(td, '/', a); addexplicitlink(host.toLowerCase(), 'lc', td, a); } pipe(td, 0, a); } /*</nowiki></pre> ==function link_ul_edit(isnull)== <pre><nowiki>*/ 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'; } } /*</nowiki></pre> ==function close_xfd(xfd)== <pre><nowiki>*/ function close_xfd(xfd) { var result = prompt('Result?'); if (result) { if (result.match(/'''(.*?)'''/)) summary = 'close discussion: ' + RegExp.$1; else { summary = 'close discussion: ' + result; result = '\'\'\'' + result + '\'\'\''; } var txt = document.editform.wpTextbox1; txt.value = '{{subst:' + xfd + ' top}} ' + result + '. ~~~~\n' + txt.value.replace(new RegExp('\\{\\{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD\\|.?\\}\\}', 'g'), '') + '{{subst:' + xfd + ' bottom}}'; document.editform.wpSummary.value += summary; } } /*</nowiki></pre> ==function add_revert_links_history()== <pre><nowiki>*/ function add_revert_links_history() { var lk = 0, i, j, spans, user, next, tgt, revertee = '', lis, as; try { lk = document.getElementById('pagehistory'); } catch (i) { lk = 0; } if (!lk) return; lis = lk.getElementsByTagName('li'); for (i = 0; i < lis.length; ++i) { j = lis[i].getElementsByTagName('a'); j[0].href = j[0].href.replace(/#.*/, ''); if (j[0].firstChild.data == 'cur') j[1].href = j[1].href.replace(/#.*/, ''); 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='; //addexplicitlink(tgt + 'vandalism', 'Vnd', lis[i], date); //addexplicitlink(tgt + 'test', 'Tst', lis[i], date); //addexplicitlink(tgt + 'blanking', 'Blk', lis[i], date); addexplicitlink(tgt + 'edits', '[rv] ', lis[i], date); //pipe(lis[i], ' ', date); // add an invisible |, for ease of pasting into {{unsigned2}} var hidden = document.createElement('span'); pipe(hidden, '|'); hidden.setAttribute('style', 'color: #ffffec;'); lis[i].removeChild(date.nextSibling); lis[i].insertBefore(hidden, date.nextSibling); if (revertee == '') revertee = user.firstChild.firstChild.data; else if (revertee != user.firstChild.firstChild.data) revertee = ' '; } } /*</nowiki></pre> ==function node_getElementsByTagName(node, tag)== <pre><nowiki>*/ // Like document.getElementsByTagName, but finds only direct children of a given node function node_getElementsByTagName(node, tag) { var arr = new Array; tag = tag.toUpperCase(); for (node = node.firstChild; node; node = node.nextSibling) if (node.tagName == tag) arr[arr.length] = node; return arr; } /*</nowiki></pre> ==function recurse_guts(node, tag, arr)== <pre><nowiki>*/ function recurse_guts(node, tag, arr) { for (node = node.firstChild; node; node = node.nextSibling) { if (node.tagName == tag) arr[arr.length] = node; if (node.firstChild) recurse_guts(node, tag, arr); } } /*</nowiki></pre> ==function recurse_getElementsByTagName(node, tag)== <pre><nowiki>*/ // As node_getElementsByTagName, but recurses children function recurse_getElementsByTagName(node, tag) { var arr = new Array; tag = tag.toUpperCase(); recurse_guts(node, tag, arr); return arr; } /*</nowiki></pre> ==function morelinks()== <pre><nowiki>*/ function morelinks() { var lk = 0, a, table, tds, td, lks, txt, deleted_edits = 0; try { table = document.getElementById('topbar').getElementsByTagName('table')[0]; tds = table.getElementsByTagName('td'); td = tds[1]; lks = td.getElementsByTagName('a'); } catch (a) { return; } // Add comment link to top, and replace Main Page with New pages 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 == 'Edit this page') { txt = lks[a].getAttribute('href'); lk = lks[a + 1]; addexplicitlink(txt + '§ion=new', 'Comment', td, lk); pipe(td, 0, lk); addexplicitlink(txt + '&fakeaction=nulledit', 'null', td, lk); pipe(td, 0, lk); } else if (txt == 'Page history') { // Rename to 'History', add a link to Special:Undelete/pagename after it. lks[a].childNodes[0].data = 'History'; txt = lks[a].getAttribute('href').replace(/&action=history$/, '').replace(/title=/, 'title=Special:Undelete/'); addexplicitlink(txt + '&fakeaction=show_most_recent', '(show)', td, lks[a].nextSibling); pipe(td, ' ', lks[a].nextSibling); deleted_edits = addexplicitlink(txt, 'deleted'); td.insertBefore(deleted_edits, lks[a].nextSibling); pipe(td, 0, lks[a].nextSibling); ++a; } } td = td.getElementsByTagName('p')[0]; if (!td) return; var wlh = -1; //pipe(td.parentNode, 0, td); //var loc = new String(document.location).replace(/en\.wikipedia\.org/, 'localhost:8872'); //addexplicitlink(loc + '&fakeaction=album_infobox', 'Fix album infobox', td.parentNode, td); // Handy links to reload user js and css if (document.title.indexOf('User:Cryptic/standard') >= 0) { pipe(td.parentNode, 0, td); addexplicitlink('/w/index.php?title=User:Cryptic/standard.js&action=raw&ctype=text/javascript', 'js', td.parentNode, td); pipe(td.parentNode, 0, td); addexplicitlink('/w/index.php?title=User:Cryptic/standard.css&action=raw&ctype=text/css', 'css', td.parentNode, td); } else if (document.title.indexOf('Category:') == 0 || document.title.indexOf('Image:') == 0 || (wlh = new String(document.location).indexOf('Special:Whatlinkshere')) >= 0) { pipe(td.parentNode, 0, td); add_id_link('javascript:link_ul_edit(true)', 'null', 'link_ul_null_edit', td.parentNode, td); add_id_link('javascript:link_ul_edit(false)', 'edit', 'link_ul_edit', td.parentNode, td); if (wlh >= 0) { var h = document.getElementsByTagName('H1')[0]; h.parentNode.insertBefore(makebutton('Fix double redirects', 'javascript:fix_double_redirects()'), h.nextSibling); var title = document.getElementsByTagName('H1')[0].firstChild.data; set_cookie('last_whatlinkshere', title); } } // 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 while (td.hasChildNodes()) { lk = td.firstChild; if (lk.nodeName == 'A' && lk.firstChild.data == 'Current revision') { a = tds[1].getElementsByTagName('p')[0]; pipe(tds[1], 0, a); addexplicitlink(lk.href, 'Current', tds[1], 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:Cryptic&action=history'); } } else if (lk.nodeType == 3 /*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]; pipe(tds[1], 0, a); tds[1].insertBefore(lk.nextSibling, a); } } td.removeChild(td.firstChild); } // Replace them addlink('Special:Watchlist', 'Watchlist', td); pipe(td); addlink('Special:Randompage', 'Random', td); pipe(td); addexplicitlink('/w/index.php?title=Special:Contributions&hideminor=0&target=Cryptic&limit=500&offset=0', 'Contribs', td); pipe(td, '/'); addexplicitlink('/w/index.php?title=Special%3ALog&type=&user=Cryptic&page=', 'Log', td); pipe(td); addlink('Special:Specialpages', 'Special', td); pipe(td); var preset_go = get_cookie('preset_go_to_1'); var preset_go_label = get_cookie('preset_go_label_1'); if (preset_go && preset_go_label) { addlink(preset_go, preset_go_label, td); pipe(td, ' '); addexplicitlink('javascript:set_preset_go(1)', '(c)', td); } else addexplicitlink('javascript:set_preset_go(1)', 'set preset go', td); try { var title = /^http:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/.exec(decodeURI(location.href))[2].split(' ').join('_'); if (title.indexOf('Special:') != 0) { pipe(td); addexplicitlink('/w/index.php?title=Special:Log&page=' + title, 'Logs', td); if (title.indexOf('User:') == 0 || title.indexOf('User_talk:') == 0) { var user = /^(User|User_talk):([^&?\/#]*)/.exec(title)[2]; pipe(td); addexplicitlink('/w/index.php?title=Special:Log&user=' + user, 'Actions', td); pipe(td); addexplicitlink('/w/index.php?title=Special:Blockip&ip=' + user, 'Block', td); pipe(td, '/'); addexplicitlink('/w/index.php?title=Special:Log&type=block&page=User:' + user, 'Log', td); } } } catch (a) {} var title = document.getElementsByTagName('H1')[0].firstChild.data; if (title.indexOf('Wikipedia:Articles for deletion/') == 0) { try { var as = recurse_getElementsByTagName(document.getElementById('article'), 'A'); for (var i = 0; i < as.length; ++i) if (as[i].href) as[i].onclick = 'set_cookie_no_escape(\'last_afd\', \'' + escape(title) + '\')'; } catch (title) {} } try { var hdr = document.getElementById('delete-reason').innerHTML; hdr = hdr.replace(new RegExp('<[aA] href="http://en.wikipedia.org/wiki/[^"]*" title="([^"]*)">\\1</[aA]>', 'g'), '[[$1]]'); hdr = hdr.replace(new RegExp('<[aA] href="http://en.wikipedia.org/wiki/[^"]*" title="([^"]*)">([^<]*)</[aA]>', 'g'), '[[$1|$2]]'); hdr = hdr.replace(new RegExp('^Expired prod, concern', 'g'), '[[WP:PROD]]'); hdr = hdr.replace(new RegExp('\'', 'g'), '\\\''); set_cookie('delete-reason', hdr); } catch (title) {} if ((/&action=edit/.test(window.location.href) || /&action=submit/.test(window.location.href)) && document.title.indexOf('View and restore deleted pages') != 0) { // hide the 'Save page' button if I haven't previewed yet try { document.editform.wpSave.onclick = 'force_preview()'; } catch (title) {} pipe(td); addexplicitlink('javascript:replace()', 'Replace', td); pipe(td); for (var num = 1; num <= 3; ++num) { var preset_insertion = get_cookie('preset_insertion_' + num); var preset_summary = get_cookie('preset_summary_' + num); var preset_label = get_cookie('preset_label_' + num); if (preset_insertion && preset_summary && preset_label) { addexplicitlink('javascript:add_at_top(\'' + preset_insertion + '\', \'' + preset_summary + '\')', preset_label, td); pipe(td, ' '); addexplicitlink('javascript:set_preset_insertion(' + num + ')', '(c)', td); pipe(td); } else { addexplicitlink('javascript:set_preset_insertion(' + num + ')', 'set#' + num, td); pipe(td); break; } } if (document.title.indexOf('Editing User talk:') == 0) { addexplicitlink('javascript:user_talk_template(\'test\', \'your test\')', 'Test', td); pipe(td); addexplicitlink('javascript:user_talk_template(\'test2\', \'{{test2}}\')', '2', td); pipe(td, '/'); addexplicitlink('javascript:user_talk_template(\'test2a\', \'{{test2a}}\')', 'a', td); pipe(td); addexplicitlink('javascript:user_talk_template(\'test3\', \'{{test3}}\')', '3', td); pipe(td); addexplicitlink('javascript:user_talk_template(\'test4\', \'{{test4}}\')', '4', td); pipe(td); addexplicitlink('javascript:user_talk_template(\'test5\', \'{{test5}}\')', '5', td); //pipe(td); //addexplicitlink('javascript:user_talk_template(\'nothanks|\' + prompt(\'Copyvio at?\'), \'no thanks\')', 'Nothanks', td); } else if (document.title.indexOf('Editing Talk:') == 0) addexplicitlink('javascript:oldafdfull()', 'Oldafdfull', td); else if (document.title.indexOf('Editing Wikipedia:Transwiki log') == 0) addexplicitlink('javascript:transwiki_log()', 'Log entry', td); 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) { addexplicitlink('javascript:header_xfd(\'===\')', 'Header', td); pipe(td); addexplicitlink('javascript:close_xfd(\'afd\')', 'Close', td); } else if (document.title.indexOf('Editing Wikipedia:Miscellany for deletion/') == 0) { addexplicitlink('javascript:header_xfd(\'====\')', 'Header', td); pipe(td); addexplicitlink('javascript:close_xfd(\'mfd\')', 'Close', td); } else if (document.title.indexOf('Editing Wikipedia:Templates for deletion/Log/') == 0 && new String(document.location.href).indexOf('§ion=') >= 0) addexplicitlink('javascript:close_xfd(\'tfd\')', 'Close', td); else if (document.title.indexOf('Editing Wikipedia:Redirects for deletion') == 0) addexplicitlink('javascript:close_xfd(\'rfd\')', 'Close', td); else { //addexplicitlink('javascript:template(\'cleanup-date|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}\')', 'cleanup', td); //pipe(td); //addexplicitlink('javascript:transwiki_to()', 'TranswikiTo', td); //pipe(td); var preset_search = get_cookie('preset_search'); var preset_replace = get_cookie('preset_replace'); var preset_summary = get_cookie('preset_summary'); if (preset_search && preset_summary) { addexplicitlink('javascript:preset_search_n_replace()', 's/' + preset_search + '/' + preset_replace + '/g', td); pipe(td, ' '); addexplicitlink('javascript:set_preset_search_n_replace()', '(c)', td); } else addexplicitlink('javascript:set_preset_search_n_replace()', 'set preset search/replace', td); var last_whatlinkshere = get_cookie('last_whatlinkshere'); var last_afd = get_cookie('last_afd'); if (last_whatlinkshere && last_afd) { pipe(td); addexplicitlink('javascript:unlk_per_afd()', 'unlk [[' + last_whatlinkshere + ']]', td); } } 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('=') + 1; var name = l[i].substring(0, eq - 1); if (name == 'fakeaction') action = l[i].substring(eq); else if (name == 'faketarget') target = unescape(l[i].substring(eq)).replace(/_/g, ' '); else if (name == 'fakedate') date = unescape(l[i].substring(eq)); else if (name == 'fakeuser') user = unescape(l[i].substring(eq)); else if (name == 'fakerevertee') revertee = unescape(l[i].substring(eq)); } } if (action == 'nulledit') { var f = document.editform; f.wpMinoredit.checked = true; f.wpSummary.value = 'null edit'; f.wpSave.onclick = ''; f.wpSave.click(); } else if (action == 'revert') { if (target == 'edits' && revertee == '') target = ''; else target += ' '; var f = document.editform; if (revertee != '') f.wpSummary.value = 'rv ' + target + 'by [[Special:Contributions/' + revertee + '|' + revertee + ']] back to ' + date + ' edit by [[User:' + user + '|' + user + ']]'; else f.wpSummary.value = 'rv ' + target + 'back to ' + date + ' edit by [[User:' + user + '|' + user + ']]'; f.wpMinoredit.checked = true; if (target != 'edits ' && target != '') f.wpSave.click(); } else if (action == 'fix_dbl_redir') { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\[\[[^\]]+\]\]/, '[[' + target + ']]'); document.editform.wpSummary.value = 'dbl redir'; document.editform.wpMinoredit.checked = true; document.editform.wpDiff.click(); } } // 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'); } /*</nowiki></pre> ==function force_preview()== <pre><nowiki>*/ function force_preview() { if ((/&action=edit/.test(window.location.href) && !confirm('Are you sure you want to submit without previewing?')) || (window.location.href.match(/\?title=User:([^?&\/#]*)/) && RegExp.$1 != 'Cryptic' && !confirm('Hey, clueless!\n\nYou\'re editing someone else\'s user page, not their talk page. You sure?'))) { document.editform.wpSave.value = document.editform.wpPreview.value; document.editform.wpSave.name = 'wpPreview'; } } /*</nowiki></pre> ==function afdsectionlinks(thispage)== <pre><nowiki>*/ // Change section links in vfd log pages to edit the entire subpage, instead of its section function afdsectionlinks(thispage) { var spans = document.getElementsByTagName('span'); var a; var url; var pos; for (var x = 0; x < spans.length; ++x) if (spans[x].className == 'editsection') { a = spans[x].getElementsByTagName('a')[0]; url = a.getAttribute('href'); pos = url.indexOf('action=edit§ion='); if (pos != -1) { url = url.substring(0, pos + 11); if (url.indexOf(thispage) < 0) a.setAttribute('href', url); } } } /*</nowiki></pre> ==function resize_editbox(delta)== <pre><nowiki>*/ function resize_editbox(delta) { 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; case 50: tb.rows = 75; 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; case 75: tb.rows = 50; 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'); if (!art) art = document.getElementById('bodyContent'); art.insertBefore(div, art.firstChild); } } /*</nowiki></pre> ==function link_links_in_diffs()== <pre><nowiki>*/ function link_links_in_diffs() { var tds = document.getElementsByTagName('td'); for (var i = 0; i < tds.length; ++i) if (tds[i].className == 'diff-deletedline' || tds[i].className == 'diff-addedline' || tds[i].className == 'diff-context') { var txt = tds[i].innerHTML.replace(new RegExp('(\\[\\[:?)([^\\]|<]+)([\\]|])', 'g'), '$1<a href="http://en.wikipedia.org/wiki/$2">$2</a>$3'); tds[i].innerHTML = txt.replace(new RegExp('(\\[\\[[^\\]|]*<SPAN class="[^"]*">:?)([^\\]|<]+)(</SPAN>[\\]|])', 'g'), '$1<a href="http://en.wikipedia.org/wiki/$2">$2</a>$3'); } } /*</nowiki></pre> ==function cesarb_fixDiffOverflowTableCell(cell)== <pre><nowiki>*/ 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); } /*</nowiki></pre> ==function cesarb_fixDiffOverflowTable(table)== <pre><nowiki>*/ 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; } } } /*</nowiki></pre> ==function cesarb_fixDiffOverflowLoadListener(evt)== <pre><nowiki>*/ 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); link_links_in_diffs(); break loop; } } } /*</nowiki></pre> ==function toggle_undelete(init)== <pre><nowiki>*/ 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; } } } /*</nowiki></pre> ==function undelete_page_stuff()== <pre><nowiki>*/ function undelete_page_stuff() { toggle_undelete(1); if (location.search) { var l = location.search.substring(1).split('&'); for (var i = 0; i < l.length; ++i) { var eq = l[i].indexOf('=') + 1; var name = l[i].substring(0, eq - 1); if (name == 'fakeaction') { var a; name = l[i].substring(eq); //try { if (name == 'show_most_recent') { a = node_getElementsByTagName(node_getElementsByTagName(document.getElementById('undelete'), 'UL')[1].firstChild, 'A')[0]; window.location.href = a.href + '&fakeaction=show_preview'; } else if (name == 'show_preview') { var forms = document.getElementsByTagName('FORM'); loop: for (var j = 0; j < forms.length; ++j) if (forms[j].action.indexOf('Undelete') >= 0) { var inputs = node_getElementsByTagName(forms[j], 'INPUT'); for (var k = 0; k < inputs.length; ++k) if (inputs[k].type == 'submit') { inputs[k].click(); break loop; } } } } //catch (a) {} return; } } } } /*</nowiki></pre> ==function delete_button(csd, txt, crit, display_orig)== <pre><nowiki>*/ function delete_button(csd, txt, crit, display_orig) { var f = document.getElementById('deleteconfirm'); if (f) { if (display_orig == -1) { var pgname = wgPageName.replace(/_/g, ' ').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('Copyvio', 'delete_button(\'\', \'Copyvio; listed on [[WP:CP]] since \', \'\', 0)')); td.appendChild(makebutton('RFD', 'delete_button(\'\', \'Listed on [[WP:RFD]] since ; \', \'\', 1)')); td.appendChild(makebutton('AFD', 'delete_button(\'\', \'[[Wikipedia:Articles for deletion/' + pgname + ']]\', \'\', 0)')); try { var hdr = get_cookie('delete-reason'); td.appendChild(makebutton('HDR', 'delete_button(\'\', \'' + hdr + '\', \'\', 0)')); } catch (title) {} td.appendChild(document.createElement('br')); td.appendChild(makebutton('U1:owner', 'delete_button(\'U1\', \'owner request\', \'User request. Personal subpages, upon request by their user. In some rare cases there may be administrative need to retain the page. Also, sometimes, main user pages may be deleted as well. See Wikipedia:User page for full instructions and guidelines.\', 0)')); td.appendChild(makebutton('U2:nonexistent', 'delete_button(\'U2\', \'nonexistent user\', \'Nonexistent user. User pages of users that do not exist. (Check Special:Contributions.)\', 1)')); td.appendChild(makebutton('U3:fu gallery', 'delete_button(\'U3\', \'fair-use gallery\', \'Fair use galleries. Galleries in the user space which consist mostly of fair use images.\', 0)')); td.appendChild(makebutton('P2:underpopulated','delete_button(\'P2\', \'underpopulated portal\', \'Underpopulated Portal. Any Portal based on a topic for which there is not a non-stub header article, and at least three non-stub articles detailing subject matter that would be appropriate to discuss under the title of that Portal.\', 1)')); td.appendChild(document.createElement('br')); td.appendChild(makebutton('C1:empty', 'delete_button(\'C1\', \'empty 4 days, no content other than parent categories\', \'Empty categories (no articles or subcategories for at least four days) whose only content has consisted of links to parent categories. This does not apply to categories being discussed on WP:CFD, or disambiguation categories. If the category isnt relatively new, it possibly contained articles earlier, and deeper investigation is needed.\', 1)')); td.appendChild(makebutton('C2:rename', 'delete_button(\'C2\', \'empty, speedy rename\', \'Speedy renaming. Empty categories that have qualified for speedy renaming. *Typo fixes (e.g., Brdiges -> Bridges), but not changes between British and American spelling. *Capitalization fixes (e.g., characters In harry Potter -> Characters in Harry Potter) *Conversions from singular to plural, or back (e.g., Steamship -> Steamships) *Renaming to conform with the by country categorization conventions *Abbreviation expanding for country names, e.g. changing U.S. to United States\', 1)')); td.appendChild(makebutton('C3:template', 'delete_button(\'C3\', \'populated solely by [[Template:]]\', \'Template categories. If a category is solely populated from a template (e.g. Category:Wikipedia cleanup from {cleanup}) and the template is deleted per deletion policy, the category can also be deleted without further discussion.\', 1)')); td.appendChild(makebutton('T1:inflammatory', 'delete_button(\'T1\', \'inflammatory\', \'Templates that are divisive and inflammatory.\', 0)')); td.appendChild(document.createElement('br')); td.appendChild(makebutton('I1:redundant', 'delete_button(\'I1\', \'redundant copy of [[:Image:]]\', \'Redundant. Any image that is a redundant copy, in the same image file format and same or lower resolution, of something else on Wikipedia. Likewise, other media that is a redundant copy, in the same format and of the same or lower quality. This does not apply to images duplicated on Wikimedia Commons, because of licence issues; these should be tagged with {NowCommons|Image:newname.ext} or {NowCommonsThis} instead.\', 1)')); td.appendChild(makebutton('I2:corrupt', 'delete_button(\'I2\', \'corrupt or empty\', \'Corrupt or empty image. Before deleting this type of image, verify that the MediaWiki engine cannot read it by previewing a resized thumbnail of it. This also includes empty (i.e., no content) image description pages for Commons images.\', 1)')); td.appendChild(makebutton('I3:permis', 'delete_button(\'I3\', \'permission-only image\', \'Improper license. Images licensed as for non-commercial use only, non-derivative use or used with permission that were uploaded on or after May 19, 2005, and for which no assertion of fair use is provided. This includes images licensed under a Non-commercial Creative Commons License. Such images uploaded before May 19, 2005 may also be speedily deleted if they are not used in any articles.\', 1)')); td.appendChild(makebutton('I3:non-com', 'delete_button(\'I3\', \'noncommercial-only image\', \'Improper license. Images licensed as for non-commercial use only, non-derivative use or used with permission that were uploaded on or after May 19, 2005, and for which no assertion of fair use is provided. This includes images licensed under a Non-commercial Creative Commons License. Such images uploaded before May 19, 2005 may also be speedily deleted if they are not used in any articles.\', 1)')); td.appendChild(makebutton('I4:source', 'delete_button(\'I4\', \'no source since \', \'Lack of licensing information. Images in category Images with unknown source, Images with unknown copyright status, or Images with no copyright tag that have been tagged with a template that places them in the category for more than seven days, regardless of when uploaded. Note, users sometimes specify their source in the upload summary, so be sure to check the circumstances of the image.\', 1)')); td.appendChild(makebutton('I4:license', 'delete_button(\'I4\', \'unknown license since \', \'Lack of licensing information. Images in category Images with unknown source, Images with unknown copyright status, or Images with no copyright tag that have been tagged with a template that places them in the category for more than seven days, regardless of when uploaded. Note, users sometimes specify their source in the upload summary, so be sure to check the circumstances of the image.\', 1)')); td.appendChild(makebutton('I5:or-fu', 'delete_button(\'I5\', \'orphan fair use since \', \'Unused unfree copyrighted images. Images and other media that are not under a free license or in the public domain that are not used in any article and that have been tagged with a template that places them in a dated subcategory of Category:Orphaned fairuse images for more than seven days. Reasonable exceptions may be made for images uploaded for an upcoming article. Use {subst:orfud} to tag images for forthcoming deletion.\', 1)')); td.appendChild(makebutton('I6:no-fu-rationale','delete_button(\'I6\', \'no fair-use rationale since \', \'Missing fair-use rationale. Any image or media tagged only with a generic fair use template, with no fair use rationale, may be deleted seven days after it was uploaded. Images and other media uploaded before May 4, 2006 should not be deleted immediately; instead, the uploader should be notified that a fair-use rationale is needed. Images or other media uploaded after May 4, 2006 can be tagged with {subst:nrd}, and the uploader notified with {subst:missing rationale|Image:image name}. Such images can be found in the dated subcategories of Category:Images with no fair use rationale.\', 1)')); td.appendChild(makebutton('I7:invalid-fu', 'delete_button(\'I7\', \'invalid fair-use claim since \', \'Invalid fair-use claim. Any image or media with a clearly invalid fair-use tag (such as a {logo} tag on a photograph of a mascot) may be deleted at any time. Media that fail any part of the fair use criteria and were uploaded after 13 July 2006 may be deleted forty-eight hours after notification of the uploader. For media uploaded before 13 July 2006 or tagged with the {Replaceable fair use} template, the uploader will be given seven days to comply with this policy after being notified.\', 1)')); td.appendChild(makebutton('I8:commons', 'delete_button(\'I8\', \'at [[commons:Image:]]\', \'Images available as bit-for-bit identical copies on the Wikimedia Commons, provided the following conditions are met: *The images license and source status is beyond reasonable doubt, and the license is undoubtedly accepted at Commons. *All image revisions that meet the first condition have been transferred to Commons as revisions of the Commons copy and properly marked as such. *All information on the image description page is present on the Commons image description page. That includes the complete upload history with links to the uploaders local user pages. *If there is any information not relevant to any other project on the image description page (like {FeaturedPicture}), the image description page must be undeleted after the file deletion. *The image is not protected, and the image description page does not contain a request not to move it to Commons. *The image has been marked with Template:NowCommons or Template:NowCommonsThis for at least one week. *If the image is available on Commons under a different name than locally, it must not be used on any local page whatsoever. *For {c-uploaded} images: They may be speedily deleted as soon as they are off the Main Page.\', 1)')); td.appendChild(document.createElement('br')); td.appendChild(makebutton('R1:broken', 'delete_button(\'R1\', \'non-existent target\', \'Redirects to non-existent pages.\', 1)')); td.appendChild(makebutton('R2:userspace', 'delete_button(\'R2\', \'redirect to user: space\', \'Redirects to the User: or User_talk: space from the main article space. If this was the result of a page move, consider waiting a day or two before deleting the redirect.\', 1)')); td.appendChild(makebutton('R4:typo', 'delete_button(\'R3\', \'typo\', \'Redirects as a result of an implausible typo that were recently created. However, redirects from common misspellings or misnomers are generally 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 for the article to qualify as a valid stub.\', 1)')); td.appendChild(makebutton('A2:foreign', 'delete_button(\'A2\', \'foreign language article existing on another Wikimedia project\', \'Foreign language articles that exist on another Wikimedia project. If the article in question does not exist on another project, the template {notenglish} should be used instead.\', 1)')); td.appendChild(makebutton('A3:ext.lk', 'delete_button(\'A3\', \'zero content\', \'No content whatsoever. Any article consisting only of links elsewhere (including hyperlinks, category tags and "see also" sections), a rephrasing of the title, and/or attempts to correspond with the person or group named by its title. This does not include disambiguation pages.\', 1)')); td.appendChild(makebutton('A3:correspond', 'delete_button(\'A3\', \'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\', \'Transwikied articles. Any article that has been discussed at Articles for Deletion (et al), where the outcome was to transwiki, and where the transwikification has been properly performed and the author information recorded.\', 1)')); td.appendChild(makebutton('A7:nnbio', 'delete_button(\'A7\', \'nnbio\', \'Unremarkable people, groups, companies and web content. An article about a real person, group of people, band, club, company, or web content that does not assert the importance or significance of its subject. If the assertion is controversial or there has been a previous AfD, the article should be nominated for AfD instead. Note: Avoid the word "vanity" in deletion summaries since it may be insulting.\', 1)')); td.appendChild(makebutton('A7:nngroup', 'delete_button(\'A7\', \'nngroup\', \'Unremarkable people, groups, companies and web content. An article about a real person, group of people, band, club, company, or web content that does not assert the importance or significance of its subject. If the assertion is controversial or there has been a previous AfD, the article should be nominated for AfD instead. Note: Avoid the word "vanity" in deletion summaries since it may be insulting.\', 1)')); td.appendChild(makebutton('A7:nncompany', 'delete_button(\'A7\', \'nncompany\', \'Unremarkable people, groups, companies and web content. An article about a real person, group of people, band, club, company, or web content that does not assert the importance or significance of its subject. If the assertion is controversial or there has been a previous AfD, the article should be nominated for AfD instead. Note: Avoid the word "vanity" in deletion summaries since it may be insulting.\', 1)')); td.appendChild(makebutton('A7:nnweb', 'delete_button(\'A7\', \'nnweb\', \'Unremarkable people, groups, companies and web content. An article about a real person, group of people, band, club, company, or web content that does not assert the importance or significance of its subject. If the assertion is controversial or there has been a previous AfD, the article should be nominated for AfD instead. Note: Avoid the word "vanity" in deletion summaries since it may be insulting.\', 1)')); td.appendChild(document.createElement('br')); td.appendChild(makebutton('G1:nonsense', 'delete_button(\'G1\', \'patent nonsense\', \'Patent nonsense and gibberish, an unsalvageably incoherent page with no meaningful content. This does not include: poor writing, partisan screeds, obscene remarks, vandalism, fictional material, material not in English, badly translated material, implausible theories, or hoaxes.\', 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, including redirects created during cleanup of page move vandalism.\', 0)')); td.appendChild(makebutton('G4:again', 'delete_button(\'G4\', \'repost of deleted content ([[Wikipedia:Articles for deletion/' + pgname + ']])\', \'Recreation of deleted material. A substantially identical copy, by any title, of a page that was deleted as a result of a discussion in Articles for deletion or another XfD process, unless it was undeleted per the undeletion policy or was recreated in the user space. Before deleting again, the admin should ensure that the material is substantially identical and not merely a new article on the same subject. This clause does not apply if the only prior deletions were speedy or proposed deletions, although in this case, the previous speedy criterion, or other speedy deletion criteria, may apply.\', 0)')); td.appendChild(makebutton('G5:banned', 'delete_button(\'G5\', \'created by banned [[User:]]\', \'Banned user. Pages created by banned users while they were banned.\', 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\', \'Author requests deletion. Any page for which deletion is requested by the original author, provided the pages only substantial content was added by its author and was mistakenly created. If the author blanks the page, this can be taken as a deletion request.\', 0)')); td.appendChild(makebutton('G8:orphan talk', 'delete_button(\'G8\', \'talk page of deleted page\', \'Talk pages of pages that do not exist, unless they contain deletion discussion that isnt logged elsewhere. Subpages (including archive pages) are only deletable under this rule if the corresponding top-level page does not exist. Exceptions to this are user talk pages and talk pages of images on Commons.\', 0)')); td.appendChild(makebutton('G10:attack', 'delete_button(\'G10\', \'attack page\', \'Attack pages. Pages that serve no purpose but to disparage their subject or some other entity (e.g., John Q. Doe is an imbecile). This includes a biography of a living person that is negative in tone and unsourced, where there is no NPOV version in the history to revert to.\', 0)')); td.appendChild(makebutton('G11:spam', 'delete_button(\'G11\', \'blatant advertising\', \'Blatant advertising. Pages which exclusively promote a company, product, group or service and which would need to be fundamentally rewritten in order to become encyclopedic. Note that simply having a company, product, group or service as its subject does not qualify an article for this criterion: an article that is blatant advertising should have inappropriate content as well. If a page has previously gone through deletion process and was not deleted, it should not be speedily deleted under this criterion.\', 0)')); td.appendChild(makebutton('G12:copyvio', 'delete_button(\'G12\', \'copyvio from \', \'Blatant copyright infringement which meets these parameters: *Material was copied from another website which does not have a license compatible with Wikipedia; *Uploader does not assert permission (for images: no assertion aside from tags or not fair use) or the assertion is questionable; *The page does not have substantial edits by multiple users and there are no non-infringing revisions in the page history worth saving. When tagging a page for deletion under this criterion, a user should notify the pages creator using {Nothanks-sd} or a similar message. If the deleting administrator is notified of a plausible error, they should restore the content and, if a confirmation email has not been received, follow the Wikipedia:Copyright problems procedure, blanking the article with the {copyvio} template. Some suspected copyright infringements that need to be dealt with are listed at Wikipedia:Suspected copyright violations.\', 0)')); tr.appendChild(td); tbody.insertBefore(tr, box); } else { var criterion = document.getElementById('criterion'); if (criterion) { while (criterion.hasChildNodes()) criterion.removeChild(criterion.firstChild); if (crit) pipe(criterion, crit); var orig_reason = document.getElementById('orig_reason').firstChild.data; if (csd == 'default') f.wpReason.value = orig_reason; else { var v = ''; if (csd != '') v = '[[WP:CSD#' + csd + '|' + csd + ']]: '; if (!display_orig) orig_reason = ''; if (txt != '' && orig_reason != '') txt += '; '; f.wpReason.value = v + txt + orig_reason; } } } } } /*</nowiki></pre> ==function openahah(kk)== <pre><nowiki>*/ function openahah(kk) { var as = document.getElementsByTagName('a'); var j = 0, k = 0; ++kk; for (var n = 0; n < as.length; ++n) if (as[n].innerHTML == 'hist' && kk - k++ <= 20) { if (k <= kk) { as[n].setAttribute('class', as[n].getAttribute('class') + ' modified'); window.open(as[n].href, '_blank'); } else break; } } /*</nowiki></pre> ==function addahah()== <pre><nowiki>*/ function addahah() { var as = document.getElementsByTagName('a'); var k = 0; for (var n = 0; n < as.length; ++n) { if (as[n].innerHTML == 'diff') as[n].href = as[n].href.replace(/&curid=[0-9]+/, ''); else if (as[n].innerHTML == 'hist') { addexplicitlink('javascript:openahah(' + (k++) + ')', 'ahah', as[n].parentNode, as[n].nextSibling); pipe(as[n].parentNode, ') (', as[n].nextSibling); } } } /*</nowiki></pre> ==function fix_relatedchanges()== <pre><nowiki>*/ function fix_relatedchanges() { var uls = document.getElementsByTagName('ul'); var entries = new Object; for (var i = 0; i < uls.length; ++i) if (uls[i].className && uls[i].className.indexOf('special') >= 0) { var ul = uls[i]; var li = ul.getElementsByTagName('li'); for (var j = 0; j < li.length; ++j) { var a = li[j].getElementsByTagName('a'); if (a[0].firstChild.data == 'diff') if (entries[a[2].href] == 'y') li[j].style.display = 'none'; else { a[0].href = a[0].href.replace(/&curid=[0-9]+/, ''); entries[a[2].href] = 'y'; } } } } /*</nowiki></pre> ==function spoiler_toggle(num)== <pre><nowiki>*/ var spoiler_num = 0; function spoiler_toggle(num) { var contents = document.getElementById('spoilercontents_' + num); var lk = document.getElementById('spoilerlk_' + num); if (!contents || !lk) return; if (contents.style.display == 'none') { contents.style.display = ''; lk.replaceChild(document.createTextNode('hide'), lk.firstChild); } else { contents.style.display = 'none'; lk.replaceChild(document.createTextNode('show'), lk.firstChild); } } /*</nowiki></pre> ==function setup_spoilers()== <pre><nowiki>*/ function setup_spoilers() { var divs = document.getElementsByTagName('div'); var hide_initially = hide_spoilers_initially && !/(\?title=|\/wiki\/)(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/.test(window.location.href); for (var i = 0; i < divs.length; ++i) { var node = divs[i]; if (node.id != 'spoiler' || (node.className && node.className.indexOf('endspoiler') >= 0)) continue; ++spoiler_num; pipe(node, ' ['); add_id_link('javascript:spoiler_toggle(' + spoiler_num + ')', hide_initially ? 'show' : 'hide', 'spoilerlk_' + spoiler_num, node); pipe(node, ']'); var contents = document.createElement('div'); contents.className = 'spoilercontents'; contents.id = 'spoilercontents_' + spoiler_num; if (hide_initially) contents.style.display = 'none'; var depth = 0; while (depth >= 0) { var n = node.nextSibling; if (!n) break; if (n.id == 'spoiler') { if (n.className && n.className.indexOf('endspoiler') >= 0) { if (--depth < 0 && !hide_endspoiler_tag) break; } else ++depth; } n.parentNode.removeChild(n); contents.appendChild(n); } if (node.nextSibling) node.parentNode.insertBefore(contents, node.nextSibling); else node.parentNode.appendChild(contents); } } /*</nowiki></pre> ==function descendent_ul(node, ancestor)== <pre><nowiki>*/ function descendent_ul(node, ancestor) { return (node.parentNode.tagName == 'LI' && (node.parentNode.parentNode == ancestor || (node.parentNode.parentNode.tagName == 'UL' && descendent_ul(node.parentNode.parentNode, ancestor)))); } /*</nowiki></pre> ==function fix_double_redirects()== <pre><nowiki>*/ function fix_double_redirects() { var a, i, li, uls = document.getElementsByTagName('UL'), title = escape(document.getElementsByTagName('H1')[0].firstChild.data); for (i = 1; i < uls.length; ++i) if (descendent_ul(uls[i], uls[0])) for (li = uls[i].firstChild; li; li = li.nextSibling) if (li.tagName == 'LI' && (a = li.firstChild).tagName == 'A' && a.href.indexOf('&redirect=no') >= 0) window.open(a.href + '&action=edit&fakeaction=fix_dbl_redir&faketarget=' + title, '_blank'); } /*</nowiki></pre> ==function top_edit_lk()== <pre><nowiki>*/ function top_edit_lk() { var spans = document.getElementsByTagName('SPAN'); for (var i = 0; i < spans.length; ++i) if (spans[i].className.indexOf('editsection') >= 0) { var span = document.createElement('SPAN'); span.className = spans[i].className; span.setAttribute('style', spans[i].getAttribute('style')); //document.location.href.match(/^(http:\/\/[^/]+/w)(iki/|/index\.php\?title=)([^&?]+)/); document.location.href.match(new RegExp('^(http://[^/]+/w)(iki/|/index\\.php\\?title=)([^&?]+)', '')); var title = RegExp.$3; span.innerHTML = spans[i].innerHTML.replace(/&action=edit§ion=[0-9]+/, '&action=edit§ion=0'); title = document.getElementsByTagName('H1')[0]; title.parentNode.insertBefore(span, title.nextSibling); return; } } /*</nowiki></pre> ==function newpages_sort()== <pre><nowiki>*/ function newpages_sort() { var ol = document.getElementsByTagName('OL'); var i; for (i = 0; i < ol.length; ++i) if (ol[i].className && ol[i].className.indexOf('special') >= 0) break; if (i >= ol.length) return; ol = ol[i]; var nodes = node_getElementsByTagName(ol, 'LI'); var arr = new Array; for (i = 0; i < nodes.length; ++i) { arr[i] = new Array; arr[i][0] = nodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.data.replace(/[^0-9]/g, ''); arr[i][1] = nodes[i]; } arr.sort(function(a, b) { return a[0] - b[0]; }); while (ol.hasChildNodes()) ol.removeChild(ol.firstChild); for (i = 0; i < arr.length; ++i) ol.appendChild(arr[i][1]); } /*</nowiki></pre> ==function add_newpages_sort_button()== <pre><nowiki>*/ function add_newpages_sort_button() { var sort_button = makebutton('Sort', 'javascript:newpages_sort()'); var buttons = document.getElementsByTagName('INPUT'); for (var i = 0; i < buttons.length; ++i) if (buttons[i].name == 'username') { buttons[i + 1].parentNode.appendChild(sort_button); break; } } /*</nowiki></pre> ==function rm_top_interwiki()== <pre><nowiki>*/ function rm_top_interwiki() { var tr; try { tr = document.getElementsByTagName('table')[0].firstChild.firstChild; if (tr.nextSibling.firstChild.firstChild.data == 'In other languages: ') { tr.parentNode.removeChild(tr.nextSibling); tr.firstChild.nextSibling.className += " top"; tr.firstChild.nextSibling.nextSibling.className += " top"; } } catch (tr) {} } /*</nowiki></pre> ==function add_section_lks_to_standard_js()== <pre><nowiki>*/ function add_section_lks_to_standard_js() { var pre; if (wgPageName == 'User:Cryptic/standard.js' && document.title == 'User:Cryptic/standard.js - Wikipedia, the free encyclopedia') // don't hit history page, editing, etc. { try { if (document.getElementsByTagName('h1')[0].nextSibling.firstChild.data != 'From Wikipedia, the free encyclopedia') // don't hit diffs return; } catch (pre) { return; } sect = 0; var pre = node_getElementsByTagName(document.getElementById('article'), 'pre')[0]; var new_inner = ''; var cur_inner = pre.innerHTML; var idx = cur_inner.indexOf('\n=='); var sect = 0; for (var idx = cur_inner.indexOf('\n=='); idx >= 0; idx = cur_inner.indexOf('\n==')) { new_inner += cur_inner.substring(0, idx + 1); cur_inner = cur_inner.substring(idx + 1); idx = cur_inner.indexOf('==\n'); if (idx < 0) return; new_inner += '<a href="http://en.wikipedia.org/w/index.php?title=User:Cryptic/standard.js&action=edit§ion=' + ++sect + '">' + cur_inner.substring(0, idx + 2) + '</a>'; cur_inner = cur_inner.substring(idx + 2); } pre.innerHTML = new_inner + cur_inner; } } /*</nowiki></pre> ==function do_onload()== <pre><nowiki>*/ function do_onload() { setup_spoilers(); cesarb_fixDiffOverflowLoadListener(); rm_top_interwiki(); top_edit_lk(); add_section_lks_to_standard_js(); morelinks(); if (document.title.indexOf('Editing ') == 0) { resize_editbox(0); document.editform.wpSummary.setAttribute('style', 'width:100%'); } else if (document.title == 'My watchlist - Wikipedia, the free encyclopedia') addahah(); else if (document.title == 'Related changes - Wikipedia, the free encyclopedia') fix_relatedchanges(); else if (document.title.indexOf('Wikipedia:Articles for deletion/Log/2') != -1) afdsectionlinks('Wikipedia:Articles for deletion/Log/2'); else if (document.title.indexOf('Wikipedia:Featured picture candidates') != -1) afdsectionlinks('/w/index.php?title=Wikipedia:Featured_picture_candidates&action=edit'); else if (document.title == 'View and restore deleted pages - Wikipedia, the free encyclopedia') undelete_page_stuff(1); else if (document.title == 'Confirm delete - Wikipedia, the free encyclopedia') delete_button('', '', '', -1); else if (document.title == 'Block user - Wikipedia, the free encyclopedia' && !/action=success/.test(document.location)) document.getElementById('blockip').wpBlock.parentNode.appendChild(makebutton('Log', 'javascript:window.location.href=\'http://en.wikipedia.org/w/index.php?title=Special:Log&type=block&page=User:\' + document.getElementById(\'blockip\').wpBlockAddress.value.split(\' \').join(\'_\');')); else if (wgPageName == 'Special:Newpages') add_newpages_sort_button(); add_revert_links_history(); } addOnloadHook(do_onload); //</nowiki></pre>