Jump to content

User:SKYNET X7000/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SKYNET X7000 (talk | contribs) at 21:14, 18 December 2007 (Added Script). 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.
importScript('User:AzaToth/twinkle.js');

importScript('User:Ioeth/friendly.js');

FriendlyConfig = {
        summaryAd                       :       " using [[WP:FRIENDLY|Friendly]]",
        topWelcomes                     :       false,
        watchWelcomes                   :       true,
        markWelcomesAsMinor             :       true,
        insertHeadings                  :       true,
        welcomeHeading                  :       "== Welcome to Wikipedia ==",
        insertUsername                  :       true,
        insertSignature                 :       true,
        quickWelcomeMode                :       "auto",
        quickWelcomeTemplate            :       "Welcome",
        markSharedAsMinor               :       true,
        groupByDefault                  :       true,
        watchTaggedPages                :       false,
        markTaggedPagesAsMinor          :       true
};

importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlywelcome.js');

 */

addOnloadHook(function () {

    // Check if we're on the watchlist
    if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;
    if (!document.forms[0] || !document.forms[0].namespace) return;

    // Unwatch links go back to watchlist with "Removing requested items from watchlist..." message
    var query_prefix = "title="+encodeURIComponent(wgPageName)+"&action=submit&remove=1&id[]=";

    // ...or...
    // Unwatch links go to "Removed from watchlist" page
    //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);
    }
});

//