File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ <h1>YouTube Thumbnail Viewer</h1>
101101 this . nextElementSibling . textContent = `Width: ${ this . naturalWidth } px` ;
102102 }
103103 } ) ;
104+
105+ // Update URL
106+ updateURL ( input ) ;
104107 }
105108 }
106109
@@ -115,6 +118,24 @@ <h1>YouTube Thumbnail Viewer</h1>
115118 console . error ( 'Failed to copy: ' , err ) ;
116119 } ) ;
117120 }
121+
122+ function updateURL ( input ) {
123+ const url = new URL ( window . location ) ;
124+ url . searchParams . set ( 'url' , input ) ;
125+ window . history . pushState ( { } , '' , url ) ;
126+ }
127+
128+ function loadFromURL ( ) {
129+ const urlParams = new URLSearchParams ( window . location . search ) ;
130+ const urlValue = urlParams . get ( 'url' ) ;
131+ if ( urlValue ) {
132+ document . getElementById ( "videoInput" ) . value = urlValue ;
133+ updateThumbnails ( ) ;
134+ }
135+ }
136+
137+ // Call loadFromURL when the page loads
138+ window . onload = loadFromURL ;
118139 </ script >
119140
120141</ body >
You can’t perform that action at this time.
0 commit comments