User:Jared/monobook.js

//

importScript('User:Tcncv/sorttables.js');

// This is based on the original code on Wikipedia:Tools/Editing tools // // The original code was on the project page and needed to be cut and paste to the user's // monobook.js page. However, this caused problems with the quote marks. So I have moved // it to its own page. // // I do not know a lot about Javascript so please do not ask for a complicated change

//Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }

function InsertButtonsToToolBar { tooly = document.getElementById('toolbar');

if (tooly != null) { StrikeTextButton = "";

SupportVoteImageButton = "";

OpposeVoteImageButton = "";

NeutralVoteImageButton = ""; } } window.onload = InsertButtonsToToolBar;

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; }

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key); }

$(function { if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history     return;  }  if (document.title.indexOf("User:") == 0) {     username_a = document.URL.match(/:.*:(.*)/);     username=username_a[1];     addTab("http://en.wikipedia.org/w/index.php?title=User_talk:" + username + "&action=edit&section=new", "+", "", "Add new comment to user page.", "");     addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contribs", "ca-contrib", "Contribs", "");     addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "Page moves", "");     addTab("http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=" + username, "Edit count", "", "Edit count", "");  } });

$(function {  for (var i=0; i0) {      document.links[i].href+='?hideOwn=1';      break;    }  } }); function addForceSummary {   if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return; if(/&section=new/.test(window.location.href)) return; if(!document.forms.editform) return; document.forms.editform.wpSave.onclick = forceSummary; } function forceSummary {   if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))   {        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value); if(r == null) { return false; } document.forms.editform.wpSummary.value = r;   } return true; }

$(addForceSummary); // This will add an [edit top] link at the top of all pages except preview pages // by User:Pile0nades

// Add an [edit top] link to pages $(function {  // if this is preview page or generated page, stop  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// get the page title var pageTitle = document.title.split(" - ")[0].replace(" ", "_");

// create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = ' [edit top] ';

// insert divContainer into the DOM before the h1 if(window.location.href.indexOf("&action=edit") == -1) document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

if(window.location.href.indexOf("&action=edit&section=0") != -1) document.getElementById("wpSummary").value = "/* Intro */ "; });

gsTimeInsertBefore = ''; // leave blank to append after "logout" // function makeTime { var li = document.createElement( 'li' ); li.id = 'pt-time';

var mySpan = document.createElement( 'span' ); mySpan.appendChild( document.createTextNode( '00:00:00' ) );

li.appendChild( mySpan );

if ( ! gsTimeInsertBefore ) { // append to end (right) of list document.getElementById( 'pt-logout' ).parentNode.appendChild( li ); } else { var before = document.getElementById( gsTimeInsertBefore ); before.appendChild( li, before ); } doTime = window.setTimeout("getTime", 1000); }

$( makeTime );

function getTime { var time = new Date; var hours = time.getUTCHours; if (hours < 10) { hours = "0" + hours; } var minutes = time.getUTCMinutes; if (minutes < 10) { minutes = "0" + minutes; } var seconds = time.getUTCSeconds; if (seconds < 10) { seconds = "0" + seconds; } var currentTime = hours + ":" + minutes + ":" + seconds; document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 8, currentTime); doTime = window.setTimeout("getTime", 1000); }

var flameviper = new Object; flameviper.util = { getobj:function(id) { return document.getElementById ? document.getElementById(id) : document.all[id]; }, add:function(parent, tag, attr) { var el = document.createElement(tag); if (attr) { for (key in attr) { el[key] = attr[key]; } }  return parent.appendChild(el); }, mousebtnmap:{ ns:[null,1,3,2], ie:[null,1,2,null,3] }, xmlhttpreq:function { if (window.XMLHttpRequest) { xmlhttpobj = new XMLHttpRequest } else { try { xmlhttpobj = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttpobj = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttpobj = null; }   }  }  return xmlhttpobj; } }; flameviper.comm = { doreq:function(url,postdata,headers) { var req = flameviper.util.xmlhttpreq; req.open(postdata?"POST":"GET", url, false); for(header in headers) { req.setRequestHeader(header,headers[header]); } req.send(postdata||null); return req; } }; flameviper.wputil = { username:function { return mw.config.get('wgUserName'); //return flameviper.util.getobj("pt-userpage").childNodes[0].childNodes[0].nodeValue; }, iseditpage:function { return document.title.indexOf("Editing ")==0; }, pagename:function { var iseditpage = flameviper.wputil.iseditpage; return document.title.substr(iseditpage?8:0,document.title.indexOf(" - ")-(iseditpage?8:0)); }, addsidepanel:function(id,label) { var div = flameviper.util.add(flameviper.util.getobj("column-one"), "div", {className:"portlet",id:id}); flameviper.util.add(div, "H5").innerHTML = label; flameviper.util.add(flameviper.util.add(div, "div", {className:"pBody"}), "ul"); }, addsidepanelbutton:function(id,label,targhref) { var li = flameviper.util.add((flameviper.util.getobj(id).getElementsByTagName("ul"))[0],"li"); with(flameviper.util.add(li,"a")) { innerHTML = label; href = targhref; } return li; }, setpagecontent:function(pagename,content,summary,watch) { var prelimresp = flameviper.comm.doreq("/w/index.php?title="+pagename+"&action=submit"); var edittime = prelimresp.responseText.match(/\/)[1]; var edittoken = prelimresp.responseText.match(/\<input type='hidden' value="([0-9a-f]+)" name="wpEditToken" \/\>/)[1]; flameviper.comm.doreq("/w/index.php?title="+pagename+"&action=submit",     "wpEdittime="+edittime+      "&wpEditToken="+edittoken+      "&wpTextbox1="+escape(content)+      "&wpSummary="+escape(summary)+      (watch?"&wpWatchthis=on":"")+      "&wpSection=&wpSave=Save+page",      {"Content-Type":"application/x-www-form-urlencoded"}); }, getpagecontent:function (pagename) { var req = flameviper.comm.doreq("/w/index.php?title="+pagename+"&action=edit"); var content = req.responseText.match(/\<textarea[\w\W]*?\>([\w\W]*?)\<\/textarea\>/)[1]; content = content.replace(/\&lt\;/gi, "<"); content = content.replace(/\&gt\;/gi, ">"); content = content.replace(/\&quot\;/gi, "\""); content = content.replace(/\&amp\;/gi, "&");  return content; } }; flameviper.statuschanger = new Object;

/* configuration */ // change these to whatever you'd like to show up on your status page. flameviper.statuschanger.statuscode = { online:'', busy:'', offline:'' }; // true to use the personal bar, false to create a panel in the left column flameviper.statuschanger.usepersonalbar = true; // true if you'd like your status page on your watchlist flameviper.statuschanger.watchstatus = ; /* end configuration */

flameviper.statuschanger.oldonload = window.onload; window.onload = function { if (typeof flameviper.statuschanger.oldonload == "function"){setTimeout('flameviper.statuschanger.oldonload',50);} if (flameviper.statuschanger.usepersonalbar) { var a = flameviper.wputil.addsidepanelbutton("p-personal", "Online",       'javascript:flameviper.statuschanger.setstatus("online")'    ); var b = flameviper.wputil.addsidepanelbutton("p-personal", "Offline",       'javascript:flameviper.statuschanger.setstatus("offline")'    ); var c = flameviper.wputil.addsidepanelbutton("p-personal", "Vacation",       'javascript:flameviper.statuschanger.setstatus("busy")'    ); a.style.borderRight=b.style.borderRight="1px solid #aaaaaa"; b.style.marginLeft=c.style.marginLeft="0px"; a.style.paddingRight=b.style.paddingLeft=b.style.paddingRight=c.style.paddingLeft="2px"; } else { flameviper.wputil.addsidepanel("tz-statuschanger", "status changer"); flameviper.wputil.addsidepanelbutton("tz-statuschanger", "Online",       'javascript:flameviper.statuschanger.setstatus("online")'    ); flameviper.wputil.addsidepanelbutton("tz-statuschanger", "Busy",       'javascript:flameviper.statuschanger.setstatus("busy")'    ); flameviper.wputil.addsidepanelbutton("tz-statuschanger", "Offline",       'javascript:flameviper.statuschanger.setstatus("offline")'    ); } };

flameviper.statuschanger.setstatus = function(statusname) { flameviper.wputil.setpagecontent(     "User:"+flameviper.wputil.username+"/Status",      flameviper.statuschanger.statuscode[statusname],      statusname,      flameviper.statuschanger.watchstatus); };

// User:Outriggr/metadatatest.js importScript('User:Outriggr/metadatatest.js'); defaultProject = "OlympicsWikiProject";

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

//