User:Hi me bye/vector-2022.js

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 = "edit", document.getElementById("ca-edit").getElementsByTagName("a")[0].setAttribute("href","javascript\:document.body.contentEditable=true; document.designMode=\"on\"; void 0; unselectTab; selectEditTab;"); }