function showHideMenu() { var doc = document.getElementById("moreoptions"); if(doc.className == "hidden-by-default") { doc.className = ""; }else{ doc.className = "hidden-by-default"; } } function crypt() { var key = document.getElementById("key").value; var enc = sjcl.encrypt(key,document.getElementById("form_content").value); document.getElementById("form_content").value = enc; } function uncrypt() { var key = document.getElementById("key").value; if( document.getElementById("form_content") ){ var clearTxt = sjcl.decrypt(key,document.getElementById("form_content").value); document.getElementById("form_content").value = clearTxt; }else{ var clearTxt = sjcl.decrypt(key,document.getElementById("content").innerHTML); document.getElementById("content").innerHTML = clearTxt; } } function ready(){ document.getElementById("showOptions").addEventListener("click",showHideMenu); if(document.getElementById("buttonCrypt")){ document.getElementById("buttonCrypt").addEventListener("click",crypt); } document.getElementById("buttonUncrypt").addEventListener("click",uncrypt); }