33< head >
44 < meta charset ="utf-8 ">
55 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
6-
6+ < meta name =" google-site-verification " content =" lHnx1da1HDG8GdJsF8kVUQLEwOoPD5k5wfWTtEwhYAs " />
77 < meta name ="description " content ="A clean, intuitive browser extension that gives you one-click access to all your bookmarks, reading lists, browsing history, and tab groups on the new tab page. ">
88 < meta name ="author " content ="Gelencsér Gergő ">
99 < title > Quick Access</ title >
@@ -218,7 +218,7 @@ <h3 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"></h3>
218218 </ div >
219219
220220 < dialog id ="modal " class ="position-fixed border-0 p-0 mx-5 rounded-3 shadow-lg " role ="dialog ">
221- < button type ="submit " class ="btn-close position-absolute " formmethod =" dialog " style ="top: 5px; right: 5px; width: 37px; height: 37px; z-index: 999; opacity: 0.7; background-color: white; " autofocus aria-label ="close "> </ button >
221+ < button type ="button " class ="btn-close position-absolute " style ="top: 5px; right: 5px; width: 37px; height: 37px; z-index: 999; opacity: 0.7; background-color: white; " autofocus aria-label ="close "> </ button >
222222 < div id ="galery " class ="carousel carousel-fade slide " data-bs-ride ="carousel ">
223223 < div class ="carousel-indicators ">
224224 < button type ="button " data-bs-target ="#galery " data-bs-slide-to ="0 " aria-label ="Screenshot 1 " class ="active " aria-current ="true "> </ button >
@@ -292,37 +292,42 @@ <h3 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"></h3>
292292
293293 < script src ="bootstrap.bundle.min.js "> </ script >
294294 < script >
295- document . addEventListener ( 'DOMContentLoaded' , ( evt ) => {
295+ function initColorTheme ( ) {
296296 const colorScheme = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
297297
298298 const updateTheme = ( ) => {
299299 const colorMode = colorScheme . matches ? "dark" : "light" ;
300300 document . querySelector ( "html" ) . setAttribute ( "data-bs-theme" , colorMode ) ;
301301 }
302+
302303 colorScheme . addEventListener ( 'change' , updateTheme ) ;
303304 updateTheme ( ) ;
305+ }
304306
305- const getBrowser = ( ) => {
306- const ua = navigator . userAgent ;
307- if ( ( agent . indexOf ( "Opera" ) || agent . indexOf ( 'OPR' ) ) != - 1 ) return 'Opera' ;
308- if ( agent . indexOf ( "Edg" ) != - 1 ) return 'Edge' ;
309- if ( agent . indexOf ( "Vivaldi" ) != - 1 ) return 'Vivaldi' ;
310- if ( agent . indexOf ( "Brave" ) != - 1 ) return 'Brave' ;
311- if ( agent . indexOf ( "Chrome" ) != - 1 ) return 'Chrome' ;
312- if ( agent . indexOf ( "Firefox" ) != - 1 ) return 'Firefox' ;
313- if ( agent . indexOf ( "Safari" ) != - 1 ) return 'Safari' ;
314- return 'Browser' ;
315- }
307+ function getBrowser ( ) {
308+ const ua = navigator . userAgent ;
309+ if ( ( agent . indexOf ( "Opera" ) || agent . indexOf ( 'OPR' ) ) != - 1 ) return 'Opera' ;
310+ if ( agent . indexOf ( "Edg" ) != - 1 ) return 'Edge' ;
311+ if ( agent . indexOf ( "Vivaldi" ) != - 1 ) return 'Vivaldi' ;
312+ if ( agent . indexOf ( "Brave" ) != - 1 ) return 'Brave' ;
313+ if ( agent . indexOf ( "Chrome" ) != - 1 ) return 'Chrome' ;
314+ if ( agent . indexOf ( "Firefox" ) != - 1 ) return 'Firefox' ;
315+ if ( agent . indexOf ( "Safari" ) != - 1 ) return 'Safari' ;
316+ return 'Browser' ;
317+ }
318+
319+ function initDonwloadButton ( ) {
316320 const downloadBtn = document . getElementById ( 'browser' )
317- if ( downloadBtn ) downloadBtn . innerText = getBrowser ( ) ;
321+ downloadBtn ?. innerText = getBrowser ( ) ;
322+ }
318323
324+ function initModal ( ) {
319325 const modal = document . getElementById ( 'modal' ) ;
320- if ( modal ) {
321- modal . addEventListener ( 'click' , ( event ) => {
322- if ( event . target === modal ) modal . close ( ) ;
323- } ) ;
324- }
325- } ) ;
326+ modal ?. addEventListener ( 'click' , ( event ) => {
327+ if ( event . target === modal ) modal . close ( ) ;
328+ } ) ;
329+ modal ?. querySelector ( '.btn-close' ) ?. addEventListener ( 'click' , modal . close ( ) ) ;
330+ }
326331
327332 function toggleGalery ( idx ) {
328333 const galery = document . getElementById ( 'galery' ) ;
@@ -332,10 +337,14 @@ <h3 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"></h3>
332337 }
333338
334339 const modal = document . getElementById ( 'modal' ) ;
335- if ( modal ) {
336- modal . showModal ( ) ;
337- }
340+ modal ?. showModal ( ) ;
338341 }
342+
343+ document . addEventListener ( 'DOMContentLoaded' , ( evt ) => {
344+ initColorTheme ( ) ;
345+ initDonwloadButton ( ) ;
346+ initModal ( ) ;
347+ } ) ;
339348 </ script >
340349</ body >
341350</ html >
0 commit comments