User:Misza13/monobook.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.
If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure of whether the code is safe, you can ask at the help desk.
//<pre><nowiki> // [[User:Lupin/popups.js]] importScript('User:Lupin/popups.js'); popusStructure = 'fancy2'; popupDelay = 2; popupFixDabs = true; popupAdminLinks = true; popupOnEditSelection = false; //Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { importScript('User:Interiot/Tool2/code.js'); } // Helper tools importScript('User:Voice_of_All/Addtabs/monobook.js'); // Admin tools // importScript('User:Voice_of_All/admin/monobook.js'); addOnloadHook(function (){ //moves Mvaluejs_class = 'yes'; //edits Rvaluejs_class = 'yes'; //uploads Uvaluejs_class = 'yes'; }); importScript('User:AzaToth/morebits.js'); if (document.title.indexOf('Editing User talk:') != -1) { importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importScript('User:AzaToth/twinklewarn.js'); } if (document.title.indexOf('Editing ') == -1) { importScript('User:AzaToth/twinklespeedy.js'); importScript('User:AzaToth/twinkleprotect.js'); } TwinkleConfig = { userTalkPageMode : 'tab', showSharedIPNotice : false, openTalkPage : [ 'agf', 'norm', 'vand' ], openAOLAnonTalkPage : false, addAdToSummary : false, addAdToDeletionSummary : false, watchSpeedyPages : [ 'g3', 'g5', 'g10', 'g11', 'g12' ], watchRevertedPages : [ 'agf', 'norm', 'vand' ], deleteTalkPageOnDelete : false, }; ////////OTHER STUFF function addlilinkwithedit(tabs, page, name){ page = page.replace(/ /,'_'); logLI = document.createElement('li'); logLI.appendChild(make_link('http://en.wikipedia.org/wiki/'+page,name)); logLI.appendChild(document.createTextNode(' (')); logLI.appendChild(make_link('http://en.wikipedia.org/w/index.php?action=edit&title='+page,'edit')); logLI.appendChild(document.createTextNode(')')); tabs.appendChild(logLI); } function make_link(url,text) { newA = document.createElement('a'); newA.href = url; newA.appendChild(document.createTextNode(text)); return newA; } //////////GOOGLE AND YAHOO SEARCHES addOnloadHook(function (){ var title; if (!(title = document.getElementById('t-whatlinkshere') )) return; if (!(title = title.getElementsByTagName('a')[0] )) return; if (!(title = title.href )) return; if (!(title = title.replace(/^.*Special:Whatlinkshere\//, '') )) return; if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return; if (!(title = title.replace(/("|%22)/g, '') )) return; if (!(title = title.replace(/_/g, '%20') )) return; addLink('p-tb', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&ie=utf-8&oe=utf-8', 'Google search', 't-googlesearch', 'Search Google for "'+decodeURIComponent(title)+'"', 'G', null); addLink('p-tb', 'http://search.yahoo.com/search?p=%22'+title+'%22%20-Wikipedia&ei=UTF-8', 'Yahoo! search', 't-yahoosearch', 'Search Yahoo! for "'+decodeURIComponent(title)+'"', 'Y', null); }); //////////TOOLBOX LINKS addOnloadHook(function(){ // get page title var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/; ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' '); user_logs_url1 = ""; essjay_counter = ""; tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tabs, '/wiki/Special:Log', 'All logs', 'pt-alllogs'); addlilink(tabs, '/wiki/Special:Ipblocklist', 'Block list', 'pt-ipblocklist'); // if this is a user, show the logs for the user rather than the page if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) { regDropSubpages = /[User|User_talk][:|%3A]([^&?\/]*)[\/]?.*/; user = regDropSubpages.exec(ptitle)[1]; user_logs_url1 = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user; user_logs_url2 = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=User:" + user; essjay_counter = ("http://tools.wikimedia.de/~essjay/edit_count/Count.php?username="+user+"&submit=Count").replace(" ","_"); } if (essjay_counter != "") { addlilink(tabs, essjay_counter, "Essjay counter", "pt-essjay"); } if (user_logs_url1 != "") { logLI = document.createElement('li'); logLI.id = 'pt-logs'; logLI.appendChild(make_link('http://en.wikipedia.org/wiki/User:'+user,'User')); logLI.appendChild(document.createTextNode(' (')); logLI.appendChild(make_link(user_logs_url1,'logs')); logLI.appendChild(document.createTextNode(' • ')); logLI.appendChild(make_link(user_logs_url2,'logs')); logLI.appendChild(document.createTextNode(')')); tabs.appendChild(logLI); } addlilink(tabs, '/w/index.php?title=Special:Log&page=' + ptitle, 'Page logs', 'pt-pagelogs'); addlilink(tabs, '/wiki/User:Misza13/Desk', 'Desk', ''); addlilink(tabs, '/wiki/User:Misza13/Sandbox', 'Sandbox', ''); addlilink(tabs, '/wiki/User:Misza13/Scripts', 'Scripts', ''); addlilink(tabs, '/wiki/User:MiszaBot', 'MiszaBot', ''); addlilink(tabs, '/wiki/User:MiszaBot_I', 'MiszaBot I', ''); addlilink(tabs, '/wiki/User:MiszaBot_II', 'MiszaBot II', ''); addlilink(tabs, '/wiki/User:MiszaBot_III', 'MiszaBot III', ''); addlilink(tabs, '/wiki/User:WdefconBot', 'WdefconBot', ''); addlilinkwithedit(tabs, 'Template:Wdefcon', 'WikiDefcon'); addlilinkwithedit(tabs, 'User:Misza13/monobook.js', 'Monobook.js'); addlilinkwithedit(tabs, 'User:Misza13/monobook.css', 'Monobook.css'); addlilink(tabs, 'http://pl.wikipedia.org/wiki/Wikipedysta:Misza13', 'pl:Misza13', ''); }); //////////WATCHLIST SORTER addOnloadHook(function(){ if (location.href.indexOf('Special:Watchlist') == -1) return; //Are we on a watchlist? //days = document.getElementById('bodyContent').getElementsByTagName('ul'); days = document.evaluate( //Hell knows how it works - found in "Dive into Greasemonkey" "//ul[@class='special']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (d = 0; d < days.snapshotLength; d++) { //For each day day = days.snapshotItem(d); newday = document.createElement('ul'); //This will replace the old listing while ((diffs = day.getElementsByTagName('li')).length > 0) { //Are there any diffs left? //Try to extract the namespace As = diffs[0].getElementsByTagName('a'); if (As[0].innerHTML == 'diff') pagename = As[2].innerHTML; else pagename = As[1].innerHTML; if (pagename.indexOf(':') == -1) namespace = 'Main'; else namespace = pagename.split(':')[0]; //This will fail for articles which contain ":" in name hdrs = newday.getElementsByTagName('h5'); //Get the list of namespace headers hdr = null; for (j=0; j<hdrs.length; j++) //Find the header if (hdrs[j].innerHTML==namespace) { hdr = hdrs[j]; break; } if (hdr==null) { //Not found? Make a new one! hdr = document.createElement('h5'); hdr.innerHTML = namespace; newday.appendChild(hdr); namespacesub = document.createElement('ul'); newday.appendChild(namespacesub); } hdr.nextSibling.appendChild(diffs[0]); //Move the diff } newday.appendChild(document.createElement('hr')); //For readablility day.parentNode.replaceChild(newday,day); } }); //////////STATUS CHANGER /*addOnloadHook(function(){ var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data; var subpage = "/Status"; var scheme = "/StatusTemplate"; var linkprefix = "http://en.wikipedia.org/w/index.php?title=User:"; var contribs = document.getElementById( 'pt-mycontris' ); //Add the links addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", ""); addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", ""); addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", ""); if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status? //Get new status statusRegExp = /&action=edit&newstatus=(.*)/; status = statusRegExp.exec(location.href)[1]; //Modify the form document.getElementById('wpTextbox1').value = "{{User:"+user+scheme+"|"+status+"}}"; document.getElementById('wpSummary').value = "Status: "+status; document.getElementById('wpMinoredit').checked = 'checked'; //Submit it! document.getElementById('editform').submit(); });*/ ////////////WIKIBREAK ENFORCER /*addOnloadHook(function(){ var currentdate = new Date(); // YYYY, MM, DD, HH, MM, SS var enforced_break_end = new Date(2006, 03, 15, 9, 00, 00); // *** IMPORTANT: Subtract 1 from month, i.e. january = 0 *** if (currentdate > enforced_break_end) { // alert ("Welcome back from your enforced wikibreak!"); } else { alert ("Enforced wikibreak until " + enforced_break_end.toLocaleString() + " (currently " + currentdate.toLocaleString() + "). Bye!"); window.location = "http://en.wikipedia.org/w/index.php?title=Special:Userlogout&returnto=Main_page"; } });*/ //////////FLOATING UTC CLOCK function getTime() { var time = new Date(); var date = time.getUTCDate(); var months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' '); month = months[time.getUTCMonth()]; var year = time.getUTCFullYear(); var hours = '0' + time.getUTCHours(); hours = hours.substr(hours.length-2, hours.length); var minutes = '0' + time.getUTCMinutes(); minutes = minutes.substr(minutes.length-2, minutes.length); var seconds = '0' + time.getUTCSeconds(); seconds = seconds.substr(seconds.length-2, seconds.length); var curTime = hours + ":" + minutes + ":" + seconds + ", " + date + " " + month + " " + year + " (UTC)"; datePlace = document.getElementById('pt-time').childNodes[0].childNodes[0]; datePlace.replaceData(0, datePlace.length, curTime); doTime = window.setTimeout(getTime, 1000); } addOnloadHook(function(){ var li = document.createElement( 'li' ); li.id = 'pt-time'; var mySpan = document.createElement( 'span' ); mySpan.style.position = "fixed"; mySpan.style.bottom = "5px"; mySpan.style.left = "5px"; mySpan.style.border = "1px solid deepskyblue"; mySpan.style.background = "white"; mySpan.style.color = "darkslategray"; mySpan.style.padding = "2px"; mySpan.appendChild( document.createTextNode( 'date and time' ) ); li.appendChild( mySpan ); document.getElementById( 'pt-logout' ).parentNode.appendChild( li ); getTime(); }); // ======== QuickBlocks ======= function QuickBlock (expiry,reason,ao,ab,autob) { blockForm = document.getElementById('blockip'); inputs = blockForm.getElementsByTagName('input'); for (i=0; i<inputs.length; i++) { if (inputs[i].name == 'wpBlockOther') { inputs[i].value = expiry; continue; } if (inputs[i].name == 'wpBlockReason') { inputs[i].value = reason; continue; } if (inputs[i].name == 'wpAnonOnly') { if (ao==1) { inputs[i].checked = 'checked'; } continue; } if (inputs[i].name == 'wpEnableAutoblock') { if (autob==0) { inputs[i].checked=false; } continue; } if (inputs[i].name == 'wpCreateAccount') { if (ab==0) { inputs[i].checked=false; } continue; } } blockForm.submit(); } addOnloadHook(function(){ if (document.title.indexOf("Block user") == -1) return; user = document.getElementById('mw-bi-target').value; isAOL = AOLNetworks.some( function( net ) { return isInNetwork( user, net ) } ); addTab('javascript:('+QuickBlock+')("indefinite","{{UsernameBlocked}}",0,0,0)','user...','p-block-user') addTab('javascript:('+QuickBlock+')("indefinite","{{UsernameBlocked}}",1,1,1)','brutal user...','p-block-b-user') addTab('javascript:('+QuickBlock+')("indefinite","Please see [[WP:USERNAME]] - no accounts promoting companies/websites.",0,0,0)','promo','p-block-promo') addTab('javascript:('+QuickBlock+')("indefinite","Vandalism account.",0,0,1)','vandalism','p-block-vandalism') addTab('javascript:('+QuickBlock+')("3 hours","{{schoolblock}}",1,1,0)','school (3h)','p-block-school') if (isAOL) { addTab('javascript:('+QuickBlock+')("1 hour","{{AOLblock}}",1,0,0)','vandalism (1h)','p-block-1h') } else { addTab('javascript:('+QuickBlock+')("31 hours","{{anonblock}}",1,0,1)','vandalism (31h)','p-block-31h') } addTab('javascript:('+QuickBlock+')("1 week","Repeat vandalism",1,0,1)','One week','p-block-week'); addTab('javascript:('+QuickBlock+')("1 month","Chronic vandalism",1,0,1)','One month','p-block-month'); addTab('javascript:('+QuickBlock+')("15 minutes","vandalism from AOL IP, please see [[Wikipedia:Advice to AOL users]] if you are impacted by this block",0,0,0)','15 mins AOL','p-block-15mins'); }); //////// BIG BLOCK BUTTON addOnloadHook(function () { pagetitleH1 = document.getElementById('content').getElementsByTagName('h1')[0] pagetitle = pagetitleH1.firstChild.data; blockip = document.getElementById('t-blockip'); if (blockip) { blockButton = document.createElement('a'); blockButton.href = blockip.firstChild.href; blockButton.style.color = "red"; blockButton.appendChild(document.createTextNode('BLOCK')); pagetitleH1.appendChild(document.createTextNode(' (')); pagetitleH1.appendChild(blockButton); pagetitleH1.appendChild(document.createTextNode(')')); } }); //</nowiki></pre>