User:Peteypaws/vector.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.
importScript('User:GregU/dashes.js'); //[[User:GregU/dashes.js]];

importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]

importScript('User:Anomie/linkclassifier.js'); // Linkback: [[User:Anomie/linkclassifier.js]]

if(mw.config.get('wgNamespaceNumber')>=0) (function(){
    var f=function(){
        var dt=new Date();
        var y=dt.getFullYear();
        var m=dt.getMonth();
        if(m==0){ y--; m=12; }
        if(m<10) m='0'+m;
        mw.util.addPortletLink('p-tb', 'http://stats.grok.se/'+escape(wgContentLanguage)+'/'+y+''+m+'/'+escape(mw.config.get('wgPageName')), 'Page view stats', 't-pageviews');
        mw.util.addPortletLink('p-tb', 'http://vs.aka-online.de/cgi-bin/wppagehiststat.pl?lang='+escape(wgContentLanguage)+'&page='+escape(mw.config.get('wgPageName')), 'Page edit stats', 't-editstats');
        mw.util.addPortletLink('p-tb', 'http://toolserver.org/~dispenser/cgi-bin/readability1.2.py?family=wikipedia&lang='+escape(wgContentLanguage)+'&page='+escape(mw.config.get('wgPageName')), 'Page readability stats', 't-readability');
        mw.util.addPortletLink('p-tb', 'http://tools.wikimedia.de/~dispenser/cgi-bin/webchecklinks.py?page='+escape(mw.config.get('wgPageName')), 'Check external links', 't-extlinks');
        mw.util.addPortletLink('p-tb', 'http://toolserver.org/~mzmcbride/cgi-bin/watcher.py?db=enwiki_p&titles='+escape(mw.config.get('wgPageName')), 'Watcher count', 't-watchercount');
    };

    $(f);
})();





//<pre>

if ((typeof auto_mod_loaded == 'undefined')
    || !auto_mod_loaded) {
auto_mod_loaded = true;
auto_mod_exectd = false;

function am_get_query_vars(){
     var res = new Array();
     var pairs = location.search.substring(1).split("&");
     for(var i=0; i < pairs.length; i++){
         var pair = pairs[i].split("=");
         res[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
     }
     return  res;
}

function am_add_li(portlet, url, text, id, title) {
    var tabs = document.getElementById('p-'+portlet).getElementsByTagName('ul')[0]
    var na = document.createElement('a');
    na.href = url;
    na.id = id;
    na.appendChild(document.createTextNode(text));
    if (title)
       na.title = title;
    var li = document.createElement('li');
    if (id)
       li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

function am_get_title() {
    //Avoids problems with &amp; etc, but will also include ' - edit this page', etc
    return document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
}

function am_tidy_title()
{
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
  return unescape(editlk);
}

function am_guess_date() {
    var monthnames = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    var today = new Date();
    return today.getUTCFullYear() + ' ' + monthnames[today.getUTCMonth()] + ' ' + today.getUTCDate();
}

function am_make_url(title, before, after, summary) {
    return 'http://en.wikipedia.org/w/index.php?title='+escape(title)+
        '&action=edit'+
        '&amaddbefore='+escape(before)+'&amaddafter='+escape(after)+
        '&amsummary='+escape(summary);
}

function auto_mod() {
    if (auto_mod_exectd)
        return false;
    auto_mod_exectd = true;
    qvars = am_get_query_vars();
    if (qvars['action']=='edit') {
      if (qvars['amnull']) {
        document.getElementById('editform').submit();
        return true;
      }
      if (qvars['amaddafter'] || qvars['amaddbefore'] || qvars['amreplace']) {
        var summ_el = document.getElementById('wpSummary');
        if (summ_el.value != '' && summ_el.value.substr(summ_el.value.length - 3, 3) != '*/ ') {
            // have already added summary
            return true;
        }
        var text = document.getElementById('wpTextbox1');
        if (qvars['amclear'])
            text.value = '';
        if (qvars['amfind'] && qvars['amreplace'] && qvars["amlocal"])
            text.value = text.value.replace(new RegExp(qvars['amfind']), function($0, $1){ return qvars['amreplace'].replace("$0",$0); })
        else if (qvars['amfind'] && qvars['amreplace'])
            text.value = text.value.replace(new RegExp(qvars['amfind'], "g"), function($0, $1){ return qvars['amreplace'].replace("$0",$0); });
        if (qvars['amaddafter']) {
            if (text.value.charAt(text.value.length-1) != '\n')
                text.value += '\n';
            text.value += qvars['amaddafter'];
        }
        if (qvars['amaddbefore']) {
            if (text.value.charAt(0) != '\n')
                text.value = '\n' + text.value;
            text.value = qvars['amaddbefore'] + text.value;
        }
        summ_el.value += (qvars['amsummary'] || ' ');
        if (qvars['amminor']) {
          document.getElementById("wpMinoredit").checked = true;
        } else {
          document.getElementById("wpMinoredit").checked = false;
        }

        if (qvars['amautosave']) {
            document.getElementById('editform').submit();
        }
      }
      return true;
    }
    return false;
}

function am_add_onload(f) {
  // borrowed from [[WP:US]]
  if (window.addEventListener) window.addEventListener("load",f,false);
  else if (window.attachEvent) window.attachEvent("onload",f);
}


} // end if auto_mod_loaded

//</pre>

/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 * @update-token [[File:pathoschild/templatescript.js]]
 */
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js');

importScript('User:Dr_pda/prosesize.js'); //[[User:Dr_pda/prosesize.js]]
importScript('User:AWeenieMan/furme.js');
importScript('User:AWeenieMan/furmeScroller.js');


//<nowiki>

topaz.statuschanger = new Object();
topaz.statuschanger.version = 20061108;


/* configuration */

// change these to whatever you'd like to show up on your status page.  you can add new lines in
// the same format provided there is a comma at the end of each line but the last one.  you can
// also use wikimarkup here to, for example, display an image instead of text.
topaz.statuschanger.statuscode = {
  online:'<font color="green">online</font>',
  busy:'<font color="orange">busy</font>',
  offline:'<font color="red">offline</font>'
};

// this will make wikimarkup work in your stauscodes but will disable auto-updating
topaz.statuschanger.enablewikimarkup = false;

// true to use the personal bar, false to create a panel in the left column
topaz.statuschanger.usepersonalbar = true;

// true if you'd like your status page on your watchlist
topaz.statuschanger.watchstatus = false;

/* end configuration */


topaz.statuschanger.buttonlist = {};
topaz.statuschanger.oldonload = window.onload;
window.onload = function() {
  if (typeof topaz.statuschanger.oldonload == "function") {
    setTimeout('topaz.statuschanger.oldonload()',50);
  }
  if (!topaz.statuschanger.usepersonalbar) {
    topaz.wputil.addsidepanel("tz-statuschanger", "status changer");
  }
  var buttonlist = [];
  for (status in topaz.statuschanger.statuscode) {
    buttonlist.push(status);
    topaz.statuschanger.buttonlist[status] =
        topaz.wputil.addsidepanelbutton(
          topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger",
          status,
          'javascript:topaz.statuschanger.setstatus("' + status + '")'
        );
  }

  if (topaz.statuschanger.usepersonalbar) {
    for(var i=0; i<buttonlist.length; i++) {
      with (topaz.statuschanger.buttonlist[buttonlist[i]].style) {
        if (i != buttonlist.length-1) {
          borderRight = "1px solid #aaaaaa";
          paddingRight = "2px";
        }
        if (i != 0) {
          marginLeft = "0px";
          paddingLeft = "2px";
        }
      }
    }
  }

  var spanlist = document.getElementsByTagName("span");
  for (var i=0; i<spanlist.length; i++) {
    if (spanlist[i].className == "topaz.statuschanger.curstatus."+escape(topaz.wputil.username())) {
      topaz.util.cookie.set("topaz.statuschanger.curstatus", spanlist[i].innerHTML);
    }
  }

  topaz.statuschanger.update();
};

topaz.statuschanger.setstatus = function(statusname) {
  topaz.wputil.setpagecontent(
      "User:"+topaz.wputil.username()+"/Status",

      (!topaz.statuschanger.enablewikimarkup ?
          '<includeonly><span class="topaz.statuschanger.inlinestatus.'
          + escape(topaz.wputil.username())
          + '"></includeonly>'
      : '') +

      topaz.statuschanger.statuscode[statusname] +

      (!topaz.statuschanger.enablewikimarkup ?
          '<includeonly></span></includeonly>'
      : '') +

      '<span class="topaz.statuschanger.curstatus.'+escape(topaz.wputil.username()) +
      '" style="display:none">'+statusname+'</span>',

      statusname,
      topaz.statuschanger.watchstatus);
  topaz.util.cookie.set("topaz.statuschanger.curstatus", statusname);
  topaz.statuschanger.update();
};

topaz.statuschanger.laststatus = null;
topaz.statuschanger.update = function() {
  var curstatus = topaz.util.cookie.get("topaz.statuschanger.curstatus");
  if (curstatus && curstatus != topaz.statuschanger.laststatus) {
    for (status in topaz.statuschanger.buttonlist) {
      with (topaz.statuschanger.buttonlist[status].style) {
        if (status == curstatus) {
          fontWeight = "bold";
        } else {
          fontWeight = "normal";
        }
      }
    }

    if (!topaz.statuschanger.enablewikimarkup) {
      var spanlist = document.getElementsByTagName("span");
      for (var i=0; i<spanlist.length; i++) {
        if (spanlist[i].className == "topaz.statuschanger.inlinestatus."+escape(topaz.wputil.username())) {
          spanlist[i].innerHTML = topaz.statuschanger.statuscode[curstatus];
        }
      }
    }
  }
  topaz.statuschanger.laststatus = curstatus;
};

setInterval("topaz.statuschanger.update()", 5000);


//</nowiki>


var wp_sk_show_as_button = true; // show the button
var wp_sk_redir_enabled = true; // AJAX redirects
var wp_sk_debug_enabled = true; // debu

importScript('User:Nux/wp_sk.js')
importScript('User:Lupin/recent2.js');
importScript('User:Tim Song/afchelper4.js');
importScript('User:Ioeth/friendly.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlywelcome.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlyshared.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlytag.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlyclock.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlytabs.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlytalkback.js');