175175 {width : 120px ;padding : 5px 20px }
176176
177177 # result
178- {border : 1px solid green ;padding : 5px 10px ;width : 100px }
178+ {border : 1px solid lightgray ;padding : 5px 10px ;width : 100px ; border-radius : 8 px ; text-align : center }
179179
180180 # keys-root
181181 {display : flex;height : 200px ;gap : 20px }
@@ -247,7 +247,7 @@ <h1 class=visually-hidden>
247247 < div id =btns >
248248 < input value =sign type =button style ='margin-right:20px '>
249249 < input value =verify type =button style ='margin-right:10px '>
250- < div id =result style =' display:none ' > </ div >
250+ < div id =result > </ div >
251251 </ div >
252252
253253 < div id =keys-root >
@@ -315,18 +315,8 @@ <h1 class=visually-hidden>
315315 < script >
316316
317317
318- var $ = ( root , sel ) => ( ! sel && ( sel = root , root = document ) , root . querySelector ( sel ) ) ;
319- $ . style = ( node , style ) => {
320-
321- for ( var key in style ) {
322-
323- node . style [ key ] = style [ key ] ;
324-
325- } //for
326-
327- } //style
328-
329-
318+
319+
330320 var style = { } ;
331321 style . ok = {
332322 borderColor : 'green' ,
@@ -336,8 +326,17 @@ <h1 class=visually-hidden>
336326 borderColor : 'red' ,
337327 color : 'red'
338328 } ;
329+ style . apply = ( node , style ) => {
339330
340-
331+ for ( var key in style ) {
332+
333+ node . style [ key ] = style [ key ] ;
334+
335+ } //for
336+
337+ } //style
338+
339+
341340 var ui = { } ;
342341 ui . private = { } ;
343342 ui . public = { } ;
@@ -495,7 +494,7 @@ <h1 class=visually-hidden>
495494 if ( err ) {
496495 display . result ( false , 'invalid key' ) ;
497496 } else {
498- console . log ( 'verified' , verified ) ;
497+ console . log ( 'verified' , verified ) ;
499498 display . result ( verified , 'signature error' ) ;
500499 }
501500
@@ -590,10 +589,10 @@ <h1 class=visually-hidden>
590589 display . result = function ( result , msg ) {
591590
592591 if ( result ) {
593- $ . style ( ui . result , style . ok ) ;
592+ style . apply ( ui . result , style . ok ) ;
594593 ui . result . textContent = 'ok' ;
595594 } else {
596- $ . style ( ui . result , style . error ) ;
595+ style . apply ( ui . result , style . error ) ;
597596 ui . result . textContent = 'error : ' + msg ;
598597 }
599598 ui . result . style . display = 'block' ;
0 commit comments