From: Stephan Richter Date: Fri, 13 Oct 2017 13:08:55 +0000 (+0200) Subject: Javascript-Code überarbeitet. Scheint jetzt zu funktionieren. X-Git-Url: https://fpunktk.de/gitweb/?a=commitdiff_plain;h=bdb65f4e5b44533402087235cb98b30524f2dac5;p=shamirs_secret_web_implementation.git Javascript-Code überarbeitet. Scheint jetzt zu funktionieren. --- diff --git a/src/secret.html b/src/secret.html index dd2a677..324cf45 100644 --- a/src/secret.html +++ b/src/secret.html @@ -80,35 +80,27 @@ function split(number, number_of_shares, needed) { return shares; } -function share(index,string){ - this.index=index; - this.codes=string.split(' '); - this.codeCount=function(){return this.codes.length}; - this.code=function(i){return this.codes[i];}; - this.pick=function(i){return [this.index,this.codes[i]]}; - this.string=function(){ - return 'Share '+this.index+': '+this.codes.join(' / '); - }; -} - function collect(){ var divs=document.getElementsByClassName('share'); - var shares=[],lastValue,div,inputs,num; - for (i=0; i0 && lastValue!='') shares[i]=new share(num,lastValue); + string=input.value; + if (share_number>0 && string!='') { + var parts = string.split(' '); + shares[div_index] = { share_number, parts }; + } } } - } - if (lastValue!=''){ + } + if (string!=''){ var clone=div.cloneNode(true); var inputs=clone.getElementsByTagName('input'); for (var j=0; j