/* <nowiki> */
function inc (file) {
mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s');
}
/**** INCLUDES ****/
inc("User:Lightdarkness/config.js");
inc("User:Lightdarkness/aivtest.js");
inc("User:Topaz/init.js");
inc("User:Topaz/util.js");
inc("User:Topaz/comm.js");
inc("User:Topaz/wputil.js");
inc("User:Lightdarkness/warn.js");
inc("User:Lightdarkness/prod.js");
var counter;
/**** Add tab as menu ****/
function addlimenu(tabs, name, id)
{
var na = document.createElement('a');
na.href = '#';
var mn = document.createElement('ul');
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabs.appendChild(li);
return li;
}
/**** Add generic tab ****/
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function addlilinkA(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
var txt = document.createTextNode(name);
na.appendChild(txt);
var li = document.createElement('li');
li.appendChild(na);
return li;
}
/**** Add generic tab TWO ****/
function addlilinkLD(url, name, id){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function speedy(type)
{
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
var curtext = t.value;
t.value = "{{db-" + type + "}}";
t.value += '\n';
t.value += '\n';
t.value += curtext;
f.wpSummary.value = "db-" + type;
}
function minor(){
document.editform.wpMinoredit.checked = true;
}
function closeAFD()
{
var f = document.editform, t = f.wpTextbox1;
var curtext = t.value;
t.value = "{{subst:at}}";
t.value += '\n';
t.value += curtext;
t.value += '{{subst:ab}}';
f.wpSummary.value = "Closing AFD";
}
function UWLS(){
var f = document.editform, t = f.wpTextbox1;
var curtext = t.value;
t.value = "== Warnings ==";
t.value += '\n';
t.value += "{{subst:s/wnote}}";
t.value += '\n';
t.value += '\n';
t.value += curtext;
f.wpSummary.value = "[[WP:UWLS|maintenance]] (formatting/organisation/[[Wikipedia:Template substitution|subst]]/add [[Template:s/wnote|wnote]]/rm oldest warnings)";
}
function hideafd()
{
var divs = document.getElementsByTagName("div");
for(var x = 7; x < divs.length; ++x)
if(divs[x].className.indexOf("vfd") != -1)
divs[x].style.display = "none";
// needed to shrink the page - rendering bug
}
function afdvote(){
var vote = prompt("Vote");
if(!vote)
return;
var reason = prompt("Reason");
if(!reason)
return;
var form = document.editform;
form.wpSummary.value += ' Vote: ' + vote;
var txt = form.wpTextbox1;
txt.value += "*'''" + vote + "''' - " + reason + " --~~~~";
txt.focus();
minor();
document.getElementById('contentSub').innerHTML += "<div class=\"usermessage\">Submitting form.</div>";
form.submit();
}
function template(templatename)
{
var f = document.editform, t = f.wpTextbox1;
t.value += "#{{subst:" + templatename + "}} --~" + "~" + "~" + "~";
f.wpSummary.value = templatename;
f.wpMinoredit.checked = true;
}
function template2(templatename)
{
var f = document.editform, t = f.wpTextbox1;
t.value += "{{subst:" + templatename + "}} --~" + "~" + "~" + "~";
f.wpSummary.value = templatename;
f.wpMinoredit.checked = true;
}
function seteditsummary(summary){
var f = document.editform;
f.wpSummary.value = summary;
f.wpMinoredit.checked = true;
}
/**** Add purge tab ****/
function addPurge()
{
ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-history');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(!x) return;
if(x.children) x = x.children[0];
else x = x.childNodes[0];
addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}
function addTools()
{
var myDate=new Date();
var months = new Array(13);
months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";
var monthname = months[myDate.getMonth()];
var myLink = '' + myDate.getFullYear() + '_' + monthname + '_' + myDate.getUTCDate();
var toolbox = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(toolbox, 'http://en.wikipedia.org/wiki/Special:Newpages', 'New Pages', 'ca-new');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/CAT:CSD', 'CSD', 'ca-csd');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/User:Cyde/List_of_candidates_for_speedy_deletion', 'CSD - List View', 'ca-csdlist');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AIV', 'AIV', 'ca-aiv');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:RFA', 'RFA', 'ca-rfa');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AFD', 'AFD', 'ca-afd');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Log/' + myLink + '', 'AFD (Today)', 'ca-afdtoday');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AN', 'AN', 'ca-an');
addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AN/I', 'AN/I', 'ca-an');
}
function addMyLinks()
{
// Adding links for user talk pages
if (document.title.indexOf("Editing User talk:") != -1)
{
addlilinkLD('javascript:template2("Welcome");', 'Welcome', 'ca-welcome');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, 'Warn', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
addlilink(talkm, 'javascript:template("bv");', 'bv', 'ca-tbv');
addlilink(talkm, 'javascript:template("test1");', 'test1', 'ca-t1');
addlilink(talkm, 'javascript:template("test2");', 'test2', 'ca-t2');
addlilink(talkm, 'javascript:template("test3");', 'test3', 'ca-t3');
addlilink(talkm, 'javascript:template("test4");', 'test4', 'ca-t4');
addlilink(talkm, 'javascript:template("test5");', 'test5', 'ca-t5');
addlilink(talkm, 'javascript:template("blank2");', 'blank2', 'ca-b2');
addlilink(talkm, 'javascript:template("blank3");', 'blank3', 'ca-b3');
addlilink(talkm, 'javascript:template("blank4");', 'blank4', 'ca-b4');
addlilinkLD('javascript:template("drmafd");', 'AFD Remove', 'ca-afd');
}
//Adding link to AFD pages
if (document.title.indexOf("Wikipedia:Articles for deletion") != -1)
{
//only show this link if we're not editing
if (document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1)
{
addlilinkLD('javascript:hideafd();', 'Hide Closed AFDs', 'ca-afd');
}
}
//links while editing AFD pages
if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1)
{
addlilinkLD('javascript:closeAFD();', 'Close AFD', 'ca-afd');
addlilinkLD('javascript:afdvote();', 'Vote in AFD', 'ca-vote');
}
//links to add while doing general editing
if (document.title.indexOf("Editing") != -1)
{
//add these if we're NOT editing user talk
if (document.title.indexOf("Editing User talk:") == -1)
{
addlilinkLD('javascript:seteditsummary("disambiguation link repair ([[Wikipedia:Disambiguation pages with links|You can help!]])");', 'Disambig', 'ca-disambig');
addlilinkLD('javascript:seteditsummary("Stub-sorting. [[Wikipedia:WikiProject Stub sorting|You can help!]]");', 'Stub', 'ca-stubsorting');
addlilinkLD('javascript:seteditsummary("missing period(s) ([[Wikipedia:WikiProject Punctuation|You can help!]])");', 'Period', 'ca-period');
}
}
}
// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget=username" is present.
function do_blockip_stuff()
{
// focus on Reason field
document.getElementsByName('wpBlockReason')[0].focus();
// Look for a &faketarget= for the username/ip
var l = location.search.substring(1).split('&');
var target = '';
for (var i = 0; i < l.length; ++i)
{
var n = l[i].indexOf('=');
if (l[i].substring(0, n) == 'faketarget')
{
target = l[i].substring(n + 1);
break;
}
}
if (target == '')
return;
// put account name in "IP Address/username" field
var addr = document.getElementsByName('wpBlockAddress')[0];
addr.value = unescape(target);
// add "blocklog" tab
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
tabs.appendChild(addlilinkA('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target, 'blocklog'));
}
function add_block_tab()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// use the "edit this page" tab to get already-tidied url
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
// cut everything up to "title=" from the start and everything past "&action=edit" from the end
editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
editlk = editlk.substring(editlk.indexOf(':') + 1);
var slloc = editlk.indexOf('/');
if (slloc > 0)
editlk = editlk.substring(0, slloc);
// add "block" tab
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, 'Block User', 'blockm');
var blockm = document.getElementById('blockm').getElementsByTagName('ul')[0];
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=15%20minutes&wpBlockReason=Vandalism', '15 minutes', 'ca-t15m');
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=24%20hours&wpBlockReason=Vandalism', '24 Hours', 'ca-t24');
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=31%20hours&wpBlockReason=Vandalism', '31 Hours', 'ca-t31');
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=48%20hours&wpBlockReason=Vandalism', '48 Hours', 'ca-t48');
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=1%20week&wpBlockReason=Vandalism', '1 Week', 'ca-t1w');
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=indefinite&wpBlockReason={{Blocked proxy}} or Zombie', 'Proxy/Zombie', 'ca-tpz');
addlilink(blockm, '/w/index.php?title=Special%3ABlockip&faketarget=' + editlk + '&wpBlockOther=indefinite&wpBlockReason=User...', 'User...', 'ca-tpuser');
// To open the block page and block log simultaneously, replace the above line with:
// tabs.appendChild(addlilink('javascript:blockpage_and_log("' + editlk + '")', 'Block'));
// and uncomment the blockpage_and_log() function above.
// add "blocklog" tab
tabs.appendChild(addlilinkA('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'blocklog'));
}
// -----------------------------------------------------------------------------
// Modify the page once it is loaded
// -----------------------------------------------------------------------------
if (window.addEventListener) {
window.addEventListener("load", load, false);
} else if (window.attachEvent) {
window.attachEvent("onload", load);
}
function addFavLinks(){
topaz.wputil.addsidepanel("tz-favlinks", "Favorite Pages");
topaz.wputil.addsidepanelbutton("tz-favlinks", "Heroes", 'http://en.wikipedia.org/wiki/Heroes_(TV Series)');
}
function newbar(){
//we only wanna show the newbar if we're editing images
if (document.title.indexOf("Editing Image:") != -1)
{
topaz.wputil.addsidepanel("tz-catsort", "Category Sorting");
topaz.wputil.addsidepanelbutton("tz-catsort", "{{logo}} -> {{tv-logo}}",
'javascript:seteditsummary("Category sorting, [[Category:Overpopulated categories|You can help!]] ({{logo}} to {{tv-logo}})")'
);
topaz.wputil.addsidepanelbutton("tz-catsort", "{{logo}} -> {{sports-logo}}",
'javascript:seteditsummary("Category sorting, [[Category:Overpopulated categories|You can help!]] ({{logo}} to {{sports-logo}})")'
);
topaz.wputil.addsidepanelbutton("tz-catsort", "{{logo}} -> {{radiologo}}",
'javascript:seteditsummary("Category sorting, [[Category:Overpopulated categories|You can help!]] ({{logo}} to {{radiologo}})")'
);
}
}
function AddWarningButtons(){
if ((document.title.indexOf("User talk:") != -1)){
if((document.title.indexOf("Editing") == -1)) {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, 'Warn User', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
addlilink(talkm, 'javascript:WarnUser("bv");', 'bv', 'ca-tbv');
addlilink(talkm, 'javascript:WarnUser("test1");', 'test1', 'ca-t1');
addlilink(talkm, 'javascript:WarnUser("test2");', 'test2', 'ca-t2');
addlilink(talkm, 'javascript:WarnUser("test3");', 'test3', 'ca-t3');
addlilink(talkm, 'javascript:WarnUser("test4");', 'test4', 'ca-t4');
addlilink(talkm, 'javascript:WarnUser("test5");', 'test5', 'ca-t5');
addlilink(talkm, 'javascript:WarnUser("blank2");', 'blank2', 'ca-b2');
addlilink(talkm, 'javascript:WarnUser("blank3");', 'blank3', 'ca-b3');
addlilink(talkm, 'javascript:WarnUser("blank4");', 'blank4', 'ca-b4');
addlilink(talkm, 'javascript:WarnUser("school block");', 'School Block', 'ca-sb');
}
}
}
function PROD(){
if(document.getElementById('afd')){
//an AFD element exsists
//add a PROD tag
//get article name
var articlename = document.getElementsByTagName('h1')[0].innerHTML;
addlilinkLD('/w/index.php?title=' + articlename + '&action=delete&wpReason=[[WP:PROD]] - Uncontested for 5 days - (Reason: ' + document.getElementsByTagName('b')[1].innerHTML + ')&fakeaction=PROD', 'PROD', 'PROD');
}
if (location.href.indexOf('&fakeaction=PROD') != -1){
document.getElementsByTagName('h1')[0].innerHTML = "PROD";
PRODArticle();
var myDate=new Date();
var date = myDate.getUTCDate();
date = date - 5;
var hours = myDate.getUTCHours();
var minutes = myDate.getUTCMinutes();
document.getElementById('contentSub').innerHTML += "<br />" + hours + ":" + minutes + " " + date + "";
}
}
function csd(){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, 'CSD', 'csd');
var csd = document.getElementById('csd').getElementsByTagName('ul')[0];
for(var num=0;num<monobookConfig.csdTemplates.length;num++){
var thing = monobookConfig.csdTemplates[num];
addlilink(csd, "javascript:handleCSD('"+thing+"');", thing, 'ca-'+thing+'');
}
}
function handleCSD(type){
var futurePage = "http://en.wikipedia.org/w/index.php?title="+wgPageName+"&action=delete";
futurePage += "&criteria="+type;
window.location = futurePage;
}
function handleCSD2(){
var criteria = location.href.split('=')[3];
document.getElementsByName('wpReason')[0].value = "Deleting page under CSD criteria "+criteria;
counter = 4;
countdown();
}
function countdown(){
if(counter > 0){
counter = counter - 1;
document.getElementsByTagName('h1')[0].innerHTML = "Confirm delete - Will delete in "+counter+" seconds";
setTimeout('countdown()',1000);
}
if(counter == 0){
document.getElementsByTagName('h1')[0].innerHTML = "Confirm delete - Deleting page...";
deleteconfirm = document.getElementById('deleteconfirm');
deleteconfirm.submit();
}
}
function load(){
document.getElementById('f-list').innerHTML += "<li>Using lightdarkness's monobook</li>";
PROD();
csd();
addFavLinks();
if (document.title.indexOf('User:') == 0
|| document.title.indexOf('User talk:') == 0)
add_block_tab();
else if (document.title.indexOf('Block user') == 0) // could stand to be more robust
do_blockip_stuff();
addPurge();
addMyLinks();
addTools();
newbar();
AddWarningButtons();
//add link to delete log
myArray = document.title.split(/ - /);
var page = myArray[0];
myregexp = new RegExp(" ");
pageName = page.replace(myregexp, "_");
var toolbox = document.getElementById('p-tb').getElementsByTagName('ul')[0];
var username = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;
if(username != "Lightdarkness") {
document.getElementById('contentSub').innerHTML += "<div class=\"usermessage\">Hello, I appreciate your interest in using my Monobook, but please ask me before doing so, as there are many expirimental items in here. For information on how to remove this notice, message me on my talk page. Thanks. -Lightdarkness</div>";
}
addlilink(toolbox, '/w/index.php?title=Special%3ALog&type=delete&page=' + pageName + '', 'Deletion log', 'ca-dl');
if (document.title.indexOf("Wikipedia:Articles for deletion") != -1)
{
var divs = document.getElementsByTagName("div");
for(var x = 7; x < divs.length; ++x)
if(divs[x].className.indexOf("editsection") != -1) {
var url = divs[x].getElementsByTagName('a')[0].href;
divs[x].innerHTML += '[<a href="' + url + '&fakeaction=vote">vote</a>]';
}
}
if (location.href.indexOf("&fakeaction=vote") != -1){
afdvote();
}
if (location.href.indexOf("&criteria=") != -1){
handleCSD2();
}
}
inc("User:Voice of All/Approvals.js");
/* </nowiki> */