File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed
Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1010 <header >
1111 <h1 >I-ADOPT Variable Examples</h1 >
1212 <p >Your resource for modelled I-ADOPT variables with concepts from different terminologies.</p >
13+
14+ <input type =" text" placeholder =" Filter Variables ..." id =" filter" autocomplete =" off" />
15+ <script src =" ./script.js" ></script >
1316 </header >
1417
1518 <main >
Original file line number Diff line number Diff line change 1+ ( function ( ) {
2+
3+ // schedule update of filter
4+ let filterTimer = null ;
5+ document . querySelector ( '#filter' )
6+ ?. addEventListener ( 'input' , ( ) => {
7+ if ( filterTimer ) {
8+ clearTimeout ( filterTimer ) ;
9+ }
10+ filterTimer = setTimeout ( triggerFilter , 200 ) ;
11+ } ) ;
12+
13+
14+ function triggerFilter ( ) {
15+
16+ // get filter term
17+ const term = document . querySelector ( '#filter' ) ?. value || null ;
18+
19+ for ( const entry of document . querySelectorAll ( '.variable-item' ) ) {
20+
21+ if ( term ) {
22+
23+ // only show, if filter term is included
24+ if ( ! entry . textContent ?. includes ( term ) ) {
25+ entry . classList . add ( 'hidden' ) ;
26+ } else {
27+ entry . classList . remove ( 'hidden' ) ;
28+ }
29+
30+ } else {
31+
32+ // if no filter term is set, show all entries
33+ entry . classList . remove ( 'hidden' ) ;
34+
35+ }
36+ }
37+ }
38+
39+ } ) ( ) ;
Original file line number Diff line number Diff line change 2929 color : # 333 ;
3030 line-height : 1.6 ;
3131 display : grid;
32- grid-template-rows : 170 px calc ( 100% - 230 px ) 60px ;
32+ grid-template-rows : 190 px calc ( 100% - 250 px ) 60px ;
3333 grid-template-areas : "top" "center" "bottom" ;
3434}
3535
@@ -107,3 +107,11 @@ footer {
107107 width : 80vw ;
108108 height : 50vh ;
109109}
110+
111+ # filter {
112+ width : 20em ;
113+ max-width : 80% ;
114+ }
115+ .hidden {
116+ display : none;
117+ }
You can’t perform that action at this time.
0 commit comments