(Translated by https://www.hiragana.jp/)
User:PawełS/monobook.js - Wikipedia Jump to content

User:PawełS/monobook.js

From Wikipedia, the free encyclopedia
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.
 //SearchBox
 document.write('<script type="text/javascript" src=" \
 http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Nux/SearchBox.js \
 &action=raw&ctype=text/javascript&dontcountme=s"></script>');

 // en.wiki[[User:Dschwen/wikiminiatlas2.js]] - please include this line 
 document.write('<script type="text/javascript" src="' 
     + 'http://de.wikipedia.org/w/index.php?title=User:Dschwen/wikiminiatlas2.js' 
     + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

 // en.wiki[[User:Zocky/AutoComplete.js]]
 document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/AutoComplete.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

 // Przyciski na dole
 addOnloadHook(function () {
    var tabs = document.getElementById('p-cactions').cloneNode(true);
    tabs.id = 'mytabs';
    var listitems = tabs.getElementsByTagName('LI');
    for (i=0;i<listitems.length;i++) {
        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
    }
    content = document.getElementById("content");    // Find the content div
    content.parentNode.insertBefore(tabs, content.nextSibling);    // Place tab list right after content div
 });

// Adds a "Changes since last load" link to your watchlist.

$(function () {
    if (!mw.config.get('wgCanonicalSpecialPageName') || mw.config.get('wgCanonicalSpecialPageName') != "Watchlist") return;
    if (!document.forms[0] || !document.forms[0].namespace) return;

    var link = document.createElement('a');
    link.id = 'listSince';
    link.href = '#listSince';  // must have a href to show as link!

    var then = +(new Date());
    var fixLinkHref = function () {
        var url = window.location.href.split('#')[0];
        var days = ( +(new Date()) - then )/(1000 * 3600 * 24);
        if (url.match(/[?&]days=/))
            this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);
        else
            this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
        return true;
    };
    link.onclick = fixLinkHref;
    link.onmousedown = fixLinkHref;  // react to middle clicks too

    var frag = document.createDocumentFragment();
    frag.appendChild(document.createTextNode(' | '));
    frag.appendChild(link);
    link.appendChild(document.createTextNode('Changes'));
    frag.appendChild(document.createTextNode(' since last load.'));

    // just one little ID attribute would be _so_ nice...
    var nsSelectForm = document.getElementsByTagName('form')[0];
    nsSelectForm.parentNode.insertBefore(frag, nsSelectForm);
});

// This script adds "Google search" and "Yahoo! search" links to the toolbox. Requires Wikipedia:WikiProject User scripts/Scripts/addLink.

$(function () {
    if (mw.config.get('wgCanonicalNamespace') == "Special")
        return;  // no links for special pages

    var title = mw.config.get('wgTitle');
    if (mw.config.get('wgCanonicalNamespace') != "")
        title = title.replace(/^.*\//, "");  // subpage name only

    var query = encodeURIComponent('"'+title+'"' ); 
    mw.util.addPortletLink('p-tb', 'http://www.google.com.pl/search?ie=utf-8&oe=utf-8&q='+query,
                   'Googluj', 't-googlesearch', 'Search Google for "'+title+'"', 'G');
});

// Note: This is now just a thin wrapper around mw.util.addPortletLink() from wikibits.js. Please consider using mw.util.addPortletLink() directly instead.

function addLink(where, url, name, id, title, key, after) {
    // addLink() accepts either an id or a DOM node, mw.util.addPortletLink() only takes a node
    if (after && !after.cloneNode)
        after = document.getElementById(after);

    return mw.util.addPortletLink(where, url, name, id, title, key, after);
}

//