From bdb65f4e5b44533402087235cb98b30524f2dac5 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Fri, 13 Oct 2017 15:08:55 +0200 Subject: [PATCH] =?utf8?q?Javascript-Code=20=C3=BCberarbeitet.=20Scheint?= =?utf8?q?=20jetzt=20zu=20funktionieren.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/secret.html | 88 ++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 41 deletions(-) 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