User:Erik Baas/monobook.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
stockphoto_prevent=true;

// === Unwatchlink per item op volglijst ===
// Geeft op de volglijst een link "niet volgen" bij elk artikel
// Nieuwe versie d.d. 20070926

$(function () {

    // Alleen voor "Volglijst":
    if (window.location.href.indexOf("Special:Watchlist") == -1) return; 

    // Niet voor "Volglijst bekijken en bewerken":
    if (window.location.href.indexOf("Special:Watchlist&action=edit") > 0) return;

    // Idem, via link op "Ruwe volglijst bewerken":
    if (window.location.href.indexOf("Special:Watchlist/edit") > 0) return; 

    var query_prefix = "&action=unwatch";
    var count = 0;
    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        count++;
        if (count>50) {
         break;
        }
        unwatch.href = "/w/index.php?title=" + encodeURIComponent(links[i].title) + query_prefix;
        unwatch.title = "unwatch "+links[i].title;
        unwatch.appendChild(document.createTextNode(" | unwatch"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        // kluge to handle case where "diff" is unlinked:
        var delim = links[i].previousSibling;
        delim = (delim.nodeType == 3 ? delim.nodeValue : "");
        links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
    }

});


// === Extra buttons in toolbar ===

function InsertButtonsToToolBar()
{

// marge tussen standaard- en userbuttons
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/space.png",
 "speedTip": "",
 "tagOpen": "",
 "tagClose": "",
 "sampleText": ""
 };

// Crop
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Crop.gif",
 "speedTip": "{"+"{Crop}}",
 "tagOpen": "{"+"{Crop}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Duplicate
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Duplicate.gif",
 "speedTip": "{"+"{Duplicate}}",
 "tagOpen": "{"+"{Duplicate|",
 "tagClose": "}}\n",
 "sampleText": ""
 };

// Remove border
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Removeborder.gif",
 "speedTip": "{"+"{Remove border}}",
 "tagOpen": "{"+"{Remove border}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Remove caption
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Removecaption.gif",
 "speedTip": "{"+"{Remove caption}}",
 "tagOpen": "{"+"{Remove caption}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Rename
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_rename.gif",
 "speedTip": "{"+"{Rename|}}",
 "tagOpen": "{"+"{Rename|",
 "tagClose": "}}\n",
 "sampleText": ""
 };

// Rotate
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Rotate.gif",
 "speedTip": "{"+"{Rotate}}",
 "tagOpen": "{"+"{Rotate}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Rotate 90
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_90.gif",
 "speedTip": "{"+"{Rotate 90}}",
 "tagOpen": "{"+"{Rotate|90}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Rotate 270
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_270.gif",
 "speedTip": "{"+"{Rotate 270}}",
 "tagOpen": "{"+"{Rotate|270}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Underexposed
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Underexposed.gif",
 "speedTip": "{"+"{Underexposed}}",
 "tagOpen": "{"+"{Underexposed}}\n",
 "tagClose": "",
 "sampleText": ""
 };

// Watermark
mwCustomEditButtons[mwCustomEditButtons.length] = {
 "imageFile": "http://svr003/wiki/buttons/Button_Watermark.gif",
 "speedTip": "{"+"{Watermark}}",
 "tagOpen": "{"+"{Watermark}}\n",
 "tagClose": "",
 "sampleText": ""
 };
}

if (wgNamespaceNumber == 6) {
 if (wgAction == "edit") {
  addOnloadHook( InsertButtonsToToolBar );
 }
 importScript('User:Erik_Baas/HotCat.js');
}