File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ Note: _The order of this list might not match the order these features will be a
6666
6767_ Release date: ???????????????????????_
6868
69- _ Work Time: 4h _
69+ _ Work Time: 5h _
7070
7171-
7272
Original file line number Diff line number Diff line change @@ -224,4 +224,33 @@ editor.addEventListener('keyup', function (event) {
224224 // press 'Enter' to act as pressing the button
225225 if ( event . key == 'Enter' ) button . click ( ) ;
226226 }
227- } ) ;
227+ } ) ;
228+
229+ // check for errors while typing
230+ textfield . addEventListener ( 'input' , checkErrors ) ;
231+
232+ function checkErrors ( event ) {
233+ var inp = event . target . value . toString ( ) ;
234+
235+ // check allowed characters => 0123456789.+-*/()
236+ var test = inp . match ( / [ 0 - 9 | \+ | \- | \* | \/ | ( | ) | \. ] + / ) ;
237+ if ( ! test ) test = [ "" ] ;
238+
239+ // if length of input = characters matched expression is valid
240+ if ( inp . length === test [ 0 ] . length ) {
241+ button . disabled = false ;
242+ showIcon ( 0 ) ;
243+ } else {
244+ button . disabled = true ;
245+ showIcon ( 1 ) ;
246+ }
247+
248+ function showIcon ( index ) {
249+ icons . forEach ( e => e . classList . add ( 'invisible' ) ) ;
250+ icons [ index ] . classList . remove ( 'invisible' ) ;
251+ }
252+
253+ // check if parentheses match
254+
255+ }
256+
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ <h4>Expression editor</h4>
129129 < p class ="big ">
130130 < span id ="var "> D</ span >
131131 < span > =</ span >
132- < input type ="text " name ="expression " id ="expression " placeholder ="e.g.: 6+(25/2) ">
132+ < input type ="text " name ="expression " id ="expression " placeholder ="0 ">
133133 < span > =</ span >
134134 < span id ="result ">
135135 < num > 0</ num >
Original file line number Diff line number Diff line change @@ -80,6 +80,15 @@ close:hover {
8080 border-color : var (--color-1 );
8181}
8282
83+ .popup button : disabled ,
84+ .popup button : disabled : hover {
85+ border-color : var (--color-2 );
86+ color : var (--color-2 );
87+ background-color : transparent;
88+ opacity : 50% ;
89+ cursor : default;
90+ }
91+
8392.popup button i {
8493 margin-right : 1ch ;
8594}
You can’t perform that action at this time.
0 commit comments