User:PAH Page/monobook.js

From wikishia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// [[User:Voice_of_All/Addtabs/monobook.js]]

importScript('User:Voice_of_All/Addtabs/monobook.js');

// [[User:Lupin/popups.js]]

importScript('User:Lupin/popups.js');
popupAdminLinks=true;

// [[User:Lupin/recent2.js]]

importScript("User:Lupin/recent2.js");

// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

// install [[WP:TWINKLE]] to system

importScript('User:AzaToth/twinkle.js');

//
// Edit tools for the vandal whack-a-mole game
// [[User:Kbh3rd/whackamole.js]] - please include this line
//
document.write('<script type="text/javascript" src="' 
+ 'http://en.wikipedia.org/w/index.php?title=User:Kbh3rd/whackamole.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// [[User:Henrik/live-edit-counter]]
importScript('User:Henrik/js/live-edit-counter.js');

// Extra edit buttons, [[User:MarkS/Extra_edit_buttons]]
importScript('User:MarkS/extraeditbuttons.js'); //[[User:MarkS/extraeditbuttons.js]]

/**** welcome new user ****/
document.write('<script type="text/javascript"' +
'src="http://en.wikipedia.org/w/index.php?title=User:Nmajdan/welcome_newuser.js' +
'&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//The welcome template you are wanting to use
var welcome_msg = 'welcomeg&#124;name=FastLizard4'


// [[User:Ais523/votesymbols.js]]
// Code for adding icons to !votes in AfDs, RfAs, etc.. Doesn't affect the page, just
// shows the icons when this code is installed.
// Please see [[:Image:Votesymbols.js-enhanced_SfD.png]] for copyright info on the images that are added.
 
function lowerNoPunct(s)
{
  return s.toLowerCase().split('.').join('').split(',').join('').split(':').join('').split(';').join('').split('+').join('');
}
 
addOnloadHook(function() {
  if(wgNamespaceNumber==-2) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==-1) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==1) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==2) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==3) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==6) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==7) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==8) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==9) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==10) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==11) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==12) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==13) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==14) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==15) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==100) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==101) return; //avoid user space, generally speaking
  if(wgNamespaceNumber==0) return; //avoid article space, generally speaking
  var vs=
  "http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/15px-Symbol_support_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/15px-Symbol_keep_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/15px-Symbol_oppose_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/15px-Symbol_delete_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/15px-Symbol_neutral_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/15px-Symbol_merge_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/15px-Symbol_move_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/15px-Symbol_redirect_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/15px-Symbol_opinion_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Symbol_note.svg/15px-Symbol_note.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/15px-Symbol_unsupport_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/15px-Symbol_question.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Symbol_divide_vote.svg/15px-Symbol_divide_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/15px-Symbol_wait.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-grin.svg/15px-Face-grin.svg.png";
  var vt=vs.split("#");
  var la=new Array();
  la['support']=0; la['endorse']=0;
  la['keep']=1;
  la['oppose']=2; la['overturn']=2; la['object']=2;
  la['delete']=3;
  la['neutral']=4;
  la['merge']=5; la['upmerge']=5;
  la['move']=6; la['rename']=6; la['userfy']=6; la['transwiki']=6;
  la['redirect']=7;
  la['opinion']=8;
  la['relist']=8;
  la['subst']=8; 
  la['salt']=8;
  la['change']=8;
  // Note that icon 8 on the list is often used for debate-specific !votes
  la['comment']=9;
  la['update']=9;
  la['note']=9;
  la['delist']=10;
  la['question']=11;
  la['split']=12;
  la['wait']=13;
  la['bjaodn']=14;
 
  var btc=document.body.getElementsByTagName("B");
  i=btc.length;
  while(i--)
  {
    var j,k;
    j=btc[i].innerHTML.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" ");
    k=0;
    var x="";
    while(k<j.length)
    {
      if(lowerNoPunct(j[k])=="don't"||lowerNoPunct(j[k])=='not'
       ||lowerNoPunct(j[k])=='no'||lowerNoPunct(j[k])=='without') break;
      var l=la[lowerNoPunct(j[k])];
      if(l!=undefined)
      {
        x+="<IMG SRC='"+vt[l]+"' /> "
      }
      k++;
    }
    if(x!="") btc[i].innerHTML=x+btc[i].innerHTML;
  }
});
//[[Category:Wikipedia scripts]]



// New page patrol
importScript('User:TheJosh/Scripts/NewPagePatrol.js');
////////////////////////////////////////////////////////////////
// =-=-=- HELPER FUNCTIONS -=-=-=-
function addlilink(tabs, url, name, id, title, key)
{
//check for duplicates
if (document.getElementById(id)){return;}
//cologne blue bypass
if (document.getElementById('quickbar'))
   {
   if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
      {
      addquickbarlink(url, name, id, title, 'Edit');
      }
   if (document.getElementById('footer') && !document.getElementById('bodyContent'))
      {
      addfooterlink(url, name, id, title);
      }
   return;
   }
//monobook
    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;
}
 
function insertAfter(parent, node, referenceNode) {
    parent.insertBefore(node, referenceNode.nextSibling);
}
 
function prependChild(parent, node) {
    parent.insertBefore(node, parent.firstChild);
}
 
function addToolboxLink(url, name, id, key)
{
    if (document.getElementById('p-tb'))
      {var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];}
    addlilink(tb, url, name, id, key);
}
 
function addTab(url, name, id, title, key)
{
//monobook
    if (document.getElementById('p-cactions'))
      {var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];}
//cologneblue
    else {
      if (document.getElementById('quickbar'))
        {var tabs = document.getElementById('quickbar').getElementsByTagName('h6')[2];}
      if (document.getElementById('footer'))
        {var tabs = document.getElementById('footer').getElementsByTagName('td')[0];}
      return addquickbarlink(url, name, id, 'Edit');
    }
      return addlilink(tabs, url, name, id, title, key);
}
 
///////////////
//cologneblue tab/link adder
function addquickbarlink(url, name, id, title, header)
{
var header = '<h6>' + header + '</h6>';
var tabs = document.getElementById('quickbar'); 
if (tabs.innerHTML.indexOf(header) ==-1)
  {return;}
var add_html = '<strong><a id="' + id + '" title="' + title + '" href="' + url + '">' + name + '</a></strong><br />';
var section_html = tabs.innerHTML.split(header)[1].split('<h6>')[0];
var next_section = '<h6>' + tabs.innerHTML.split(header)[1].split('<h6>')[1].split('</h6>')[0] + '</h6>';
tabs.innerHTML = tabs.innerHTML.split(header)[0] + header + section_html + add_html + next_section + tabs.innerHTML.split(next_section)[1];
}
 
function addfooterlink(url, name, id, title)
{
var tabs = document.getElementById('footer').getElementsByTagName('td')[1]; 
var add_html = '<strong><a href="' + url + '" title="' + title + '" id="' + id + '">' + name + '</a></strong>';
tabs.innerHTML = add_html + ' | ' + tabs.innerHTML;
}
///////////////
 
function addLink(where, url, name, id, title, key, after){
    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;
}
/////////////////////////////////////////////
 
/**** Add generic tab ****/
 
function addlilink_simple(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}
 
function addlimenu(tabs, name, id)
{
    var na = document.createElement('a');
    na.href = '#';
    var mn = document.createElement('ul');
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabs.appendChild(li);
    return li;
}
 
/////////
//These are simplier versions of the above, except they add the links on top, not on botton
function addnavbox_link(URL,Name,ID)
{
//cologne blue bypass
   if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
      {
      var tabs = document.getElementById('quickbar'); 
      addquickbarlink(URL, Name, ID, Name, 'Browse');
      return;
      }
//monobook
var portlet = document.getElementById('p-navigation');
var links = portlet.getElementsByTagName('ul')[0];
links.innerHTML += '<li id="' + ID + '"><a href="' + URL + '">' + Name + '</a></li>';
}
//////////
 
function URLEncoding(input)
      {
        var encodedInputString=escape(input);
        encodedInputString=encodedInputString.replace(/\+/g, "%2B");
        encodedInputString=encodedInputString.replace(/\//g,"%2F");  
        encodedInputString=encodedInputString.replace(/&/g,"%26");     
        var outputurl=encodedInputString;
        return outputurl;
      }
 
function toRegExp(what)
{
  what = what.replace(/\\/g,"\\\\");
  what = what.replace(/\(/g,"\\(").replace(/\)/g,"\\)");
  what = what.replace(/\{/g,"\\{").replace(/\}/g,"\\}");
  what = what.replace(/\[/g,"\\[").replace(/\]/g,"\\]");
  what = what.replace(/\|/g,"\\|");
  what = what.replace(/\./g,"\\.");
  what = what.replace(/\$/g,"\\$");
  what = what.replace(/\+/g,"\\+");
  what = what.replace(/\^/g,"\\^");
  what = what.replace(/\?/g,"\\?");
  what = what.replace(/\*/g,"\\*");
  what = what.replace(/\//g,"\\/");
  return what;
}

//////////STATUS CHANGER
// Creator: Misza13
// Credits: Voyagerfan5761 for some minor improvements
 
addOnloadHook(function (){
  var subpage = "/Status";
  var scheme = "/StatusTemplate";
  var linkprefix = wgServer+wgScript+"?title=User:";
  //Add the links
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "", "pt-logout");
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status update: "+status;
  //Submit it!
  document.getElementById('editform').submit();
});
 
//[[Category:Wikipedia scripts|statusChanger]]