register OK

This commit is contained in:
Gnieark 2019-12-27 11:14:05 +01:00
parent be6618588b
commit d0a7b38d86

View File

@ -1,5 +1,4 @@
function showHideMenu() function showHideMenu(){
{
var doc = document.getElementById("moreoptions"); var doc = document.getElementById("moreoptions");
if(doc.className == "hidden-by-default") if(doc.className == "hidden-by-default")
{ {
@ -8,6 +7,7 @@ function showHideMenu()
doc.className = "hidden-by-default"; doc.className = "hidden-by-default";
} }
} }
function truncateCryptFields(){ function truncateCryptFields(){
getEncFieldsListIntegers().forEach( element=> { getEncFieldsListIntegers().forEach( element=> {
document.getElementById("form_crypt_" + element).value = ""; document.getElementById("form_crypt_" + element).value = "";
@ -19,11 +19,12 @@ function truncateCryptFields(){
function getEncFieldsListStrings(){ function getEncFieldsListStrings(){
return ['iv','mode','adata','cipher','salt']; return ['iv','mode','adata','cipher','salt'];
} }
function getEncFieldsListIntegers(){ function getEncFieldsListIntegers(){
return ['v','iter','ks','ts']; return ['v','iter','ks','ts'];
} }
function crypt()
{ function crypt(){
var key = document.getElementById("key").value; var key = document.getElementById("key").value;
var enc = JSON.parse(sjcl.encrypt(key,document.getElementById("form_content").value)); var enc = JSON.parse(sjcl.encrypt(key,document.getElementById("form_content").value));
var encFields = getEncFieldsListStrings(); var encFields = getEncFieldsListStrings();
@ -38,10 +39,7 @@ function crypt()
document.getElementById("form_content").value = enc["ct"]; document.getElementById("form_content").value = enc["ct"];
} }
function uncrypt(){
function uncrypt()
{
var key = document.getElementById("key").value; var key = document.getElementById("key").value;
if( document.getElementById("form_content") ){ if( document.getElementById("form_content") ){
@ -80,6 +78,7 @@ function uncrypt()
} }
} }
} }
function ready(){ function ready(){
document.getElementById("showOptions").addEventListener("click",showHideMenu); document.getElementById("showOptions").addEventListener("click",showHideMenu);
if(document.getElementById("buttonCrypt")){ if(document.getElementById("buttonCrypt")){