User:S4n1HS22WMX695In/monobook.js

// User contributions link on user pages //

$(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");  } });

//

// Add edit counter for my user page // // User:Henrik/js/live-edit-counter - Please include this line function liveEditCounter(username) {    var xhr; try { xhr = new XMLHttpRequest; } catch(e) {         xhr = new ActiveXObject(Microsoft.XMLHTTP); }    if (!document.getElementById('edit-count1') || !document.getElementById('edit-count2')) return;

xhr.onreadystatechange = function {         if(xhr.readyState  == 4) {             if(xhr.status  == 200) { var doc = xhr.responseXML; var element = doc.getElementsByTagName('count').item(0); document.getElementById('edit-count1').innerHTML=element.firstChild.data; document.getElementById('edit-count2').innerHTML=element.firstChild.data; }         }    };

xhr.open('GET', "http://en.wikipedia.org/w/query.php?format=xml&what=contribcounter&titles=User:"+username, true); xhr.send(null); }

$(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 );     liveEditCounter(username);  } }); //

// Provide tabs for user info //

// Please leave the following line // user:Where/usertabs $(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://toolserver.org/~soxred93/count/index.php?name="+ username +"&lang=en&wiki=wikipedia", "Edit count", "ca-editcount", "Edit count from X!'s Tool");     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"); } });

//

// Tab to show changes from last edit // Originally based on http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510 //See WikiProject User scripts/Scripts/Show last diff // addLastDiff function addLastDiff {   mw.util.addPortletLink('p-cactions', 'http://en.wikipedia.org/w/index.php?title=' + wgPageName + "&diff=cur&oldid=prev", 'last', 'ca-last', 'Show most recent diff'); } $(addLastDiff);

//

/* Description and credits:

This script adds a "since" tab to your view. Clicking on this will call up a DIFF showing all edits since you last edited the page. The number of revisions to check back can be set, and if ignored, will default to the number of revisions in your history view.

From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510 with updates for IE compatibility and functionality.

Usage:

To use the default number of revisions: importScript('Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited');

or to set your own default number of revisions to check: defaultdiffs = 1000;   // or whatever number, see script for details importScript('Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited');

Copy to → your monobook.js

The script:

function addSinceTab {

// Default number of revisions to check. Set to 0 to use your usual default for a history page. // Sensible options might be 300, 500 or 750. Values up to 5000 are valid, but will be quite slow.

if (!window.defaultdiffs) defaultdiffs=0;

if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited }   else if (wgCanonicalNamespace != "Special") { mw.util.addPortletLink("p-cactions", "/w/index.php?title="+wgPageName+"&action=history&gotosince=true" + ((defaultdiffs <= 0) ? "" : "&limit=" + defaultdiffs ), 'since', '', "all changes since your last edit"); } } 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 hists=document.getElementById("pagehistory").getElementsByTagName('li'); for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].innerHTML==wgUserName) { document.location=hists[n].childNodes[1].href; return; }       }

msg.replaceChild(document.createTextNode                        ("You have not edited this page! (recently).  Look at more edits? "),                         msg.firstChild);

var lookharderA = document.createElement("A"); lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=1000'; lookharderA.innerHTML = '1000';

msg.appendChild(lookharderA);

msg.appendChild(document.createTextNode                        (" "));

lookharderA = document.createElement("A"); lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=2500'; lookharderA.innerHTML = '2500';

msg.appendChild(lookharderA);

msg.appendChild(document.createTextNode                        (" "));

lookharderA = document.createElement("A"); lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=5000'; lookharderA.innerHTML = '5000';

msg.appendChild(lookharderA);

}

$(addSinceTab);

//

// Add tab to tag articles to be wikified // // &lt;nowiki&gt;If you are editing a page, click the wikify button on your tab bar to add "" to the top, set "Marked for wikification" as the edit summary, mark it as a minor edit, and submit.&lt;/nowiki&gt;

function doQwikify { document.editform.wpTextbox1.value = '{' + '{' + 'Wikify|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'Marked for wikification'; document.editform.wpMinoredit.checked = true; document.editform.submit; }

$(function { if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {     // wouldn't it make more sense to just check for wgCanonicalNamespace != "", or am I missing something?     return;  }  if (document.editform) {     mw.util.addPortletLink("p-cactions", "javascript:doQwikify", "wikify", "ca-wikify", "Mark for wikification", "");  } });

// by raylu //

// Add tab to tag articles that have unreferenced material // // If you are editing a page, click the unref button on your tab bar to add "" to the top, set "Marked as unreferenced" as the edit summary, mark it as a minor edit, and submit. function doQunref { document.editform.wpTextbox1.value = '{' + '{' + 'Unreferenced|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'Marked as unreferenced.'; document.editform.wpMinoredit.checked = true; document.editform.submit; } $(function { if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {     return;  }  if (document.editform) {     mw.util.addPortletLink("p-cactions", "javascript:doQunref", "unref", "ca-unref", "Mark as unreferenced", "");  } }); // by jj137

// Add tab to tag articles that need cleanup // // CleanupTab.js // // This script adds a "cleanup" tab to the top of article pages // when in edit mode. It is disabled for the User namespace.

function doCleanup { document.editform.wpTextbox1.value = '{' + '{' + 'Cleanup|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = 'Marked for cleanup.'; document.editform.wpMinoredit.checked = true; document.editform.submit; }

$(function { if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {     return;  }  if (document.editform) {     mw.util.addPortletLink("p-cactions", "javascript:doCleanup", "cleanup", "ca-cleanup", "Mark for cleanup", "");  } });

//

// Highlight the appropriate section when hovering over an edit link addOnloadHook ( extendededitlinks ) ;

function extendededitlinks_get_event_target ( e ) { var targ ; if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) targ = targ.parentNode; // defeat Safari bug while ( targ.nodeType != 1 || targ.className != "editsection" ) targ = targ.parentNode ; return targ ; }

function extendededitlinks_is_relevant_heading ( current, compare ) { if ( current.nodeType != 1 ) return false ; if ( current.tagName.length != 2 ) return false ; if ( current.tagName.substr ( 0, 1 ) != "H" ) return false ; if ( current.tagName> compare.tagName) return false ; return true ; }

function extendededitlinks_onmouseover ( e ) { var target = extendededitlinks_get_event_target ( e ) ;

var h2 = target ; while ( h2.nodeType != 1 || h2.tagName.substr(0,1) != "H" ) h2 = h2.parentNode;

var newdiv = document.createElement ( "div" ) ; newdiv.style.backgroundColor = "#DDDDDD" ; // newdiv.style.border = "1px solid black" ; // newdiv.style.padding = "2px" ;

h2.parentNode.insertBefore ( newdiv, h2 ) ; newdiv = h2.previousSibling ; // Unneccessary?

var x = h2 ; do { var y = x ; x = x.nextSibling ; newdiv.appendChild ( y ) ; } while ( x && !extendededitlinks_is_relevant_heading ( x, h2 ) ) ;

}

function extendededitlinks_onmouseout ( e ) { var target = extendededitlinks_get_event_target ( e ) ;

var h2 = target ; while ( h2.nodeType != 1 || h2.tagName.substr(0,1) != "H" ) h2 = h2.parentNode;

var newdiv = h2 ; while ( newdiv.nodeType != 1 || newdiv.tagName != "DIV" ) newdiv = newdiv.parentNode;

for ( var y = newdiv.firstChild ; y ; y = z ) { z = y.nextSibling ; newdiv.parentNode.insertBefore ( y, newdiv ) ; } newdiv.parentNode.removeChild ( newdiv ) ; }

function extendededitlinks { var spans = document.getElementsByTagName( "span" ); for ( var i = 0 ; i < spans.length ; i++ ) { if ( spans[i].className != "editsection" ) continue ; var a = spans[i].getElementsByTagName("a")[0] ; a.onmouseover = extendededitlinks_onmouseover ; a.onmouseout = extendededitlinks_onmouseout ; } }

//This script (User:ais523/highlightmyname2.js) highlights all instances of the //logged-in user's username on pages by giving them a light blue background. It only //checks bodyContent, not titles or sidebars, and doesn't change edit windows or //Special:Preferences.

// function highlightmyname(n,p) //node, parent node { while(n!=null) {   if(n.nodeType==3) //text node {     if(n.data.toLowerCase.indexOf(wgUserName.toLowerCase)!=-1) {       var ix=n.data.toLowerCase.indexOf(wgUserName.toLowerCase); var t1=ix?document.createTextNode(n.data.substr(0,ix)):null; var t2=document.createTextNode(n.data.substr(ix,wgUserName.length)); var t3=ix+wgUserName.length==n.data.length?null: document.createTextNode(n.data.substr(ix+wgUserName.length)); var s1=document.createElement("SPAN"); s1.style.backgroundColor="#9999ff"; s1.appendChild(t2); var s2=document.createElement("SPAN"); if(t1!=null) s2.appendChild(t1); s2.appendChild(s1); if(t3!=null) s2.appendChild(t3); p.replaceChild(s2,n); if(t3!=null) highlightmyname(t3,s2); //find remaining occurences in the new nodes n=s2.nextSibling; }     else n=n.nextSibling; }   else {     if(n.firstChild!=null) highlightmyname(n.firstChild,n); n=n.nextSibling; } } } $(function {  if(location.href.indexOf("?ais523")==-1&&location.href.indexOf("&ais523")==-1&& location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&& location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&& location.href.indexOf("&action=raw")==-1&&wgPageName!="Special:Preferences")   highlightmyname(document.getElementById('bodyContent').firstChild, document.getElementById('bodyContent')); }); //

// Highlights wiki links that redirect. From User:Dschwen/highlightredirects.js if (wgAction != 'edit' && wgCanonicalNamespace != 'Special') { var highlightRedirects = { tab_redirects : null, addStylesheetRule : function(tag, style) { var ss = document.styleSheets[0]; if (ss.insertRule) { ss.insertRule(tag + '{' + style + '}', ss.cssRules.length); } else if (ss.addRule) { ss.addRule(tag, style); } }, run : function { highlightRedirects.addStylesheetRule('a.mw-redirect', 'color:green'); highlightRedirects.addStylesheetRule('a.mw-redirect:visited', 'color:darkgreen'); }, install : function { with(highlightRedirects) {  addPortletLink ('p-cactions', 'javascript:highlightRedirects.run;', 'redirects') || addPortletLink ('views', 'javascript:highlightRedirects.run;', 'redirects'); } } }; // // Hook up installation function // $(highlightRedirects.install); }

/* Watchlist notifier (User:Ais523/watchlistnotifier.js); displays a message every time a watched page changes. */ //

var wmwpajax; // From WP:US mainpage (wpajax renamed to wmwpajax) wmwpajax={ download:function(bundle) { // mandatory: bundle.url // optional: bundle.onSuccess (xmlhttprequest, bundle) // optional: bundle.onFailure (xmlhttprequest, bundle) // optional: bundle.otherStuff OK too, passed to onSuccess and onFailure var x = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false; if (x) { x.onreadystatechange=function { x.readyState==4 && wmwpajax.downloadComplete(x,bundle); };                       x.open("GET",bundle.url,true); x.send(null); }               return x;        },

downloadComplete:function(x,bundle) { x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true ) || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText+': '+bundle.url)); } };

// Example: // function dlComplete(xmlreq, data) { //     alert(data.message + xmlreq.responseText); // } // wmwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw', //                   onSuccess: dlComplete, message: "Here's what we got:\n\n" });

// End of WP:US quote

function wmWatchEditFound(xmlreq, data) { var watchrev, watchsum, watchrevold, watchpage, junk; if(xmlreq.responseText.indexOf('revid=')==-1) {   document.getElementById('contentSub').innerHTML+= " (watchlistnotifier can't determine whether a "+     "watched page has changed) "; return; } watchrev=xmlreq.responseText.split('revid="')[1].split('"')[0]; try {   watchrevold=document.cookie.split('ais523wmwatchrev=')[1].split('.')[0]; } catch(junk) {watchrevold=0;} if(wgPageName == "Special:Watchlist") {   document.cookie="ais523wmwatchrev="+watchrev+".; path=/"; var aas=document.getElementById('bodyContent').getElementsByTagName('a'); var i=aas.length; while(i--) {     if(aas[i].href.indexOf('diff=')!=-1&&watchrevold) if(+(aas[i].href.split('diff=')[1].split('&')[0])>watchrevold) aas[i].parentNode.style.fontWeight='bold'; } }  else {   watchsum=xmlreq.responseText.split('comment="')[1].split('"')[0]; watchpage=xmlreq.responseText.split('title="')[1].split('"')[0]; watchsum=watchsum.split('<').join('&lt;').split('>').join('&gt;'); watchpage=watchpage.split('<').join('&lt;').split('>').join('&gt;'); if(watchrev!=watchrevold) document.getElementById('contentSub').innerHTML+= " \""+watchpage+'" changed: "'+watchsum+       '". (watchlist) '; } }

$(function { /* Find the top item in the watchlist, and its edit summary. We only need one item, so     set the limit to 1 to ease the load on the server. */    wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wllimit=1&'+ 'wldir=older&format=xml&wlprop=comment|ids|title', onSuccess: wmWatchEditFound}); }); //