User:Zzuuzz/monobook.js
From Wikipedia, the free encyclopedia
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 whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* {{fullurl:{{FULLPAGENAME}}|action=purge}} http://en.wikipedia.org/wiki/MediaWiki:Common.js http://en.wikipedia.org/wiki/MediaWiki:Sysop.js http://en.wikipedia.org/skins-1.5/common/wikibits.js http://en.wikipedia.org/skins-1.5/common/block.js http://en.wikipedia.org/skins-1.5/common/protect.js http://en.wikipedia.org/skins-1.5/common/ajax.js */ // [[User:Lupin/popups.js]] importScript( 'User:Lupin/popups.js' ); popupHideDelay = 0.2; popupAdminLinks = true; //simplePopups = true; //popupStructure = 'fancy'; //popupActionsMenu = false; popupFixRedirs = true; popupRedlinkRemoval = true; //popupFixDabs = true; //popupRevertSummaryPrompt = true; // from [[User:^demon/csd.js]] deletion reasons importScript('User:Zzuuzz/csd.js'); // [[Wikipedia:WikiProject User scripts/Scripts/Twinkle]] TwinkleConfig = { userTalkPageMode : 'tab', showSharedIPNotice : false, openTalkPageOnAutoRevert : false, summaryAd : "", deletionSummaryAd : "", protectionSummaryAd : "", watchProdPages : true, watchSpeedyPages : [ 'g3', 'g5', 'g10', 'g11', 'g12' ], openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ], deleteTalkPageOnDelete : false, watchWarnings : true, orphanBacklinksOnSpeedyDelete : {orphan:true, exclude:['g6']} }; importScript('User:AzaToth/morebits.js'); importScript('User:AzaToth/twinklewarn.js'); importScript('User:AzaToth/twinkleprod.js'); //importScript('User:AzaToth/salt.js'); //importScript('User:AzaToth/twinkledelimages.js'); //importScript('User:AzaToth/twinklespeedy.js'); // [[User:Alex_Smotrov/qpreview.js]] importScript('User:Alex_Smotrov/qpreview.js') // [[User:Alex_Smotrov/wlunwatch.js]] if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') addOnloadHook(function () { var frm = document.getElementsByTagName('form')[0]; frm.parentNode.insertBefore(document.createTextNode(' | '), frm); var lnk = document.createElement('a'); lnk.appendChild(document.createTextNode('Unwatch…')); lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")'; frm.parentNode.insertBefore(lnk, frm); }) importScript('Wikipedia:WikiProject_User_scripts/Scripts/Formatter'); //importScript('User:Zzuuzz/specialtalkpagetab.js'); importScript('User:Zzuuzz/quickeditcount.js'); importScript('User:Zzuuzz/protectionreasons.js'); function removeElements() { var argv = removeElements.arguments; var argc = argv.length; for ( i = 0; i < argc; i++ ) { var myNode = document.getElementById( argv[i] ); if ( myNode ) { myNode.parentNode.removeChild( myNode ); } } } function appendMessage( sMessage, sSummary, bReplace, bPrepend, bMinor, bWatch, bSave ) { // puts a tag in a page var ed = document.editform; if ( bReplace == true ) { ed.wpTextbox1.value = sMessage; } else if ( bPrepend == true ) { ed.wpTextbox1.value = sMessage + "\n" + ed.wpTextbox1.value; } else { ed.wpTextbox1.value = ed.wpTextbox1.value + sMessage; } ed.wpSummary.value = sSummary; ed.wpMinoredit.checked = bMinor; ed.wpWatchthis.checked = bWatch; if ( bSave == true ) { ed.submit(); // save } else { ed.wpDiff.click(); // diff } } function doSandboxReset() { // Resets the sandbox var msg = '{' + '{Please leave this line alone (sandbox '; if ( wgNamespaceNumber == 5 ) {msg = msg + 'talk ';} msg = msg + 'heading)}}' + "\n" + '<' + '!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->'; appendMessage( msg, 'Reset Sandbox', true, false, false, true, true ); } function doWelcomeMsg() { var welcomemsg = '{' + '{subst:User:Zzuuzz/welcomemsg}}'; if ( document.title.indexOf( 'Editing User talk:' ) != -1 ) { appendMessage( welcomemsg, 'Welcome!', false, false, false, true, true ); } } function doBlockMsg() { var blockmsg = '\n{' + '{subst:uw-block|sig=~~' + '~~}}'; if ( document.title.indexOf( 'Editing User talk:' ) != -1 ) { appendMessage( blockmsg, 'you have been blocked', false, false, false, true, true ); } } function doVandalblockMsg() { var blockmsg = '\n{' + '{subst:user:Zzuuzz/vandalblock}}'; if ( document.title.indexOf( 'Editing User talk:' ) != -1 ) { appendMessage( blockmsg, 'you have been blocked', false, false, false, true, true ); } } function doSchoolBlockMsg() { var blockmsg = '\n{' + '{schoolblock|sig=~~' + '~~}}'; if ( document.title.indexOf( 'Editing User talk:' ) != -1 ) { appendMessage( blockmsg, 'you have been blocked', false, false, false, true, true ); } } function doUsernameBlockMsg() { var blockmsg = '==Username block==' + "\n" + '{' + '{subst:uw-ublock|sig=~~' + '~~}}'; if ( document.title.indexOf( 'Editing User talk:' ) != -1 ) { appendMessage( blockmsg, 'username block, please see the [[Wikipedia:Username policy|username policy]]', false, false, false, true, true ); } } function doAfDClose() { var comment = prompt( 'Result of debate?', 'Delete' ); if ( comment ) { var txtbox = document.getElementById( 'wpTextbox1' ); if ( txtbox ) { var debate = txtbox.value.replace( /\{\{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD.*\}\}\n/gi, '' ); var afdclosed = '{' +'{subst:at}} \'\'\'' + comment + '.\'\'\' ~~' + '~~' + "\n" + debate + '{' + '{subst:ab}}'; appendMessage( afdclosed, 'Closing AfD: ' + comment, true, false, false, true, false ); } } } function getAfDPageName( daysold ) { // link to today's AfD page (yyyy_mmmm_d) var months = new Array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ); var date = new Date(); date.setDate ( date.getDate() - daysold ); var pagename = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate(); return 'Wikipedia:Articles_for_deletion/Log/' + pagename; } function addMyPersonalLinks() { // p-personal portal document.getElementById( 'pt-userpage' ).firstChild.innerHTML = wgUserName.toLowerCase(); //document.getElementById( 'pt-mytalk' ).firstChild.innerHTML = 'my talk'; document.getElementById( 'pt-preferences' ).firstChild.innerHTML = 'preferences'; document.getElementById( 'pt-watchlist' ).firstChild.innerHTML = 'watchlist'; document.getElementById( 'pt-mycontris' ).firstChild.innerHTML = 'my contribs'; document.getElementById( 'pt-mycontris' ).getElementsByTagName('a')[0].href = '/w/index.php?title=Special:Contributions&target=' + wgUserName + '&limit=100'; document.getElementById( 'pt-logout' ).firstChild.innerHTML = 'logout'; addPortletLink( 'p-personal', wgScript + '?title=Special:Log&user=' + wgUserName + '&limit=100', 'my logs', 'pt-mylogs', 'My user logs', '', document.getElementById( 'pt-logout' ) ); } function addMyNavLinks() { // p-navigation portal addPortletLink( 'p-navigation', '/wiki/Wikipedia:Administrator intervention against vandalism#Alerts', 'AIV vandalism', 'n-linkaiv', 'Administrator intervention against vandalism' ); addPortletLink( 'p-navigation', '/wiki/Wikipedia:Usernames for administrator attention#Bot-reported', 'Usernames', 'n-linkuaa', 'Usernames for administrator attention' ); addPortletLink( 'p-navigation', '/wiki/Wikipedia:Requests for page protection#Current_requests_for_protection', 'RFPP', 'n-linkrfpp', 'Protection requests' ); addPortletLink( 'p-navigation', '/wiki/Category:Candidates for speedy deletion#Pages_in_category', 'Speedy', 'n-linkcsd', 'Candidates for speedy deletion' ); addPortletLink( 'p-navigation', '/wiki/' + getAfDPageName(0), 'Today\'s AfD', 'n-linktodaysafd', 'Today\'s AfD discussions' ); addPortletLink( 'p-navigation', '/wiki/' + getAfDPageName(5), 'Old AfD', 'n-linkoldafd', '5-day old AfD discussions' ); } function addMyActions() { // c-actions portal // replace standard actions // history link if ( document.getElementById( 'ca-history' ) ) { document.getElementById( 'ca-history' ).getElementsByTagName('a')[0].href += '&limit=100'; } if ( document.getElementById( 'ca-addsection' ) ) { document.getElementById( 'ca-addsection' ).firstChild.innerHTML = '+'; } if ( document.getElementById( 'ca-talk' ) ) { document.getElementById( 'ca-talk' ).firstChild.innerHTML = 'discussion'; } if ( document.getElementById( 'ca-edit' ) ) { document.getElementById( 'ca-edit' ).firstChild.innerHTML = 'edit'; } /* // prominent delete link if ( document.getElementById( 'ca-delete' ) ) { document.getElementById( 'ca-delete' ).firstChild.style.color = '#CC0000'; document.getElementById( 'ca-delete' ).firstChild.style.fontWeight = 'bold'; } */ // Special pages if (wgNamespaceNumber === -1) { // Special page talk pages addPortletLink( 'p-cactions', wgScript + '?title=Wikipedia talk:' + wgPageName, 'special talk', 'ca-specialtalk', 'Discussion about this special page (' + wgPageName + ').', 't', document.getElementById('ca-nstab-special').nextSibling ); addPortletLink( 'p-cactions', wgScript + '?title=Wikipedia talk:' + wgPageName + '&action=edit§ion=new', '+', 'ca-addsection', 'Start a new section on the discussion page for ' + wgPageName + '.', '+', document.getElementById('ca-specialtalk').nextSibling ); // watchlist tabs if ( wgPageName == 'Special:Watchlist' ) { addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&limit=100', 'logs', 'ca-viewlog', 'Wikipedia logs', '', '' ); addPortletLink( 'p-cactions', '/w/index.php?title=Special:Newpages&namespace=0&limit=100', 'new pages', 'ca-newpages', 'New pages', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&type=newusers&limit=150', 'new users', 'ca-newusers', 'New users', '', '' ); addPortletLink( 'p-cactions', '/wiki/Wikipedia:News', 'Wikinews', 'ca-news', 'Wikipedia news', '', '' ); addPortletLink( 'p-cactions', '/wiki/m:Special:Watchlist', 'Meta', 'ca-meta', 'Wikimedia Meta-Wiki', '', '' ); addPortletLink( 'p-cactions', '/wiki/commons:Special:Watchlist', 'Commons', 'ca-commons', 'Wikimedia Commons', '', '' ); } // deletion confirmation if ( document.getElementById( 'deleteconfirm' ) ) { //addMyDeleteConfirmActions(); } // block confirmation if ( document.getElementById( 'blockip' ) && document.getElementById( 'mw-bi-target' ) ) { var blockee = document.getElementById( 'mw-bi-target' ).value; if ( ( blockee.toLowerCase() == wgUserName.toLowerCase() ) || ( blockee.toLowerCase() == 'jimbo wales' ) ) { alert( 'You are about to block the wrong person!' ); } blockee = escape(blockee); addPortletLink( 'p-cactions', '/wiki/User:' + blockee, 'userpage', 'ca-userpage', blockee + '\'s user page', '', '' ); addPortletLink( 'p-cactions', '/wiki/User_talk:' + blockee, 'talk', 'ca-usertalk', blockee + '\'s talk page', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Special:Contributions&target=' + blockee + '&limit=100', 'contribs', 'ca-usercontribs', blockee + '\'s contributions', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&page=User:' + blockee + '&limit=100', 'block log', 'ca-userblocklog', blockee + '\'s block log', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&user=' + blockee + '&limit=100', 'logs', 'ca-userlogs', blockee + '\'s logs', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Special:Whatlinkshere/User_talk:' + blockee + '&limit=100', 'backlinks', 'ca-usertalkbacklinks', blockee + '\'s talk page backlinks', '', '' ); } // unblock confirmation if ( document.getElementById( 'unblockip' ) ) { // } // move confirmation if ( document.getElementById('movepage') ) { var mvpage = escape(document.getElementById('wpNewTitle').value); addPortletLink( 'p-cactions', wgScript + '?title=' + mvpage, 'page', 'ca-pagetab', 'View this page', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Talk:' + mvpage, 'talk', 'ca-talktab', 'View talk page of this page', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=' + mvpage + '&action=history', 'history', 'ca-historytab', 'View history of this page', '', '' ); addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&page=' + mvpage, 'logs', 'ca-logstab', 'View logs for this page', '', '' ); } } // editing AfD nomination if ( ( wgNamespaceNumber == 4 ) && ( document.title.indexOf( 'Editing Wikipedia:Articles for deletion/' ) != -1 ) ) { addPortletLink( 'p-cactions', 'javascript:doAfDClose()', 'close AfD', 'ca-closeAfD', 'Close this AfD', '', '' ); removeElements( 'ca-delete', 'ca-move', 'ca-protect', 'ca-unprotect' ) ; } // editing RFPP section if ( ( wgNamespaceNumber == 4 ) && ( document.title.indexOf( 'Editing Wikipedia:Requests for page protection (section)' ) != -1 ) ) { addPortletLink( 'p-cactions', 'javascript:doRFPPClose()', 'close RFPP', 'ca-closeRFPP', 'Close this RFPP request', '', '' ); removeElements( 'ca-delete', 'ca-move', 'ca-protect', 'ca-unprotect' ) ; } // Sandbox if ( ( document.title.indexOf( 'Editing Wikipedia:Sandbox' ) != -1 ) || ( document.title.indexOf( 'Editing Wikipedia talk:Sandbox' ) != -1 ) ) { addPortletLink( 'p-cactions', 'javascript:doSandboxReset()', 'Reset Sandbox', 'ca-sandboxreset', 'Reset Sandbox', '', '' ); removeElements( 'ca-delete', 'ca-move', 'ca-protect', 'ca-unprotect' ) ; } // editing user talk space if ( ( wgNamespaceNumber == 3 ) && ( document.title.indexOf( 'Editing User talk:' ) != -1 ) ) { removeElements( 'ca-delete', 'ca-addsection', 'ca-move', 'ca-watch', 'ca-unwatch', 'ca-protect', 'ca-unprotect' ) ; addPortletLink( 'p-cactions', 'javascript:doWelcomeMsg()', 'welcome', 'ca-welcomemsg', 'Add a welcome message', '', '' ); addPortletLink( 'p-cactions', 'javascript:doBlockMsg()', 'uw-block', 'ca-blockmsg', 'Add a block notice', '', '' ); addPortletLink( 'p-cactions', 'javascript:doVandalblockMsg()', 'vndblock', 'ca-vandalblockmsg', 'Add a vandalblock notice', '', '' ); addPortletLink( 'p-cactions', 'javascript:doUsernameBlockMsg()', 'unb', 'ca-usernameblockmsg', 'Add a username block notice', '', '' ); addPortletLink( 'p-cactions', 'javascript:doSchoolBlockMsg()', 'schblock', 'ca-schoolblockmsg', 'Add a school block notice', '', '' ); } // user and user talk - show tab for user logs if ( ( wgNamespaceNumber == 2 ) || ( wgNamespaceNumber == 3 ) ) { var uname = wgTitle.split('/')[0]; var isip = uname.split('.')[3]; addPortletLink( 'p-tb', wgScript + '?title=Special:DeletedContributions/' + uname, 'Deleted contribs', 'ca-deletedcontributions', 'View the list of deleted contributions of this user', '', document.getElementById( 't-log' ) ); if( isip ) { addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&type=block&page=User:' + uname, 'block log', 'ca-blocklogs', 'View block logs for this IP address', '', '' ); } else { addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&user=' + uname, 'user logs', 'ca-userlogs', 'View logs for this user', '', '' ); } } // page logs tab if ( wgNamespaceNumber >= 0 ) { addPortletLink( 'p-cactions', wgScript + '?title=Special:Log&page=' + wgPageName, 'logs', 'ca-logstab', 'View logs for this page', '', '' ); } } function addMySearchbox() { // adds google search and wikipedia article-prefix search document.getElementById('searchBody').innerHTML += '<form method="get" action="http://www.google.co.uk/search"><div>' + '<input type="text" name="q" />' + '<input type="radio" name="as_sitesearch" />Web' + '<input type="radio" name="as_sitesearch" value="en.wikipedia.org" checked="checked" />WP' + '<input type="radio" name="as_sitesearch" value="bbc.co.uk" />BBC' + '<input type="submit" class="searchButton" value="Google Search" />' + '</div></form>' + '<form method="get" action="' + wgScript + '"><div>' + '<input type="text" name="from" />' + '<input type="radio" name="namespace" value="0" checked="checked" />Article' + '<input type="radio" name="namespace" value="2" />User' + '<input name="title" type="hidden" value="Special:Prefixindex" />' + '<input type="submit" class="searchButton" value="Search Prefix" />' + '</div></form>'; } addOnloadHook( function() { addMyPersonalLinks(); addMyNavLinks(); addMyActions(); addMySearchbox(); } );

