Misplaced Pages

User:Neutralhomer/monobook.js: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Neutralhomer Browse history interactively← Previous editNext edit →Content deleted Content added
Revision as of 22:44, 27 March 2011 view sourceNeutralhomer (talk | contribs)Autopatrolled, Extended confirmed users, Page movers, File movers, Pending changes reviewers75,195 editsNo edit summary← Previous edit Revision as of 22:46, 27 March 2011 view source Neutralhomer (talk | contribs)Autopatrolled, Extended confirmed users, Page movers, File movers, Pending changes reviewers75,195 editsNo edit summaryNext edit →
Line 1: Line 1:
// ] // ]
importScript('User:Lupin/popups.js'); importScript('User:Lupin/popups.js');

importScript('User:AzaToth/twinkle.js'); importScript('User:AzaToth/twinkle.js');


importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool

importScript('User:TheDJ/qui.js'); importScript('User:TheDJ/qui.js');

importScript('User:Ioeth/friendly.js'); importScript('User:Ioeth/friendly.js');
if( typeof( FriendlyConfig) == 'undefined' ) FriendlyConfig= {}; // DO NOT REMOVE THIS LINE - ALL FRIENDLY SETTINGS AFTER THIS if( typeof( FriendlyConfig) == 'undefined' ) FriendlyConfig= {}; // DO NOT REMOVE THIS LINE - ALL FRIENDLY SETTINGS AFTER THIS
FriendlyConfig.enableClock = false; FriendlyConfig.enableClock = false;

importScript( "User:Davidgothberg/newmessageshistory.js" ); importScript( "User:Davidgothberg/newmessageshistory.js" );

/* Watchlist notifier (]); displays a message every time a watched page changes. */
//<pre><nowiki>
var wmwpajax;
// From ] 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/search/?title=Thresher&action=raw',
// onSuccess: dlComplete, message: "Here's what we got:\n\n" });
// End of ] quote
function wmWatchEditFound(xmlreq, data) {
var watchrev, watchsum, watchrevold, watchpage, junk;
if(xmlreq.responseText.indexOf('revid=')==-1)
{
document.getElementById('contentSub').innerHTML+=
"<div class='watchlistnotify'>(<i>watchlistnotifier can't determine whether a "+
"watched page has changed<i>)</div>";
return;
}
watchrev=xmlreq.responseText.split('revid="').split('"');
try
{
watchrevold=document.cookie.split('ais523wmwatchrev=').split('.');
}
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.href.indexOf('diff=')!=-1&&watchrevold)
if(+(aas.href.split('diff=').split('&'))>watchrevold)
aas.parentNode.style.fontWeight='bold';
}
}
else
{
watchsum=xmlreq.responseText.split('comment="').split('"');
watchpage=xmlreq.responseText.split('title="').split('"');
watchuser=xmlreq.responseText.split('user="').split('"');
watchsum=watchsum.split('<').join('&lt;').split('>').join('&gt;');
watchpage=watchpage.split('<').join('&lt;').split('>').join('&gt;');
watchuser=watchuser.split('<').join('&lt;').split('>').join('&gt;');
if(watchrev!=watchrevold)
document.getElementById('contentSub').innerHTML+=
"<div class='watchlistnotify'>\""+watchpage+'" changed by '+
watchuser+': "'+watchsum+
'". (<a href="/Special:Watchlist">watchlist</a>)</div>';
}
}
addOnloadHook(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|user', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// ]

Revision as of 22:46, 27 March 2011

// ]   
importScript('User:Lupin/popups.js');

importScript('User:AzaToth/twinkle.js');

importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool

importScript('User:TheDJ/qui.js');

importScript('User:Ioeth/friendly.js');
if( typeof( FriendlyConfig) == 'undefined' ) FriendlyConfig= {}; // DO NOT REMOVE THIS LINE - ALL FRIENDLY SETTINGS AFTER THIS
FriendlyConfig.enableClock                     =      false;

importScript( "User:Davidgothberg/newmessageshistory.js" );

/* Watchlist notifier (]); displays a message every time a watched page changes. */
//<pre><nowiki>
 
var wmwpajax;
// From ] 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/search/?title=Thresher&action=raw', 
//                   onSuccess: dlComplete, message: "Here's what we got:\n\n" });
 
// End of ] quote
 
function wmWatchEditFound(xmlreq, data) {
  var watchrev, watchsum, watchrevold, watchpage, junk;
  if(xmlreq.responseText.indexOf('revid=')==-1)
  {
    document.getElementById('contentSub').innerHTML+=
      "<div class='watchlistnotify'>(<i>watchlistnotifier can't determine whether a "+
      "watched page has changed<i>)</div>";
    return;
  }
  watchrev=xmlreq.responseText.split('revid="').split('"');
  try
  {
    watchrevold=document.cookie.split('ais523wmwatchrev=').split('.');
  }
  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.href.indexOf('diff=')!=-1&&watchrevold)
        if(+(aas.href.split('diff=').split('&'))>watchrevold)
          aas.parentNode.style.fontWeight='bold';
    }
  }
  else
  {
    watchsum=xmlreq.responseText.split('comment="').split('"');
    watchpage=xmlreq.responseText.split('title="').split('"');
    watchuser=xmlreq.responseText.split('user="').split('"');
    watchsum=watchsum.split('<').join('&lt;').split('>').join('&gt;');
    watchpage=watchpage.split('<').join('&lt;').split('>').join('&gt;');
    watchuser=watchuser.split('<').join('&lt;').split('>').join('&gt;');
    if(watchrev!=watchrevold)
      document.getElementById('contentSub').innerHTML+=
        "<div class='watchlistnotify'>\""+watchpage+'" changed by '+
        watchuser+': "'+watchsum+
        '". (<a href="/Special:Watchlist">watchlist</a>)</div>';
  }
}
 
addOnloadHook(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|user', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// ]
Category:
User:Neutralhomer/monobook.js: Difference between revisions Add topic