User:Kim Dent-Brown/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.
importScript('User:AzaToth/twinkle.js'); TwinkleConfig = { revertMaxRevisions : 50, userTalkPageMode : 'window', showSharedIPNotice : true, openTalkPage : [ 'agf', 'norm', 'vand' ], openTalkPageOnAutoRevert : false, openAOLAnonTalkPage : false, summaryAd : " using [[WP:TWINKLE|TW]]", deletionSummaryAd : " using [[WP:TWINKLE|TW]]", protectionSummaryAd : " using [[WP:TWINKLE|TW]]", watchSpeedyPages : [ 'g3', 'g5', 'g10', 'g11', 'g12' ], watchProdPages : true, openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ], watchRevertedPages : [ 'agf', 'norm', 'vand', 'torev' ], markRevertedPagesAsMinor : [ 'agf', 'norm', 'vand', 'torev' ], deleteTalkPageOnDelete : false, markWarningsAsMinor : true, markAIVReportAsMinor : true, markSpeedyPagesAsMinor : true, markProdPagesAsMinor : true, confirmUsernameToAIV : true, toolboxButtons : [ ] }; // [[User:Lupin/popups.js]]importScript('User:Lupin/popups.js'); /* <pre> <nowiki> Note: After saving, you have to bypass your browser's cache to see the changes. To do this in Firefox/Mozilla/Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R). If you use Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5. </nowiki> </pre> ==AzaToth's reversion tools == <pre> <nowiki> */ // install [[Wikipedia:WikiProject User scripts/Scripts/Twinkle]] importScript('User:AzaToth/morebits.js'); importScript('User:AzaToth/twinklefluff.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css'); importScript('User:AzaToth/twinklewarn.js'); importScript('User:AzaToth/twinklearv.js'); importScript('User:AzaToth/twinklespeedy.js'); importScript('User:AzaToth/twinklediff.js'); /* </nowiki> </pre> ==WikEd, replaces Firefox's text edit window == <pre> <nowiki> */ // 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&dontcountme=s"></script>'); /* </nowiki> </pre> ==Lupin's anti-vandal tools == <pre> <nowiki> */ // Script from [[User:Lupin/recent2.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>'); /* </nowiki> </pre> ==Popups== <pre> <nowiki> */ /* [[User:Lupin/popups.js]] */ document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /*{{User:AndyZ/peerreviewer.js}}*/ /* </nowiki> </pre> == Watchlist sorter == <pre> <nowiki> Sorts your watchlist by namespace, and also adds spaces for readability. */ 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); } }); importScript('[[User:Ioeth/friendly.js]]'); /* How to use: * * Add the following to [[Special:Mypage/monobook.js]] as a * logged-in user using the monobook skin: * importScript('User:Gracenotes/rollback.js'); * * On diff pages, a "sum" link will appear next to "rollback". * When you click on "sum", you will be prompted to enter a * summary. Press "Cancel" to cancel, and leave a blank summary * to use the default. In the summary, the text "$user" will * automatically be replaced with the user name you're reverting. * e.g., "rv edits by $user; not true" */ 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); } addOnloadHook(addSumLink); //this helps automate AfD closing by adding a 'close' tab to AfD debates //written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]] function autoafd_result() { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0'); t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value; if (t.value.length > 0) t.value += '\n'; t.value += "{{subst:" + "ab" + "}}"; f.wpSummary.value = "Closing debate; result was " + close; } function autoafd_relist() { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}"; f.wpSummary.value = "Relisting debate"; } function autoafd_keep() { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD"; } function autoafd_no_consensus() { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD with no consensus"; } function autoafd_redirect() { var date = prompt("Nomination was made when?") var redirect = prompt("Redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD"; } function autoafd_merge() { var date = prompt("Nomination was made when?") var redirect = prompt("Merge and redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD"; } function autoafd_other() { var date = prompt("Nomination was made when?") var result = prompt("Result was?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1; // If default votepage... if (votepage=="d") { var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; } t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value; f.wpSummary.value = "AfDed; result was " + result; } function autoafd_add_afd_tabs() { // Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1) { addPortletLink('p-cactions', 'javascript:autoafd_result()', "close"); addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist"); } if (document.title.indexOf("Editing Talk:") != -1) { addPortletLink('p-cactions', 'javascript:autoafd_keep()', "keep"); addPortletLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus"); addPortletLink('p-cactions', 'javascript:autoafd_redirect()', "redirect"); addPortletLink('p-cactions', 'javascript:autoafd_merge()', "merge"); addPortletLink('p-cactions', 'javascript:autoafd_other()', "other"); } } addOnloadHook(autoafd_add_afd_tabs); //end AfD closing script //