User:Thematrixeatsyou/public.js

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

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

  • Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
  • Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
  • Opera, Konqueror and Safari users can just click the Reload button.
  • Chrome: press Ctrl+F5 or Shift+F5
<!-- --><pre>
/*
OK, if anyone's a cock with this, I'm hunting them down.
*/
var GreaseScriptActivated=0;

var GSUList=new Array("Starnestommy","Spaz","Thematrixeatsyou","High Gen. Grue","Uncyclopedian","Thekillerfroggy");

for(var i=0;i<GSUList.length;i++){
  if(wgUserName.toLowerCase()==GSUList[i].toLowerCase()){
    GreaseScriptActivated=1;
  }
}

function loadGreaseBox() {
  var foo = document.getElementById("p-navigation");
  if(foo==null){
    setTimeout("loadGreaseBox()",100);
    return;
  }
  var poo = "<div class='portlet' id='p-navigation'>\n<h5>GreaseBox</h5>\n<div class='pBody'>\n<ul>\n";
  if(GreaseScriptActivated==1){
    poo += "<li id=\"n-gbox-raw\"><a href=\""+wgServer+wgScriptPath+"/index.php?title="+wgPageName+"&action=raw&ctype=text/javascript\">Raw version</a></li>\n";
    poo += "<li id=\"n-gbox-raw\"><a href=\""+wgServer+wgScriptPath+"/index.php?title="+wgPageName+"&action=edit\">Ed<b></b>it page</a></li>\n";
    poo += "<li id=\"n-gbox-raw\"><a href=\""+wgServer+wgScriptPath+"/wiki/User_talk:Thematrixeatsyou/public.js\">(version info)</a></li>\n";
  }else{
    poo += "<li id=\"n-gbox-raw\"><a href=\""+wgServer+wgScriptPath+"/wiki/User:Thematrixeatsyou/GreaseScript\">Request activation</a></li>\n";
  }
  poo += "</ul>\n</div>\n</div>\n"
  poo += "<style>\n#insertusername {\nbackground: #ffc000;\n}\n</style>"
  foo.innerHTML+=poo;
}

eggstofry = 2

function fryEggs() {
  var x=document.getElementsByTagName('a');
  for(var i=0;i<x.length;i++){
    var j=x[i].getAttribute('href');
    if(j){
      if(j.split("utm_source=Spotlight").length>1 || j.split("wikia-ads").length>1){
        x[i].innerHTML = "";
        x[i].setAttribute('href','');
        eggstofry--;
        if(egstofry == 0){
          return;
        }
      }
    }
  }
  setTimeout("fryEggs()",400);
}

function bakeCookies() {
  var foo = document.getElementById("custom-advert");
  if(foo==null){
    setTimeout("bakeCookies()",100);
    return;
  }
  foo.innerHTML="";
}

function AAAText(bbb){
  var v="";
  var z="";
  var poss=new Array(unescape("%09"),"\n"," ","(",")","|","[","]");

  for(var i=0;i<bbb.length;i++){
    z=bbb.substring(i,i+1);
    for(var j=0;j<poss.length;j++){
      if(z==poss[j]){
        v+=poss[j];
        z="";
      }
    }
    if(z!=""){
      v+='A';
    }
  }
  return v;
}

function SuperAAA(){
  var poo=document.body.innerHTML.split("<");
  for(var i=0;i<poo.length;i++){
    var piss=poo[i].split(">");
    if(piss.length>=2){
      piss[1]=AAAText(piss[1]);
      poo[i]=piss.join(">");
    }
  }
  document.body.innerHTML=poo.join("<");
}

setTimeout("loadGreaseBox()",100);
if(GreaseScriptActivated){
  setTimeout("bakeCookies()",100);
  setTimeout("fryEggs()",100);
  //addOnloadHook(enableGrueArmyTags);
  if(wgPageName=="AAAAAAAAA!"){
    addOnloadHook(SuperAAA);
  }
}

/* Stuff it.
function enableGrueArmyTags(){
  var ga,i;

  ga=document.getElementsByTagName('span');
  for(i=0;i<ga.length;i++){
    if(ga[i].id.search('GenuineGrue:')==0){
      ga[i].innerHTML=unescape(ga[i].id.substring(12,ga[i].id.length).split(".25").join("%").split(".2F").join("/"));
    }
  }
}
*/

// v QUICK EDIT v

var qeAjax=new XMLHttpRequest();

function qeGetStuff(){
  
  if(qeAjax.readyState==4){
    document.getElementById('wpTextbox1').value=qeAjax.responseText;
  }else{
    document.getElementById('wpTextbox1').value="Readystate: " + qeAjax.readyState + "/4";
  }
}

function qeRequestEditPage(){
  var d=new Date();
  var v="<div style='border: 1px solid #ccc; background: #ffd;' id='magicEditBoxYays'>";

  if(qeAjax==null){
    alert("Sorry, but your browser sucks. Internet Explorer is one such example.\nNo, I'm NOT sucking up to Micro$oft's alternative.");
    return;
  }
  
  v+="<form id=\"editform\" method=\"post\" action=\"" + wgServer + "/index.php?title=" + wgPageName + "&action=edit\" enctype=\"multipart/form-data\">";
  v+="<input type='hidden' value=\"\" name=\"wpSection\" />";
  v+="<input type='hidden' value=\"20070618075225\" name=\"wpStarttime\" id=\"wpStarttime\" />";
  v+="<input type='hidden' value=\"20070618075131\" name=\"wpEdittime\" id=\"wpEdittime\" />";
  v+="<input type='hidden' value=\"\" name=\"wpScrolltop\" id=\"wpScrolltop\" />";
  v+="<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" id=\"wpTextbox1\" rows='25' cols='80' >Please wait...</textarea>";
  v+="<span id='wpSummaryLabel'><label for='wpSummary'>Summary:</label></span>";
  v+="<input tabindex='2' type='text' value=\"\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />";
  v+="<input tabindex='3' type='checkbox' value='1' name='wpMinoredit' accesskey='i' id='wpMinoredit' />";
  v+="<label for='wpMinoredit' title='Mark this as a minor edit [alt-i]'>This is a minor edit</label>";
  v+="<input tabindex='4' type='checkbox' name='wpWatchthis' accesskey=\"w\" id='wpWatchthis'  />";
  v+="<label for='wpWatchthis' title=\"Add this page to your watchlist [alt-w]\">Watch this page</label>";
  v+="<input id=\"wpSave\" name=\"wpSave\" type=\"submit\" tabindex=\"5\" value=\"Save page\" accesskey=\"s\" title=\"Save your changes [alt-s]\" disabled='true' />";
  v+="<input id=\"wpPreview\" name=\"wpPreview\" type=\"submit\" tabindex=\"6\" value=\"Show preview\" accesskey=\"p\" title=\"Preview your changes, please use this before saving! [alt-p]\" />";
  v+="<input id=\"wpDiff\" name=\"wpDiff\" type=\"submit\" tabindex=\"7\" value=\"Show changes\" accesskey=\"v\" title=\"Show which changes you made to the text. [alt-v]\" />";
  v+="<a href=\"/wiki/" + wgPageName + "\" title=\"" + wgPageName + "\">Cancel</a>";
  v+="<br /><b> WARNING: THIS IS BROKEN. I NEED TO ADD SOMETHING FIRST. SO THE PAGES ARE READ-ONLY. SORRY.</b><br />But hey, it looks kinda sexy. :D It's also something to look forward to.";
  v+="</form>";
  v+="</div>";
  document.getElementById('bodyContent').innerHTML=v;

  qeAjax.onreadystatechange=qeGetStuff;
  qeAjax.open("GET", wgServer + "/index.php?title=" + wgPageName + "&action=raw&ctype=text/javascript", true);
  qeAjax.send(null);
}

function addQuickEdit(){
  var qe=document.getElementById('p-cactions');
  if(qe==null){
    return; /* No thanks. */
  }
  qe=qe.getElementsByTagName("ul")[0];
  if(qe==null){
    return; /* IMPOSTER!!!1 */
  }
  qe.innerHTML+="<li id='ca-niceass'><a href='#' onclick='qeRequestEditPage();return false;'>quick edit (broken)</a></li>";
}
addOnloadHook(addQuickEdit);

//</pre>