User:Gordon E./vector.js

From the Super Mario Wiki, the Mario encyclopedia
Revision as of 20:37, April 1, 2022 by Gordon E. (talk | contribs) (Testing April fools for myself, albeit somewhat belated.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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.
function unselectTab() {
	tmp =  document.getElementById("right-navigation").innerHTML;
	document.getElementById("right-navigation").innerHTML = tmp.replace("selected","");
}

function selectEditTab() {
	document.getElementById("ca-edit").setAttribute("class","selected");
	document.getElementById("ca-view").getElementsByTagName("a")[0].setAttribute("href","javascript:selectReadTab();");
	document.getElementById("ca-view").addEventListener("mousedown",selectReadTab);
}

function selectReadTab() {
 unselectTab(); unselectTab(); 
 document.body.contentEditable=false; document.designMode="off"; 
 document.getElementById("ca-view").setAttribute("class","selected"); 
}

function viewsource2edit() {
	if (document.getElementById("ca-viewsource"))
	    document.getElementById("ca-viewsource").outerHTML=
	    document.getElementById("ca-viewsource").outerHTML.replace("ca-viewsource","ca-edit");
}

// ----------

viewsource2edit();
if (document.getElementById("ca-edit")) {
    document.getElementById("ca-edit").getElementsByTagName("a")[0].innerHTML = "Vandalize",
    document.getElementById("ca-edit").getElementsByTagName("a")[0].setAttribute("href","javascript\:document.body.contentEditable=true; document.designMode=\"on\"; void 0;  unselectTab(); selectEditTab();");
}