User:Nx/monobook.js

LocalComments = { dateDifference: true, dateFormat: 'dmy', timeFirst: true, twentyFourHours: true };

/* var api = sajax_init_object; api.open('GET', wgServer + wgScriptPath + '/api.php?format=json&action=query&prop=info&indexpageids=1&intoken=edit&titles=Whatever', true); api.onreadystatechange = extract_token; api.send(null); function extract_token { if(api.readyState==4) { if(api.status==200) { var response = eval('(' + api.responseText + ')'); var token = response['query']['pages'][response['query']['pageids'][0]]['edittoken']; edit_page(token); }		else { alert('The token query returned an error.'); }	} } // edit page (must be done through POST) function edit_page(_token) { var parameters = 'action=edit&title=User:Nx/Sandbox&text=AJAX_test!&token=' + encodeURIComponent(_token); api.open('POST', wgServer + wgScriptPath + '/api.php', true); // just reuse the same query object api.onreadystatechange = alert_result; api.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); api.setRequestHeader('Connection', 'keep-alive'); api.setRequestHeader('Content-length', parameters.length); api.send(parameters); // process response function alert_result { if(api.readyState==4) { if(api.status==200) { alert('Page edited!' + api.responseText); }			else { alert('The query returned an error.' + api.responseText); }		}	} }

/*importScript('User:Nx/Scripts/Smileybox.js'); importScript('User:Nx/Scripts/Smileylist.js'); importScript('User:Nx/Scripts/Addcomment.js'); importScript('User:Nx/Scripts/Curse.js'); importScript('User:Nx/Scripts/AutoWIGO.js');*/ var nx_hfn_strict = true; importScript('User:Nx/Scripts/HideFakeNotice.js'); /*importScript('User:Ipatrol/popups.js'); importScript('User:Nx/Scripts/Botwarn.js'); importScript('User:Π/Scripts/fakename.js'); //var botswitch_altacc = "NxBot"; //importScript('User:Nx/Scripts/Botswitch.js'); //importScript('User:Nx/Scripts/Autoarchive.js'); importScript('User:Nx/Scripts/Resurrect.js'); importScript("User:Nx/Scripts/RandomCP.js"); //importScript("User:Nx/Scripts/Editcount.js"); importScript("User:Nx/Scripts/Userrights.js");

/* Sandbox

/* Uptime widget

function rwloadaverage { var req = false; if (window.XMLHttpRequest) { req = new XMLHttpRequest; } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req) { req.open("GET", wgServer + "/widget/load.php", true); req.onreadystatechange = function {     if (req.readyState==4) {       if (req.status == 200) { /*         if (uptimewidget = document.getElementById("serveruptime")) { uptimewidget.style.display = "inline"; uptimewidget.innerHTML = req.responseText.match(/Server uptime:<\/b> (.*) /)[1]; }*/         if (loadwidget = document.getElementById("serverload")) { loadwidget.style.display = "inline"; loadwidget.innerHTML = req.responseText.match(/Server load:.*()/)[1]; }         if (statuswidget = document.getElementById("serverstatus")) { statuswidget.style.color = "green"; statuswidget.innerHTML = "Server online"; }       } else { if (loadwidget = document.getElementById("serverload")) { loadwidget.style.display = "none"; } /*         if (uptimewidget = document.getElementById("serveruptime")) { uptimewidget.style.display = "none"; }*/         if (statuswidget = document.getElementById("serverstatus")) { statuswidget.style.color = "red"; statuswidget.innerHTML = "Server offline"; }       }      }    }    req.send(null); } }

function setup_server_monitor { if (columnone = document.getElementById("column-one")) { statusdiv = document.createElement("div"); statusdiv.className = "portlet"; heading = document.createElement("h5"); heading.innerHTML = "status"; statusdiv.appendChild(heading); statusbody = document.createElement("div"); statusbody.className = "pBody"; ul = document.createElement("ul"); li1 = document.createElement("li"); li2 = document.createElement("li"); li3 = document.createElement("li"); li1.innerHTML = ""; //   li2.innerHTML = ""; li3.innerHTML = ""; ul.appendChild(li1); //   ul.appendChild(li2); ul.appendChild(li3); statusbody.appendChild(ul); statusdiv.appendChild(statusbody); columnone.appendChild(statusdiv); } rwloadaverage; }

addOnloadHook(setup_server_monitor);

importScript('User:Nx/Scripts/Shared.js');

addOnloadHook(function { if (mwEditButtons)  {    if (mwEditButtons.length >= 10)    {      if (mwEditButtons[9].tagOpen == ('--~' + '~' + '~'+ '~')) { mwEditButtons[9].tagOpen = ('~' + '~' + '~' + '~'); }    }  } } );

function botrollback { var rollbacklinks = getElementsByClassName(document.getElementById('bodyContent'),"*","mw-rollback-link"); var botrblinks = new Array; for (var j = 0; j< rollbacklinks.length; j++) { var rbbs = document.createElement('span'); var rba = rollbacklinks[j].getElementsByTagName('a')[0]; var rbba = document.createElement('a'); rbba.innerHTML = "bot rollback"; rbba.href = rba.href + '&bot=1'; if ( rollbacklinks[j].innerHTML[0] == "[" ) rbbs.appendChild(document.createTextNode("[")); rbbs.appendChild(rbba); if ( rollbacklinks[j].innerHTML[rollbacklinks[j].innerHTML.length-1] == "]" ) rbbs.appendChild(document.createTextNode("]")); if (rollbacklinks[j].nextSibling == undefined) { rollbacklinks[j].parentNode.appendChild(document.createTextNode(" ")); rollbacklinks[j].parentNode.appendChild(rbbs); } else { rollbacklinks[j].parentNode.insertBefore(rbbs,rollbacklinks[j].nextSibling); rollbacklinks[j].parentNode.insertBefore(document.createTextNode(rbbs.nextSibling.textContent),rbbs); }     botrblinks.push(rbbs); } for (var j = 0; j< botrblinks.length; j++) { botrblinks[j].className = "mw-rollback-link"; } }

addOnloadHook(botrollback);

function gettoken_api { var api = sajax_init_object; api.open('GET', wgServer + wgScriptPath + '/api.php?format=json&action=query&prop=info&indexpageids=1&intoken=edit&titles=Whatever', false); api.send(null); if(api.status==200) { var response = eval('(' + api.responseText + ')'); var token = response['query']['pages'][response['query']['pageids'][0]]['edittoken']; } else { alert('The token query returned an error.'); } return token; }

function hotban(target) { var req = sajax_init_object; req.open('POST', wgServer + wgScriptPath + '/index.php?title=Special:Block&action=submit&wpBlockAddress=' + encodeURIComponent(target) + '&wpBlockOther=1+day&wpAnonOnly=1&wpEnableAutoblock=1&wpCreateAccount=1&wpAllowUsertalk=1&wpBlockReasonList=other&wpBlockReason=Unfunny%20vandalism&wpEditToken=' + encodeURIComponent(gettoken_api), true); req.onreadystatechange = function { if(req.readyState==4) { if(req.status==200) { alert('B&'); } else { alert('Oh noes! ' + req.responseText); }   }  };  req.send(null); }

function qbonc(stuff,target) { stuff.onclick = function {hotban(target);} }

function setuphotban { var anchors = document.getElementsByTagName('a'); for ( i in anchors ) { if (anchors[i].title != undefined && anchors[i].title.indexOf("Special:Block/") != -1) { target = anchors[i].title.substring(14,anchors[i].title.length); var qba = document.createElement('a'); qba.innerHTML = "quick block"; qba.style.cursor = "pointer"; qbonc(qba,target); if (anchors[i].nextSibling == undefined) { anchors[i].parentNode.appendChild(document.createTextNode(" ")); anchors[i].parentNode.appendChild(qba); } else { anchors[i].parentNode.insertBefore(qba,anchors[i].nextSibling); anchors[i].parentNode.insertBefore(document.createTextNode(" "),qba); }   }  } }

//addOnloadHook(setuphotban);