Jump to content

User:L^BPub/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>
importScript('User:Persian Poet Gal/vandal.js');

importScript('User:Ioeth/friendly.js');
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></script>');
importScript('Wikipedia:WikiProject User scripts/Scripts/Force edit summary alternative'); 

importScript('User:TheJosh/Scripts/NewPagePatrol.js');
npp_enabled = false;
npp_num_pages = 10;
npp_refresh = 5;
importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');
rcp_enabled = false;
rcp_num_pages = 10;
rcp_refresh = 5;


$(function() {
if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
return;
if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
var username = encodeURIComponent( wgTitle );
mw.util.addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "Contribs", "ca-contrib", "User contributions");
mw.util.addPortletLink("p-cactions", "http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "Edit count", "ca-editcount", "Edit count from Interiot's Tool1");
mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=move&user=" + username, "Page moves", "ca-pagemoves", "Page moves by this user");
mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&page=User:" + username, "Blocks received", "ca-blog", "Blocks received by this user");
mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2", "Userspace", "", "List of pages in this user's userspace");
mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&user=" + username, "Blocks given", "", "Blocks by this user");
mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=protect&user=" + username, "Protections", "", "Protections by this user");
mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=delete&user=" + username, "Deletions", "", "Deletions by this user");
}
});
if (wgNamespaceNumber >= 0)
$(function(){
var pCactions = document.getElementById('p-cactions');
if (!pCactions) return;
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = document.getElementById('ca-talk');
var caEdit = document.getElementById('ca-edit');
if (!caEdit) caEdit = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
if (!caMain || !caTalk || !caEdit || !caHistory) return;
var el_move, el_create, id2;
if (wgNamespaceNumber % 2) { //talk space
el_move = caTalk; el_create = caMain; id2 = '';
} else {
el_move = caMain; el_create = caTalk; id2 = 'discussion';
}
caEdit.firstChild.innerHTML = 'edit';
caHistory.firstChild.innerHTML = 'hist';
el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
var href = el_create.firstChild.getAttribute('href', 2);
if (el_create.className.indexOf('new') < 0){
mw.util.addPortletLink('p-cactions', href + '?action=history', 'hist',
'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',
'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
} 
caMain.style.marginRight = '0.3em'; 
caTalk.style.marginRight = '0.3em'; 
caTalk.style.marginLeft  = '1.6em'; 
})





$(function() {
if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
return;
if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
var username = encodeURIComponent( wgTitle );
mw.util.addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "contribs", "ca-contrib", "User contributions");
mw.util.addPortletLink("p-cactions", "http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "count", "ca-editcount", "Edit count from Interiot's Tool1");
mw.util.addPortletLink("p-cactions", "http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=" + username + "&site=en.wikipedia.org", "Summary", "ca-summary", "Edit Summary");
}
});


function addSumLink() {
var ntitle2 = document.getElementById("mw-diff-ntitle2")
if (!ntitle2) return;
var rbnode = getElementsByClassName(document.getElementById("mw-diff-ntitle2"), "span", "mw-rollback-link");
if (rbnode.length != 0)
addRollbackSummaryLink(rbnode[0]);
}
 
function confirmRollback() {
var url = this.href;
var user = url.match(/[?&]from=([^&]*)/);
if (!user) return;
var user = decodeURIComponent(user[1].replace("+", " "));
var summary = prompt("Enter a summary to use for rollback.\n\nLeave blank to use the default. $user will be replaced with \"" + user + "\".", "")
if (summary == undefined)
return false;
else if (summary == "")
return true;
this.href += "&summary=" + encodeURIComponent(summary.replace(/\$user/g, user));
return true;
};
 
function addRollbackSummaryLink(rbnode) {
var rblink = rbnode.getElementsByTagName("a")[0]
var alink = rblink.cloneNode(true);
alink.className = ""; //don't confuse other scripts
alink.firstChild.nodeValue = "sum";
alink.onclick = confirmRollback;
rbnode.insertBefore(alink, rblink.nextSibling);
rbnode.insertBefore(document.createTextNode("|"), alink);
}
 
$(addSumLink);




importScript('User:MarkS/extraeditbuttons.js');
importScript('User:TheDJ/Gadget-HotCat.js');


if (wgNamespaceNumber >= 0)
$(function(){
var pCactions = document.getElementById('p-cactions');
if (!pCactions) return;
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = document.getElementById('ca-talk');
var caEdit = document.getElementById('ca-edit');
if (!caEdit) caEdit = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
if (!caMain || !caTalk || !caEdit || !caHistory) return;
var el_move, el_create, id2;
if (wgNamespaceNumber % 2) { //talk space
el_move = caTalk; el_create = caMain; id2 = '';
} else {
el_move = caMain; el_create = caTalk; id2 = 'discussion';
}
caEdit.firstChild.innerHTML = 'edit';
caHistory.firstChild.innerHTML = 'hist';
el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
var href = el_create.firstChild.getAttribute('href', 2);
if (el_create.className.indexOf('new') < 0){
mw.util.addPortletLink('p-cactions', href + '?action=history', 'hist',
'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',
'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
} 
caMain.style.marginRight = '0.3em'; 
caTalk.style.marginRight = '0.3em'; 
caTalk.style.marginLeft  = '1.6em'; 
})


$(function (){
var N = 250;      // <<== CHANGE TO YOUR LIKING
var x = document.getElementById('ca-history');
if(!x) return;
x.getElementsByTagName('a')[0].href += "&limit=" + N;
});


function fixCompare()
{
var histForm=document.getElementsByTagName("form")[0];
var finalButton=document.getElementById("historysubmit");
if(!finalButton || finalButton == null)
return;
 
var firstButton=histForm.getElementsByTagName("input")[1];
histForm.removeChild(finalButton);
histForm.removeChild(firstButton);
var compareLink=document.createElement("a");
var genLink = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + histForm.title.value + "&diff=" + histForm.diff[0].value + "&oldid=" + histForm.oldid[1].value;
compareLink.setAttribute("href", genLink);
compareLink.appendChild(document.createTextNode("Compare selected versions"));
histForm.insertBefore(compareLink, document.getElementById("pagehistory"));
var endLink=compareLink.cloneNode(true);
histForm.appendChild(endLink);
var diffList=document.getElementById("pagehistory");
diffList.setAttribute("onchange", "updateCompare()");
}
function updateCompare()
{
var histForm=document.getElementsByTagName("form")[0];
var diffList=document.getElementById("pagehistory");
var compareLink=diffList.previousSibling;
var endLink=diffList.nextSibling;
var oldInd=-1;
var i=0;
while(oldInd==-1 & i<histForm.oldid.length)
{
if(histForm.oldid[i].checked)
oldInd=i;
i++;
}
var diffInd=-1;
var j=0;
while(diffInd==-1 & j<histForm.diff.length)
{
if(histForm.diff[j].checked)
diffInd=j;
j++;
}
var genLink = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + histForm.title.value + "&diff=" + histForm.diff[diffInd].value + "&oldid=" + histForm.oldid[oldInd].value;
compareLink.setAttribute("href", genLink);
endLink.setAttribute("href", genLink);
}
if(window.location.href.indexOf("action=history")!=-1)
$(fixCompare);



function addForceSummary()
{
if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
if(/&section=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
// The second invocation of this will cause extra annoyance if there is no edit summary present. If there *is* an edit summary, the dialog box will not appear.
document.forms.editform.wpSave.onfocus = forceSummary;
}
 
function forceSummary()
{
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
{
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:','[[User Talk:Flyingidiot|(fi)]]');
if(r == null) { return false; }
document.forms.editform.wpSummary.value = r;
}
return true;
}
 
$(addForceSummary);
/*split user warnings and deletions <nowiki>*/
 
function getUserName() {
switch (wgCanonicalNamespace) {
case 'User': 
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png','delete your own user page','{{','}}','subst:user:flyingidiot/2','mw-editbutton-media');
/*]]>*/;
break
case 'User_talk': 
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/f/fc/Important-2.svg','autobio','{{subst:User:Flyingidiot/wb1|','}}','Article','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/4/44/Warn1.png','First User Warning Vandal','{{subst:uw-vandalism1|','|--~~~~}}','Article','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/e/e4/Warn2.png','Second User Warning Vandal','{{subst:uw-vandalism2|','|--~~~~}}','article','mw-editbutton-math');
addButton('http://upload.wikimedia.org/wikipedia/commons/8/84/Warn3.png','Third User Warning Vandal','{{subst:uw-vandalism3|','|--~~~~}}','Article','mw-editbutton-nowiki');
addButton('http://upload.wikimedia.org/wikipedia/commons/b/bd/Warn4.png','Final User Warning Vandal','{{subst:uw-vandalism4|','|--~~~~}}','article','mw-editbutton-nowiki');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/76/Testwarn1.png','testpage userwarn 1','{{subst:Uw-test1|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/03/Testwarn2.png','testpage userwarn 2','{{subst:uw-test2|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/72/Testwarn3.png','testpage userwarn 3','{{subst:Uw-test3|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/9/9d/Testwarn4.png','testpage userwarn 4','{{subst:uw-test4|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/4/48/Deletewarn1.png','Userwarn delete 1','{{subst:uw-delete1|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/7d/Deletewarn2.png','Userwarn delete 2','{{subst:uw-delete2|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/07/Deletewarn3.png','Userwarn delete 3','{{subst:uw-delete3|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/f/f4/Deletewarn4.png','Userwarn delete 4','{{subst:uw-delete4|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/cd/Warncreate1.png','Userwarn create nonsense 1','{{subst:Uw-create1|','| --~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/01/Warncreate2.png','Userwarn create nonsense 2','{{subst:Uw-create2|','| --~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/09/Warncreate3.png','Userwarn create nonsense 3','{{subst:Uw-create3|','|--~~~~}}','Article','mw-editbutton-link');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/00/Warncreate4.png','Userwarn create nonsense 4','{{subst:Uw-create4|','|--~~~~}}','Article','mw-editbutton-link');/*]]>*/;
addButton('http://upload.wikimedia.org/wikipedia/commons/a/a4/Spam1.png','spam userwarn 1','{{subst:Uw-spam1|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/2/27/Spam2.png','spam userwarn 2','{{subst:Uw-spam2|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/02/Spam3.png','spam userwarn 3','{{subst:Uw-spam3|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/f/fb/Spam4.png','spam userwarn 4','{{subst:Uw-spam4|','|--~~~~}}','Article','mw-editbutton-signature');
break
default:
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png','FIdeletion','{{user:Flyingidiot/del|','}}','|','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/3/3d/ButtonSpam.png','Delete spam','{{','}}','Db-spam','mw-editbutton-bold');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/ca/NonsenseDelete.png','Delete nonsense','{{','}}','Db-nonsense','mw-editbutton-italic');
addButton('http://upload.wikimedia.org/wikipedia/commons/2/28/Nonnotable.png','Delete unnotable','{{','}}','db-bio','mw-editbutton-link');
addButton('http://upload.wikimedia.org/wikipedia/commons/6/62/Button_stop.png','Delete for a special reason','{{db','}}','|','Reason','mw-editbutton-extlink');
addButton('http://upload.wikimedia.org/wikipedia/commons/e/e2/Button_contexto.png','Delete empty or no context','{{','}}','db-nocontext','mw-editbutton-headline');
addButton('http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_crocs.png','Delete attack page','{{','}}','db-attack','mw-editbutton-image');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/cc/Bouton_Vandale2.png','Delete blanked','{{','}}','db-blankcsd','mw-editbutton-image');
addButton('http://commons.wikimedia.org/wiki/Image:Wiki_test.GIF','Delete test','{{','}}','db-test','mw-editbutton-image');
addButton('http://upload.wikimedia.org/wikipedia/commons/6/62/Button_desambig.png','Disambiguate the page','{{disambig','}}','','mw-editbutton-hr');
/*]]>*/;
}
}
$(getUserName());

importScript('User:Tim_Laqua/Scripts/formatRecentChanges.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:S/tags.js');


importScript('User:Krimpet/CH2.js');


var wma_settings =
{
height : 400,
width : 700
}



function lowerNoPunct(s)
{
return s.toLowerCase().split('.').join('').split(',').join('').split(':').join('').split(';').join('').split('+').join('');
}
 
$(function() {
if(wgNamespaceNumber==0) return; //avoid article space, generally speaking
var vs=
"http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/15px-Symbol_support_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/15px-Symbol_keep_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/15px-Symbol_oppose_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/15px-Symbol_delete_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/15px-Symbol_neutral_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/15px-Symbol_merge_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/15px-Symbol_move_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/15px-Symbol_redirect_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/15px-Symbol_opinion_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_comment_vote.svg/15px-Symbol_comment_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/15px-Symbol_unsupport_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/15px-Symbol_question.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Symbol_divide_vote.svg/15px-Symbol_divide_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/15px-Symbol_wait.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-grin.svg/15px-Face-grin.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Symbol_support2_vote.svg/15px-Symbol_support2_vote.svg.png#"+
"http://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Symbol_no_support_vote.svg/15px-Symbol_no_support_vote.svg.png";
var vt=vs.split("#");
var la=new Array();
la['support']=0; la['endorse']=0;
la['keep']=1;
la['oppose']=2; la['overturn']=2; la['object']=2;
la['delete']=3;
la['neutral']=4;
la['merge']=5; la['upmerge']=5;
la['move']=6; la['rename']=6; la['userfy']=6; la['transwiki']=6;
la['redirect']=7;
la['opinion']=8; la['relist']=8; la['subst']=8; la['salt']=8; la['change']=8; la['list']=8;
// Note that icon 8 on the list is often used for debate-specific !votes
la['comment']=9; la['update']=9; la['note']=9;
la['delist']=10;
la['question']=11;
la['split']=12;
la['wait']=13;
la['bjaodn']=14;
la['undelete']=15; la['restore']=15;
la['close']=16;
 
var btc=document.body.getElementsByTagName("B");
i=btc.length;
while(i--)
{
var j,k;
j=btc[i].innerHTML.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" ");
k=0;
var x="";
while(k<j.length)
{
if(lowerNoPunct(j[k])=="don't"||lowerNoPunct(j[k])=='not'
||lowerNoPunct(j[k])=='no'||lowerNoPunct(j[k])=='without') break;
var l=la[lowerNoPunct(j[k])];
if(l!=undefined)
{
x+="<IMG SRC='"+vt[l]+"' /> "
}
k++;
}
if(x!="") btc[i].innerHTML=x+btc[i].innerHTML;
}
});

importScript('User:AWeenieMan/furme.js');

importScript('User:Cameltrader/Advisor.js');
importScript('User:Ioeth/friendly.js');
// </nowiki>