Jump to content

User:Codingmasters/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Codingmasters (talk | contribs) at 05:25, 2 June 2007 (added LoadIPInfo). 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.
<!-- TWINKLE revert scripts -->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
<!-- TWINKLE user warning templates -->
importScript('User:AzaToth/morebits.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
<!-- TWINKLE vandalism reporting -->
importScript('User:AzaToth/morebits.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklearv.js');
<!-- TWINKLE protection -->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinkleprotect.js');
<!-- TWINKLE deletion proposal -->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinkleprod.js');
<!-- TWINKLE settings -->
TwinkleConfig = {
        revertMaxRevisions              :       25,
        userTalkPageMode                :       'window',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       " using [[WP:TWINKLE|TWINKLE]]",
        deletionSummaryAd               :       " using [[WP:TWINKLE|TWINKLE]]",
        protectionSummaryAd             :       " using [[WP:TWINKLE|TWINKLE]]",
        watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
        watchProdPages                  :       false,
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ ],
        markRevertedPagesAsMinor        :       [ ],
        deleteTalkPageOnDelete          :       false,
        markWarningsAsMinor             :       false,
        markAIVReportAsMinor            :       false,
        markSpeedyPagesAsMinor          :       false,
        markProdPagesAsMinor            :       false,
        confirmUsernameToAIV            :       true,
        toolboxButtons                  :       [ ]
};
<!-- Contact List -->
// Script from [[User:Cameltrader/All-in-one.js]]
importScript('User:Cameltrader/All-in-one.js'); //[[User:Cameltrader/All-in-one.js]]
<!-- Votescript -->
//--------------------------------------------------------------
document.write('<script type="text/javascript" src="' 
   + 'http://en.wikipedia.org/w/index.php?title='
   + 'User:DavidHOzAu/votescript/code.js' 
   + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//--------------------------------------------------------------
<!-- WikiMiniAtlas -->
// [[User:Dschwen/wikiminiatlas2.js]] - please include this line 
document.write('<script type="text/javascript" src="' 
     + 'http://en.wikipedia.org/w/index.php?title=User:Dschwen/wikiminiatlas2.js' 
     + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
<!-- AddLinks -->
//    --- ADD VARIOUS LINKS ----
if(!addToolBoxLink) {
function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, url, name, id);
}}
// 
if(!addTopLink) {
function addTopLink(url, name, id){
    var personal = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    addlilink(personal, url, name, id);
}}
// 
if(!addNavLink) {
function addNavLink(url, name, id){
    var navigation = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
    addlilink(navigation, url, name, id);
}}
// 
if(!addTab) {
function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key);
}}

if(!addLink) {
function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //
    //* name is what will appear as the name of the button.
    //
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //
    //* key is the char you want for the accesskey. Optional.
    //
    //* after is the id of the button you want to follow this one. Optional.
    //
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}}
if(!addlilink) {
function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}}
<!-- LoadIPInfo -->
//Load IP info. Written by GeorgeMoney using Wizardry Dragon's API
var data_ipinfo = new Object();
function ip_callback(data) {
        data_ipinfo = data;
}
try { 
        var ip_regex = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/;
        if(ip_regex.test(wgTitle)
                ||ip_regex.test(location.href.split('/')[location.href.split('/').length - 1].split('?')[0])
                ||ip_regex.test(location.href.split('target=')[1].split('&')[0])
        ) {
                var ip_use = ip_regex.test(wgTitle)?wgTitle:location.href.replace(/^.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*?$/, '$1');
                document.write('<script src="http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&format=json&lang='+wgContentLanguage+'&callback=ip_callback"></script>');
                document.write(
                '<style type="text/css">'+
                '.ip-info {'+
                'border: 3px solid red;'+
                'padding: 5px;'+
                'background: honeydew'+
                '}'+
                '.ip-info li {'+
                'margin-left: 2em;'+
                '}'+
                '</style>');
                addOnloadHook(function() {
                        var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
                        addlilink(tbs, "javascript:/*void(load_ipinfo()); */void(get_ipinfo());", "ip info", 'ca-ipinfo', 'Get ip info');
                });
                function iterate_data(newdiv, dat) {
                        for(var x in dat) {
                                if(typeof dat[x] == 'object') {
                                        iterate_data(newdiv, dat[x]);
                                } else {
                                        newdiv.innerHTML += '<li><b>'+x+'</b>: '+dat[x]+'</li>\n';
                                }
                        }
                }
                function load_ipinfo() {
                        var script = document.createElement('script');
                        script.src = 'http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&format=json&lang='+wgContentLanguage+'&callback=ip_callback';
                        document.getElementsByTagName('head')[0].appendChild(script);
                }
                function get_ipinfo() {
                        var newdiv = document.createElement('div');
                        newdiv.className = 'ip-info';
                        newdiv.id = 'ip-info';
                        newdiv.innerHTML = 'IP info for '+ip_use+' <small>(retrieved from <a href="http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&lang='+wgContentLanguage+'">http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&lang='+wgContentLanguage+'</a></small>)<br>';
                        newdiv.innerHTML += '<ul>';
                        iterate_data(newdiv, data_ipinfo);
                        newdiv.innerHTML += '</ul>';
                        document.getElementById('content').insertBefore(newdiv, document.getElementById('content').getElementsByTagName('h1')[0].nextSibling);
                        document.getElementById('ca-ipinfo').firstChild.innerHTML = 'Collapse IP info';
                        document.getElementById('ca-ipinfo').firstChild.href = 'javascript:void(hide_ipinfo())';
                }
                function hide_ipinfo() {
                        document.getElementById('ca-ipinfo').firstChild.innerHTML = 'ip info';
                        document.getElementById('ca-ipinfo').firstChild.href = 'javascript:void(show_ipinfo())';
                        document.getElementById('ip-info').style.display = 'none';
                }
                function show_ipinfo() {
                        document.getElementById('ca-ipinfo').firstChild.innerHTML = 'Collapse IP info';
                        document.getElementById('ca-ipinfo').firstChild.href = 'javascript:void(hide_ipinfo())';
                        document.getElementById('ip-info').style.display = 'block';
                }
        }
} catch(e) {  }
//