Jump to content

User:Timwi/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Timwi (talk | contribs) at 18:47, 18 February 2007. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*
<pre>
*/

function moveEditsection() {
    if (typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false) {
        var spans = document.getElementsByTagName("span");
        for(var i = 0; i < spans.length; i++) {
            if(spans[i].className == "editsection") {
                spans[i].style.fontSize = "x-small";
                spans[i].style.fontWeight = "normal";
                spans[i].style.cssFloat = "none";
                spans[i].style.marginLeft = "0px";
                spans[i].parentNode.appendChild(document.createTextNode(" "));
                spans[i].parentNode.appendChild(spans[i]);
            }
        }
    }
}
// onload
addOnloadHook(moveEditsection);

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

// add link to diff pages for running external diff application
function externalDiffLoadHandler() {
  var loc = document.location;
  var bodyContent = document.getElementById ('bodyContent');
  if ((matches =
       /^http:\/\/([a-z0-9.]+)\/w\/index\.php\?title=([^&]+)(?:&curid=\d+)?&(diff=[0-9a-z]+&oldid=[0-9a-z]+)$/
       .exec (loc)) && bodyContent) {
    var obj = document.createElement ('a');
    obj.href = 'wpdiff://' + matches[1] + '/' + matches[2] + '?' + matches[3];
    obj.innerHTML = 'View this diff in external application';
    bodyContent.insertBefore (obj, bodyContent.firstChild);
  }
}
addOnloadHook(externalDiffLoadHandler);

/*
</pre>
*/