@@ -427,6 +427,21 @@ function showTab(tabname) {
427
427
document . getElementById ( tabname ) . style . display = "inherit" ;
428
428
}
429
429
430
+ let librarySearchInput = document . querySelector ( "#searchform input" ) ;
431
+ const searchInputChangedDebounced = debounce ( function ( ) {
432
+ refreshLibrary ( { dontChangeSearchBox :true } ) ;
433
+ } , 300 ) ;
434
+ librarySearchInput . addEventListener ( 'input' , evt => {
435
+ let searchValue = evt . target . value . toLowerCase ( ) ;
436
+ // Update window URL
437
+ let c = "" ;
438
+ let searchParams = new URLSearchParams ( window . location . search ) ;
439
+ if ( searchParams . has ( "c" ) )
440
+ c = `c=${ encodeURIComponent ( searchParams . get ( "c" ) . toLowerCase ( ) ) } &` ;
441
+ window . history . replaceState ( null , null , `?${ c } q=${ encodeURIComponent ( searchValue ) } ` ) ;
442
+ searchInputChangedDebounced ( ) ;
443
+ } ) ;
444
+
430
445
// =========================================== App Info
431
446
432
447
function getAppHTML ( app , appInstalled , forInterface ) {
@@ -1174,21 +1189,6 @@ filtersContainer.addEventListener('click', ({ target }) => {
1174
1189
refreshLibrary ( ) ;
1175
1190
} ) ;
1176
1191
1177
- let librarySearchInput = document . querySelector ( "#searchform input" ) ;
1178
- const searchInputChangedDebounced = debounce ( function ( ) {
1179
- refreshLibrary ( { dontChangeSearchBox :true } ) ;
1180
- } , 300 ) ;
1181
- librarySearchInput . addEventListener ( 'input' , evt => {
1182
- let searchValue = evt . target . value . toLowerCase ( ) ;
1183
- // Update window URL
1184
- let c = "" ;
1185
- let searchParams = new URLSearchParams ( window . location . search ) ;
1186
- if ( searchParams . has ( "c" ) )
1187
- c = `c=${ encodeURIComponent ( searchParams . get ( "c" ) . toLowerCase ( ) ) } &` ;
1188
- window . history . replaceState ( null , null , `?${ c } q=${ encodeURIComponent ( searchValue ) } ` ) ;
1189
- searchInputChangedDebounced ( ) ;
1190
- } ) ;
1191
-
1192
1192
let sortContainer = document . querySelector ( "#librarycontainer .sort-nav" ) ;
1193
1193
sortContainer . addEventListener ( 'click' , ( { target } ) => {
1194
1194
if ( target . classList . contains ( 'active' ) ) return ;
0 commit comments