File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ <h1 style="margin-left: auto;margin-right: auto;">Available Dev Container Featur
5757 const collectionTable = document . getElementById ( 'collectionTable' ) ;
5858 const rows = collectionTable . getElementsByTagName ( 'tr' ) ;
5959
60- searchInput . addEventListener ( 'input' , function ( ) {
60+ function performSearch ( ) {
6161 const searchValue = searchInput . value . toLowerCase ( ) ;
6262
6363 for ( let i = 1 ; i < rows . length ; i ++ ) {
@@ -71,5 +71,24 @@ <h1 style="margin-left: auto;margin-right: auto;">Available Dev Container Featur
7171 rows [ i ] . style . display = 'none' ;
7272 }
7373 }
74+ }
75+
76+ searchInput . addEventListener ( 'input' , function ( ) {
77+ performSearch ( ) ;
78+ const url = new URL ( window . location ) ;
79+ if ( searchInput . value ) {
80+ url . searchParams . set ( 'search' , searchInput . value ) ;
81+ } else {
82+ url . searchParams . delete ( 'search' ) ;
83+ }
84+ window . history . replaceState ( { } , '' , url ) ;
7485 } ) ;
86+
87+ // Read search parameter from URL on page load
88+ const urlParams = new URLSearchParams ( window . location . search ) ;
89+ const searchParam = urlParams . get ( 'search' ) ;
90+ if ( searchParam ) {
91+ searchInput . value = searchParam ;
92+ performSearch ( ) ;
93+ }
7594</ script >
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ <h1 style="margin-left: auto;margin-right: auto;">Available Dev Container Templa
5353 const collectionTable = document . getElementById ( 'collectionTable' ) ;
5454 const rows = collectionTable . getElementsByTagName ( 'tr' ) ;
5555
56- searchInput . addEventListener ( 'input' , function ( ) {
56+ function performSearch ( ) {
5757 const searchValue = searchInput . value . toLowerCase ( ) ;
5858
5959 for ( let i = 1 ; i < rows . length ; i ++ ) {
@@ -66,5 +66,24 @@ <h1 style="margin-left: auto;margin-right: auto;">Available Dev Container Templa
6666 rows [ i ] . style . display = 'none' ;
6767 }
6868 }
69+ }
70+
71+ searchInput . addEventListener ( 'input' , function ( ) {
72+ performSearch ( ) ;
73+ const url = new URL ( window . location ) ;
74+ if ( searchInput . value ) {
75+ url . searchParams . set ( 'search' , searchInput . value ) ;
76+ } else {
77+ url . searchParams . delete ( 'search' ) ;
78+ }
79+ window . history . replaceState ( { } , '' , url ) ;
6980 } ) ;
81+
82+ // Read search parameter from URL on page load
83+ const urlParams = new URLSearchParams ( window . location . search ) ;
84+ const searchParam = urlParams . get ( 'search' ) ;
85+ if ( searchParam ) {
86+ searchInput . value = searchParam ;
87+ performSearch ( ) ;
88+ }
7089</ script >
You can’t perform that action at this time.
0 commit comments