User:Cowboy Rocco/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:Lupin/recent2.js"); /* <pre><nowiki> */ // [[User:Zocky/SearchBox.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); function addForceSummary() { if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return; if(/§ion=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:',document.forms.editform.wpSummary.value); if(r == null) { return false; } document.forms.editform.wpSummary.value = r; } return true; } addOnloadHook(addForceSummary); /* </nowiki></pre> */ // addPurge addOnloadHook(function () { var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'), 'purge', 'ca-purge', 'Purge server cache for this page', '0'); }); // document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/ubergodmode.js"><\/SCRIPT>'); document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/godmode-light.js"><\/SCRIPT>'); importScript('User:Olliminatore/godmode-light.js'); importScript('User:DerHexer/rollback.js'); // [[User:Zocky/SearchBox.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // [[User:Lupin/popups.js]] importScript('User:Lupin/popups.js'); 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, watchWarnings : true, markAIVReportAsMinor : false, markSpeedyPagesAsMinor : false, offerReasonOnNormalRevert : true, orphanBacklinksOnSpeedyDelete : {orphan:true, exclude:['g6']} }; importScript("User:Lupin/recent2.js"); /* <pre><nowiki> */ function addForceSummary() { if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return; if(/§ion=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:',document.forms.editform.wpSummary.value); if(r == null) { return false; } document.forms.editform.wpSummary.value = r; } return true; } addOnloadHook(addForceSummary); /* </nowiki></pre> */ importScript('User:Yamakiri on Firefox/monobook.js'); importScript("User:Lupin/recent2.js"); /* <pre><nowiki> */ // [[User:Zocky/SearchBox.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); function addForceSummary() { if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return; if(/§ion=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:',document.forms.editform.wpSummary.value); if(r == null) { return false; } document.forms.editform.wpSummary.value = r; } return true; } addOnloadHook(addForceSummary); /* </nowiki></pre> */ // addPurge addOnloadHook(function () { var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'), 'purge', 'ca-purge', 'Purge server cache for this page', '0'); }); // document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/ubergodmode.js"><\/SCRIPT>'); document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/godmode-light.js"><\/SCRIPT>'); importScript('User:Olliminatore/godmode-light.js'); importScript('User:DerHexer/rollback.js'); addPortletLink ('p-tb', location.href+'/monobook.js', 'monobook'); addOnloadHook(autoNewSectionName); addOnloadHook(addReplyLinks); // // Settings // var hrefUserAnonim = wgServer + '/wiki/Special:Contributions/'; var hrefUserSpaced = wgServer + '/wiki/User:'; var hrefUserSpacedNew = wgServer + '/w/index.php\\?title=User:'; var hrefUserTalkSpaced = wgServer + '/wiki/User_talk:'; var textReplyShort = 'Re:'; var textNoHeadShort = 'Ad:'; var textReplyLinkName = 'reply'; /* ===================================================== *\ Function: autoNewSectionName Inserting new section and backword link from the location string param. Params ------ newsectionname - passed through the location string of the page \* ===================================================== */ function autoNewSectionName() { // // Get input element for section name (now understood as the textbox) // var elInput = document.getElementById('wpTextbox1'); if (elInput) { // // Get data send from previous page // var reParam = new RegExp ("&newsectionname=([^&]*)", "i"); // ignoring lettercase var matches = reParam.exec(location.search); var sectxt; // append to input if all OK if (matches) { sectxt = decodeURIComponent(matches[1]); elInput.value += ';'+sectxt+'\n\n'; } // // Add some summary elInput = document.getElementById('wpSummary'); if (elInput) { matches = /[ ](.*)\]/.exec(sectxt); // append to input if all OK if (matches) elInput.value += decodeURIComponent(matches[1]) ; } } } /* ===================================================== *\ Function: addReplyLinks Adding reply links near user links. Problemy: * nie działa dla IE (błędy kodowania UTF-8) Params ------ none \* ===================================================== */ function addReplyLinks() { // // When to run this... // // if (!document.getElementById('t-permalink') && !document.getElementById('t-ispermalink') ) // almost always if (wgCurRevisionId==0) // no versioning available return ; var i; // // Get viewed page version link (may be something in history) // // this one means it is a perma link (comparing versions, showing one specfic version and such) if (document.getElementById('t-ispermalink')) { var hrefPermalink = document.location.href; } // get latest else { var hrefPermalink = '{{fullurl:' + wgPageName + '|oldid=' + wgCurRevisionId + '}}'; } // // Get some places to put this into and puting this // var reHref = new RegExp (hrefUserSpaced + "([^/]*)$", "i"); // with ignore case var reHrefNew = new RegExp (hrefUserSpacedNew + "([^/?&]*)", "i"); // with ignore case var reHrefAnonim = new RegExp (hrefUserAnonim + "([\.0-9]*)$"); // // getting first header name for default tags var secAbove = new Object; secAbove.id = 'bodyContent'; secAbove.text = parseSectionText(document.getElementById('content').getElementsByTagName('H1')[0].innerHTML); var secReplyText = textNoHeadShort; // // get every link with href="http://pl.wikipedia.org/wiki/Wikipedysta:..." (no slashes in dots) var a = document.getElementById('bodyContent').getElementsByTagName('A'); for (i = 0; i < a.length; i++) { // if (secAbove) // { // // checking if this is a user link if (a[i].href != '' && a[i].getAttribute('href').indexOf('#')==-1) { if (a[i].className=='new') { var matches = reHrefNew.exec(a[i].href); } else { var matches = reHref.exec(a[i].href); } if (!matches) { matches = reHrefAnonim.exec(a[i].href); } if (matches) { // // creating reply href // var userName = matches[1]; var hrefReply = hrefUserTalkSpaced + matches[1] + '?action=edit§ion=new'; // // and now to create and add data for the new reply section name var newSectionName = '['+hrefPermalink+'#'+secAbove.id+' '+secReplyText+secAbove.text+']'; hrefReply += '&newsectionname=' + encodeURIComponent(newSectionName); var newEl = document.createElement('small'); var newA = document.createElement('A'); newA.setAttribute('href', hrefReply); newA.setAttribute('title', textReplyShort+secAbove.text); newA.appendChild(document.createTextNode('['+textReplyLinkName+']')) newEl.appendChild(newA); insertAfterGivenElement(a[i],newEl); i++; // a is a dynamic list } } // } // // obtaining anchor and text of the section above user links if (a[i].name != '' && wgCanonicalNamespace!="Image") // skip obtaining headers in image pages { // going to header element text var header; if (a[i].parentNode.nextSibling.nodeType == document.TEXT_NODE) // FF header = a[i].parentNode.nextSibling.nextSibling else // IE header = a[i].parentNode.nextSibling ; // check if this is the right element - if not skip if (header) if (header.nodeType == document.ELEMENT_NODE) { secAbove.id = a[i].name; // sometimes there could be a link in the header (maybe some more) secAbove.text = parseSectionText(header.innerHTML); // should be set only once (as it is always the same), but let's leave it that way secReplyText = textReplyShort; } } } } /* ===================================================== *\ Function: insertAfterGivenElement Inserting "newEl" element after given "el" element. Params ------ el - element object to insert after newEl - (new) element object to insert \* ===================================================== */ function insertAfterGivenElement(el, newEl) { if (el.nextSibling) { el.parentNode.insertBefore(newEl, el.nextSibling); } else { el.parentNode.appendChild(newEl); } } /* ===================================================== *\ Function: [obsolete] stripHtmlTags Stripping HTML tags from the HTML text. Returns stripped text. Params ------ html - the html text \* ===================================================== */ function stripHtmlTags(html){ return html.replace(/<\S[^<>]*>/g, ''); // with global match (all will be replaced) } /* ===================================================== *\ Function: parseSectionText Stripping HTML tags from the HTML text and cleansing of some wikicode Returns stripped text. Params ------ html - the html text \* ===================================================== */ function parseSectionText(html){ // with global match (all will be replaced) html = html.replace(/<\S[^<>]*>/g, ''); // replace cut anything in brackets [] (editing sections links and such) html = html.replace(/\[[^\]]*\]/,''); // replace wiki stuff with null html = html.replace(/[\{\}]/g,''); // trim (right,left) html = html.replace(/[ \t]*$/,'').replace(/^[ \t]*/,''); return html } // </pre> //From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510 function addSinceTab() { if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited() } else if (wgCanonicalNamespace != "Special") { addPortletLink("p-cactions", "/w/index.php?title="+wgPageName+"&action=history&gotosince=true", 'since', '', "since"); } } function do_since_I_last_edited() { var csub=document.getElementById("contentSub"); var msg=document.createElement("p"); msg.appendChild(document.createTextNode ("Parsing history... please wait...")); msg.className="error"; csub.insertBefore(msg, csub.firstChild) var username=document.getElementById("pt-userpage").textContent; var hists=document.getElementById("pagehistory").getElementsByTagName('li'); for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username) { document.location=hists[n].childNodes[1].href; return; } } msg.replaceChild(document.createTextNode ("You have not edited this page! (recently)"), msg.firstChild); } addOnloadHook(addSinceTab); // importScript('User:Voice_of_All/Addtabs/monobook.js'); importScript('User:Misza13/statusChanger.js'); // // ADD UNWATCH LINKS: addOnloadHook(function () { if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return; if (!document.forms[0] || !document.forms[0].namespace) return; //var query_prefix = "title="+encodeURIComponent(wgPageName)+"&action=submit&remove=1&id[]="; var query_prefix = "action=unwatch&title="; // get list of all links in content: var links = document.getElementById('content').getElementsByTagName('a'); // make a static copy of the nodelist and lose the original for speed // while we're at it, prune the uninteresting links from the list var linksCopy = new Array (); for (var i = 0; i < links.length; i++) { if (/[?&]action=history([&#]|$)/.test(links[i].href)) linksCopy.push(links[i]); } links = linksCopy; for (var i = 0; i < links.length; i++) { // create unwatch link and append it after history link var unwatch = document.createElement('a'); unwatch.href = wgServer + wgScriptPath + "/index.php?" + query_prefix + encodeURIComponent(links[i].title); unwatch.title = "Unwatch "+links[i].title; unwatch.appendChild(document.createTextNode("unwatch")); links[i].parentNode.insertBefore(unwatch, links[i].nextSibling); // insert a delimiter between the two links var delim = links[i].previousSibling; delimText = (delim.nodeType == 3 ? delim.nodeValue : ""); // kluge to handle case where "diff" is unlinked delim = document.createTextNode(delimText.replace(/^.*diff/, "")); links[i].parentNode.insertBefore(delim, unwatch); } }); // addOnloadHook(function () { var x; if (!(x = document.getElementById('ca-edit') )) return; var url; if (!(url = x.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; var y = addPortletLink('p-cactions', url+"§ion=0", '0', 'ca-edit-0', 'Edit the lead section of this page', '0', x.nextSibling); y.className = x.className; // steal classes from the the edit tab... x.className = 'istalk'; // ...and make the edit tab have no right margin // exception: don't steal the "selected" class unless actually editing section 0: if (/(^| )selected( |$)/.test(y.className)) { if (!document.editform || !document.editform.wpSection || document.editform.wpSection.value != "0") { y.className = y.className.replace(/(^| )selected( |$)/g, "$1"); x.className += ' selected'; } } }); XEBOrder='A,B,C,D,F,D1,U,S,G,Q,W,K,H,R,FS,P1,R1,R2,R3,R4,Y1,'; rmEditButtons=[1,2,3]; myButtons=[]; // Script from [[User:MarkS/extraeditbuttons.js]] importScript('User:MarkS/extraeditbuttons.js'); //[[User:MarkS/extraeditbuttons.js]] addOnloadHook(function(){ document.getElementById("ca-edit").firstChild.innerHTML = "Edit";}); importScript('User:Dycedarg/easyprod.js'); importScript('User:Wikidudeman/tags.js'); var FlexiTagConfig = {}; FlexiTagConfig.autosubmit = false; FlexiTagConfig.minoredit = true; FlexiTagConfig.tabs = new Array(); FlexiTagConfig.tabs.push( { name:'Tags', namespace:['Main'], tagset:[['external-links|%date','See [[WP:EL]]'], ['ActiveDiscuss','ActiveDiscuss'], ['Advert','Advert'], ['cleanup','Adding Cleanup Tag'], ['Contradict','Section or article is contradictory'], ['Copyedit','Copyedit'], ['Disputeabout|%prompt(Point of dispute.)'], ['Merge|%prompt(Merge with)'], ['Mergeto|%prompt(Merged into)'], ['Notenglish|%prompt(language is?)'], ['Underconstruction','Underconstruction'], ['Original research','Original research'], ['POV','POV tag added'], ['POV-section','POV section tag added'], ['trivia','Adding Trivia Section'], ['Uncat','Uncat'], ['Unreferenced','Section is not referenced'], ['Wikify','Wikify needed']] } ); /* <pre> */ function welcome() { // Find the edit box var txt = document.editform.wpTextbox1; //The welcome template you are wanting to use var welcome_msg = 'welcomeh' // The code to be added to the page var tag = '{{'+'subst'+':'+ welcome_msg +'}}'; // If the edit box doesn't already have this tag... if (txt.value.indexOf(tag) == -1) { // Append the tag txt.value += tag; // Add an edit summary document.editform.wpSummary.value = 'Welcome to Wikipedia!'; // Press the Save page button document.editform.submit(); } // If the tag was already there, turn the tab background red to indicate // that the script is functioning properly, but that there is no action // to do. This doesn't interrupt the user's work like an alert() would. else { document.getElementById('ca-unverified').firstChild.style.backgroundColor = "#ff4444"; document.getElementById('ca-unverified').style.backgroundColor = "#ff4444"; } } // Create a tab that calls this function when pressed addOnloadHook(function () { if(document.title.indexOf("Editing User talk:") == 0) { addPortletLink('p-cactions', 'javascript:welcome()', 'w', 'ca-welcome', 'Adds a welcome note to a new user', '', ''); } }); /* This is to keep track of who is using this extension: [[User:Nmajdan/welcome_newuser.js]] */ /* </pre> */ // addOnloadHook(function() { addPortletLink('p-tb','/wiki/Special:Log/block','Recent blocks','t-log','Special:Log'); }); addOnloadHook(function() { addPortletLink('p-tb','/wiki/Special:Log/newusers','Creation log','t-log','Special:Log'); }); addOnloadHook(function() { addPortletLink('p-tb','/wiki/Special:Log','All logs','t-log','Special:Log'); }); addOnloadHook(function() { //add to tb: {{fullurl:Wikipedia:Articles for deletion/Log/{{CURRENTYEAR}}_{{CURRENTMONTHNAME}}_{{CURRENTDAY}}|action=edit}} var now = new Date(); var url = ''; var mn = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; url += wgServer + wgScript + '?title=Wikipedia:Articles_for_deletion/Log/'; url += now.getFullYear() + '_' + mn[now.getMonth()] + '_' + now.getDate() + '&action=edit'; addPortletLink('p-tb', url, 'AFD/today', 'ca-afd', 'AFD for today'); }); // addPortletLink( 'p-tb', wgServer + wgArticlePath.replace( '$1', 'Wikipedia:Articles for deletion/Log/' + (new Date()).getUTCFullYear() + ' ' + (new Date()).getUTCMonthName() + ' ' + (new Date()).getUTCDate() ), 'del logs','t-log','Wikipedia' ); // CommonsHelper Helper (CH²) by Krimpet // Released into the public domain function ch2I18N() { ch2_wplanguage = "en"; ch2_chlanguage = "en"; ch2_edittitle_Prefix = "Editing Image:"; ch2_edittitle_Postfix = ""; ch2_string_SpecifyNewName = "New Name? (leave blank to keep original):"; ch2_string_UseWikiSense = "Use WikiSense to suggest categories?"; ch2_string_StartCommonsHelper = "Start CommonsHelper"; ch2_string_FinishedUploading = "Click when finished uploading"; ch2_string_Done = "Done! Review everything below to ensure it is correct, and save this page."; ch2_string_MoveToCommons = "MC"; ch2_string_EditSummary = "[[Wikipedia:Moving images to the Commons|Moved image to the Wikimedia Commons]] using [[User:Krimpet/CommonsHelper Helper|CH²]]"; ch2_template_ncd = "subst:ncd"; ch2_templates_copy = new Array( "Copy to Wikimedia Commons", "Move to Wikimedia Commons", "Move to Commons", "Move to commons", "To Commons", "to Commons" ); ch2_templates_embed = new Array( "PD-USGov-HHS-CDC", "PD-USGov-USDA-ARS" ); } document.write('<script type="text/javascript" src="' + 'http://commons.wikimedia.org/w/index.php?title=User:Krimpet/CH2.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // importScript('User:Cameltrader/All-in-one.js'); //[[User:Cameltrader/All-in-one.js]] importScript('User:Wikidudeman/morebits.js'); importScript('User:Azatoth/twinkle.js'); TwinkleConfig = { revertMaxRevisions : 50, userTalkPageMode : 'window', showSharedIPNotice : true, openTalkPage : [ 'agf', 'norm', 'vand' ], openTalkPageOnAutoRevert : false, summaryAd : " using [[WP:TWINKLE|TW]]", deletionSummaryAd : " using [[WP:TWINKLE|TW]]", protectionSummaryAd : " using [[WP:TWINKLE|TW]]", watchSpeedyPages : [], watchProdPages : true, openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ], watchRevertedPages : [], markRevertedPagesAsMinor : [], deleteTalkPageOnDelete : false, watchWarnings : false, markAIVReportAsMinor : false, markSpeedyPagesAsMinor : false, offerReasonOnNormalRevert : true, orphanBacklinksOnSpeedyDelete : {orphan:true, exclude:['g6']} }; // [[User:Ais523/votesymbols.js]] // Code for adding icons to !votes in AfDs, RfAs, etc.. Doesn't affect the page, just // shows the icons when this code is installed. // Please see [[:Image:Votesymbols.js-enhanced_SfD.png]] for copyright info on the images that are added. function lowerNoPunct(s) { return s.toLowerCase().split('.').join('').split(',').join('').split(':').join('').split(';').join('').split('+').join(''); } addOnloadHook(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/9/9e/Symbol_comment_vote_2.svg/15px-Symbol_comment_vote_2.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"; 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; // 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; 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; } }); //[[Category:Wikipedia scripts]] /**** afd helper ****/ document.write('<script type="text/javascript"' + 'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' + 'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */ //<pre><nowiki> function aivlist(type) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; var ip = prompt("Enter IP address", ""); var reason = prompt("Enter reason for listing", ""); t.value += "*{{" + type + "|" + ip +"}} " + reason + "--~" + "~" + "~" ; f.wpSummary.value = "Listing " + ip; f.submit(); } addOnloadHook( function addaivlink() { if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") != -1) { addPortletLink("p-cactions", "javascript:aivlist('vandal')", "vandal", "ca-vandal", "Report a vandal", ""); addPortletLink("p-cactions", "javascript:aivlist('ipvandal')", "ipvandal", "ca-ipvandal", "Report an ipvandal", ""); } } ); //</nowiki></pre> Script version 2.2.1 Versions 1.0-2.0 in history of [[User:Sceptre/monobook.js]]... I think */ function warn() { var txt = document.editform.wpTextbox1; var prefix = prompt("What is the prefix? Change if appropriate", "uw-") var type = prompt("Which standard warning do you wish to issue?", "test"); var severity = prompt("How severe is the violation?", "1"); var page = prompt("What page?"); var msgtext = "{{subst:"+prefix + type + severity + "|" + page + "|subst=subst:}} "--~" + "~" + "~" ; if(page.length == 0) {page = "Wikipedia"} else { page = "[["+page+"]]" }; var summary = "Your recent edits to " + page ; document.editform.wpSummary.value = summary; document.editform.wpMinoredit.checked = true; if(txt.value.length > 0) txt.value += '\n'; txt.value += msgtext; document.editform.submit(); } /* importScript('User:Cameltrader/All-in-one.js'); //[[User:Cameltrader/All-in-one.js]] importScript('User:Cameltrader/ContactList.js'); //[[User:Cameltrader/ContactList.js]] importScript('User:Lupin/popupsdev.js'); popupQueriedRevertSummary='Reverted intermediate edits to last revision ($1) by [[Special:Contributions/$3|$3]] ([[User talk:$3|Talk]])'; popupRevertSummaryPrompt=false; popupRedlinkRemoval=true; popupFixDabs=true; popupFixDabsSummary='fixing disambiguation %s to %s'; popupRedlinkSummary='removing red-link %s'; // [[User:Jsimlo/shortcuts.js]] importScript('User:Jsimlo/shortcuts.js'); function shortcutsInit () { shortcutsAddLink ('Prefix index', 'Special:Prefixindex'); } //[[user:Where/usertabs]] addOnloadHook(function() { if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history return; } if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) { username_a = document.URL.match(/:.*:(.*)/); username=username_a[1]; addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", ""); addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", ""); addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", ""); addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", ""); } }); addOnloadHook(function() { if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history return; } if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) { username_a = document.URL.match(/:.*:(.*)/); username=username_a[1]; addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", ""); addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", ""); addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", ""); addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", ""); } }); if (wgAction == 'history') //add a link to call histComb.js addOnloadHook(function(){ var pagehis = document.getElementById('pagehistory'); if (!pagehis) return; var lnk = document.createElement('a'); lnk.style.marginLeft = '10px'; lnk.href = '#'; lnk.appendChild(document.createTextNode('Improve…')); lnk.onclick=function(){this.parentNode.removeChild(this);importScript('User:Alex_Smotrov/histcomb.js')} pagehis.parentNode.insertBefore(lnk, pagehis); }) winc('[[User:Quarl/rollback.js]]'); //Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); } importScript('User:Voice_of_All/replacetxt.js'); //wierd stuff importScript('User:Voice_of_All/Specialadmin/monobook.js'); //crat stuff importScript('User:Voice_of_All/Bureaucrat/monobook.js'); importScript('User:Voice_of_All/History/monobook.js'); //Protection stuff importScript('User:Steel359/protection.js'); //rollback importScript('User:Voice_of_All/Revert.js'); //New pages tools importScript('User:Voice_of_All/Sleeper/monobook.js'); importScript('User:Voice_of_All/Adminwarnings/monobook.js'); importScript('User:Voice_of_All/Deletion/monobook.js'); importScript('User:Voice_of_All/Google/monobook.js'); importScript('User:Voice of All/Addtabs/monobook.js'); function addtoolboxlinks() { var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/Special:Log/newusers', 'New users', ''); addlilink(tb, '/wiki/WP:PP', 'Protected pages', ''); } addOnloadHook(addtoolboxlinks); importScript('User:Ais523/votesymbols.js'); importScript('User:TheJosh/Scripts/NewPagePatrol.js'); /**** afd helper ****/ document.write('<script type="text/javascript"' + 'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' + 'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */ addOnloadHook(function () { // if this is a user, show the logs for the user rather than the page if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) { url = wgServer + "/w/index.php?title=Special:Log&user=" + wgTitle.split("/")[0]; } else if ( wgCanonicalNamespace == "Special" ) { // don't display link for special pages return; } else { url = wgServer + "/w/index.php?title=Special:Log&page=" + wgPageName; } addPortletLink("p-tb", url, "Logs", "pt-logs"); }); importScript('User:Ais523/contribcalendar.js'); importScript('User:Ioeth/friendly.js'); /* == Utility funcs == */ //function getValueOf(varName) {defaultize(varName); // return eval(varName);}; function getGetParamValue (param) { window.location.href.match('[\?&]' + param + '[^&]*)'); return RegExp.$1; } /* == Selection funcs == */ function sel_mode_DPL (linkHTML) { return !(linkHTML.toLowerCase().indexOf( '</a> (redirect page' ) == -1 && ( linkHTML.indexOf( 'href="/wiki/Talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Category_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Template_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Help_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Image:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Image_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Portal:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Portal_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Wikipedia:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Wikipedia_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/User:' ) != -1 || linkHTML.indexOf( 'href="/wiki/User_talk:' ) != -1 || linkHTML.indexOf( 'href="/wiki/MediaWiki:' ) != -1 || linkHTML.indexOf( 'href="/wiki/MediaWiki_talk:' ) != -1 ) ) } function sel_mode_Template (linkHTML) { return linkHTML.indexOf( 'href="/wiki/Template:' ) != -1 } function sel_mode_Portal (linkHTML) { return linkHTML.indexOf( 'href="/wiki/Portal:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Template:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Category:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Image:' ) != -1 } function sel_mode_User (linkHTML) { return linkHTML.indexOf( 'href="/wiki/User:' ) != -1 || linkHTML.indexOf( 'href="/wiki/User_talk:' ) != -1 } function sel_mode_Wiki (linkHTML) { return linkHTML.indexOf( 'href="/wiki/Wikipedia:' ) != -1 || linkHTML.indexOf( 'href="/wiki/Wikipedia_talk:' ) != -1 } function sel_mode_Redir (linkHTML) { return linkHTML.toLowerCase().indexOf( '</a> (redirect page' ) != -1 } function sel_mode_All (linkHTML) { return true } /* ==Da Main func== */ function select_pages(select_this, mode_name){ body = document.getElementById('bodyContent'); if( !body ){ return; } banner = document.getElementById('dpl_banner') if (banner && banner.innerHTML.indexOf(mode_name) != -1) { open(document.URL, "_self"); //refresh the page return; } lists = body.getElementsByTagName( "ul" ); for( j=0; j<lists.length; j++ ){ lists[j].style.listStyleType = 'decimal'; } links = body.getElementsByTagName( "li" ); dpl_in = 0; dpl_ex = 0; for( i=0; i<links.length; i++ ){ if( select_this(links[i].innerHTML) ) { links[i].style.display = ''; // clear prior style dpl_in++; } else { links[i].style.display = 'none'; // hide dpl_ex++; } } window.wlhCt = window.wlhCt || 0; window.wlhCt ++; banner_text = "Select Mode: " + mode_name + " (" + dpl_in.toFixed() + " shown/" + dpl_ex.toFixed() + " hidden)"; if (banner) { banner.innerHTML = banner_text; banner = document.getElementById('dpl_footer'); banner.innerHTML = banner_text; }else{ banner = document.createElement("div"); banner.id = "dpl_banner"; banner.style.backgroundColor = "yellow"; banner.style.fontSize = 'larger'; banner.innerHTML = banner_text; body.insertBefore(banner,body.childNodes[0]); body = document.getElementById('footer'); if( !body ){ return; } banner = document.createElement("div"); banner.id = "dpl_footer"; banner.style.backgroundColor = "yellow"; banner.style.fontSize = 'larger'; banner.innerHTML = banner_text; body.insertBefore(banner,body.childNodes[0]); } }/* end function select_pages ==Da tabbar fiddler== */ addOnloadHook(function (){ if (wgPageName != 'Special:Whatlinkshere') { return; } // only add toolbox link on 'whatlinkshere' pages target = document.getElementById('p-cactions').getElementsByTagName( "ul" ); if( target.length == 0 ){ return; } //no action bar to hook into wlhCmd = getGetParamValue ('wlhCmd'); if( wlhCmd == 'r' ) select_pages(sel_mode_Redir,"Redirect (auto)"); target = target[0]; newTool = document.createElement("li"); target.appendChild( newTool ); function ptool(btn,func,desc){ return '<a href="" onclick="select_pages(sel_mode_' + func + ',\'' + desc + '\');return false;" title="' + desc + '">' + btn + '</a>' } newTool.innerHTML = 'Filter mode:' + ptool ('All', 'All', 'Show all') + ptool ('DPL', 'DPL', 'Main Space and Template') + ptool ('T', 'Template', 'Template Only') + ptool ('PTCI','Portal', 'Portal, Template, Category, Image') + ptool ('R', 'Redir', 'Redirect') + ptool ('W', 'Wiki', 'Wikipedia') + ptool ('U', 'User', 'User and User Talk') ; document.getElementById('bodyContent').innerHTML .match(/href="([^"]*)&limit=500/); url500 = RegExp.$1; addPortletLink('p-cactions',url500 + '&limit=5000' ,'5000',null,'Show up to 5000 links'); addPortletLink('p-cactions',url500 + '&limit=5000&wlhCmd=r' ,'All Redirects',null,'Show ALL Redirects (up to 5000 links)'); }); var body; // shortcut for body node var xmlhttp; // XMLHTTPRequest object var startNode; // div that includes section header and edit link var editSec; // edit link var editForm; // spliced edit form var preview; // spliced preview or diff content var oldContent; // original content of section var xmlhttpDone = false; // kludge to prevent multiple calls to callback importScript("User:Supadawg/util.js"); function inc(path) { var lt = String.fromCharCode(60); var gt = String.fromCharCode(62); document.writeln(lt+'script type="text/javascript" src="/w/index.php?title='+path+'&action=raw&ctype=text/javascript&dontcountme=s"'+gt+lt+'/script'+gt); } function initSecEdit() { body = document.getElementsByTagName("body")[0]; // apply to all divs of class "editsection" var editSecs = document.getElementsByTagName("span"); var secCount = 1; var pagetitleRe=/\/(wiki\/|w\/index\.php\?title=)([^&?]*)/; // from [Wikipedia:WikiProject User scripts/Techniques] for ( var i = 0; i < editSecs.length; i++ ) { if ( editSecs[i].getAttribute("class") == "editsection" ) { for ( var k = 0; k < editSecs[i].childNodes.length; k++ ) { if ( editSecs[i].childNodes[k].nodeName == "A" ) { // grab editing uri, escape it, then put it back in var editURI = "http://en.wikipedia.org/w/index.php?title="+encodeURIComponent2(pagetitleRe.exec(decodeURI(editSecs[i].childNodes[k].getAttribute("href")))[2]).replace(/\"/gi, "%22").replace(/\'/gi, "%27")+"&action=edit§ion="+secCount; // give it a unique id editSecs[i].childNodes[k].setAttribute( "id", "editSection"+secCount ); // swap the href with a function call, passing the original href as the second parameter editSecs[i].childNodes[k].setAttribute( "href", "javascript:editSection( document.getElementById('editSection" + secCount + "'), '"+editURI+"' );" ); secCount++; } } } } } // called on click of section edit link function editSection( elem, editURI ) { cancelEdit(); // get rid of any other sections being edited editSec = elem; startNode = elem.parentNode.parentNode; // initiate xmlhttprequest for section edit page xmlhttpDone = false; xmlhttp = null // kludge xmlhttp = createXMLHTTP( "GET", editURI, stateChange ); } // put raw input returned from XMLHTTPRequest into a div so we can grab specific elements function makeDiv( rawHTML ) { var div = createNode( body, "div", {style: "visibility: hidden; position: absolute;"} ); div.innerHTML = rawHTML.replace(/<script[^>]*><\/script>/gi, ""); // if script tags are placed into the DOM, they force reload of files, and nasty things happen return div; } function isHTag( node ) { return node.nodeName.charAt(0) == 'H' && !isNaN( parseInt( node.nodeName.charAt(1) ) ); } // callback for onclick of an edit link function stateChange() { if ( xmlhttp && xmlhttp.readyState == 4 ) { if ( xmlhttp.status == 200 ) { if ( xmlhttpDone ) return; xmlhttpDone = true; // store old content of section - loop until we hit header of same spot in hierarchy if ( !oldContent ) { oldContent = makeDiv(""); var curElem = startNode.nextSibling; while ( curElem ) { var hitSiblingSection = false; if ( isHTag( curElem ) ) { for ( var i = 0; i < curElem.childNodes.length; i++ ) { if ( curElem.childNodes[i].nodeName == "SPAN" && curElem.childNodes[i].getAttribute("class") == "editsection" && parseInt( curElem.nodeName.charAt(1) ) <= parseInt( startNode.nodeName.charAt(1) ) ) hitSiblingSection = true; } } else if ( curElem.nodeName == "DIV" && curElem.getAttribute("class") == "printfooter" ) break; if ( hitSiblingSection ) break; var nextElem = curElem.nextSibling; oldContent.appendChild( curElem ); curElem = nextElem; } } else removeNode( oldContent ); var div = makeDiv( xmlhttp.responseText ); editForm = $("editform"); // change onclick of preview and diff buttons to our function $("wpPreview").setAttribute( "type", "button" ); $("wpPreview").setAttribute( "onclick", "javascript:getEditData( previewChanged, $('wpPreview') );" ); $("wpDiff").setAttribute( "type", "button" ); $("wpDiff").setAttribute( "onclick", "javascript:getEditData( diffChanged, $('wpDiff') );" ); insertAfter( editForm, startNode ); removeNode( div ); editSec.setAttribute( "oldHref", editSec.getAttribute("href") ); editSec.setAttribute( "href", "javascript:cancelEdit();" ); editSec.innerHTML = "cancel"; } else alert("Problem retrieving data - status: "+xmlhttp.status); } } // firefox hack, not sure if this is a problem in other browsers function encodeURIComponent2( content ) { // from [http://en.wikipedia.org/wiki/User:Topaz/wputil.js] content = content.replace(/\<\;/gi, "<"); content = content.replace(/\>\;/gi, ">"); content = content.replace(/\"\;/gi, "\""); content = content.replace(/\&\;/gi, "&"); return encodeURIComponent( content ); } // encode differently based on type of form element function field2Post( node, allowButton ) { var reqBody = ""; switch ( node.nodeName ) { case "TEXTAREA": reqBody += "&"+node.getAttribute("name")+"="+encodeURIComponent2( node.value ); break; case "INPUT": var inputType = node.getAttribute("type"); if ( inputType == "checkbox" ) { if ( node.checked ) reqBody += "&"+node.getAttribute("name")+"=on" } else if ( allowButton || (inputType != "submit" && inputType != "button") ) reqBody += "&"+node.getAttribute("name")+"="+encodeURIComponent2( node.value ); break; case "DIV": reqBody += form2Post( node, false ); break; } return reqBody; } // manually encodes a form element for XMLHTTPRequest function form2Post( node ) { var reqBody = ""; for ( var i = 0; i < node.childNodes.length; i++ ) reqBody += field2Post( node.childNodes[i], false ); return reqBody; } // get preview or diff data function getEditData( callback, clickedBut ) { xmlhttpDone = false; xmlhttp = null; // kludge var action = editForm.getAttribute("action"); xmlhttp = createXMLHTTP( "POST", "http://en.wikipedia.org"+action, callback, { body: form2Post( editForm ) + field2Post( clickedBut, true ), headers: { "Content-Type": "application/x-www-form-urlencoded", "Referer": "http://en.wikipedia.org" + action.substring( 0, action.indexOf('&') ) + "&action=edit§ion="+(parseInt(editSec.getAttribute("id").substring(11))+1) } } ); } // callback for preview data function previewChanged() { if ( xmlhttp && xmlhttp.readyState == 4 ) { if ( xmlhttp.status == 200 ) { if ( xmlhttpDone ) return; xmlhttpDone = true; var div = makeDiv( xmlhttp.responseText ); if ( preview ) removeNode( preview ); preview = $("wikiPreview"); insertAfter( preview, startNode ); removeNode( div ); } else alert("Problem retrieving data - status: "+xmlhttp.status); } } // callback for diff data function diffChanged() { if ( xmlhttp && xmlhttp.readyState == 4 ) { if ( xmlhttp.status == 200 ) { if ( xmlhttpDone ) return; xmlhttpDone = true; var div = makeDiv( xmlhttp.responseText ); if ( preview ) removeNode( preview ); preview = $("wikiDiff"); insertAfter( preview, startNode ); removeNode( div ); } else alert("Problem retrieving data - status: "+xmlhttp.status); } } // remove form and preview or diff data function cancelEdit() { if ( preview ) removeNode( preview ); preview = null; if ( editForm ) removeNode( editForm ); editForm = null; if ( oldContent ) { oldContent.setAttribute( "style", "position: static; visibility: visible;" ); insertAfter( oldContent, startNode ); } oldContent = null; if ( editSec ) { editSec.setAttribute( "href", editSec.getAttribute("oldHref") ); editSec.innerHTML = "edit"; } } addEventListener( "load", initSecEdit, false );