@@ -305,7 +305,7 @@ <h3 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"></h3>
305305 }
306306
307307 function getBrowser ( ) {
308- const ua = navigator . userAgent ;
308+ const agent = navigator . userAgent ;
309309 if ( ( agent . indexOf ( "Opera" ) || agent . indexOf ( 'OPR' ) ) != - 1 ) return 'Opera' ;
310310 if ( agent . indexOf ( "Edg" ) != - 1 ) return 'Edge' ;
311311 if ( agent . indexOf ( "Vivaldi" ) != - 1 ) return 'Vivaldi' ;
@@ -318,15 +318,17 @@ <h3 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"></h3>
318318
319319 function initDonwloadButton ( ) {
320320 const downloadBtn = document . getElementById ( 'browser' )
321- downloadBtn ? .innerText = getBrowser ( ) ;
321+ if ( downloadBtn ) downloadBtn . innerText = getBrowser ( ) ;
322322 }
323323
324324 function initModal ( ) {
325325 const modal = document . getElementById ( 'modal' ) ;
326- modal ? .addEventListener ( 'click' , ( event ) => {
326+ if ( modal ) modal . addEventListener ( 'click' , ( event ) => {
327327 if ( event . target === modal ) modal . close ( ) ;
328328 } ) ;
329- modal ?. querySelector ( '.btn-close' ) ?. addEventListener ( 'click' , modal . close ( ) ) ;
329+ if ( modal ) modal . querySelector ( '.btn-close' ) ?. addEventListener ( 'click' , ( event ) => {
330+ modal . close ( ) ;
331+ } ) ;
330332 }
331333
332334 function toggleGalery ( idx ) {
@@ -337,7 +339,7 @@ <h3 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"></h3>
337339 }
338340
339341 const modal = document . getElementById ( 'modal' ) ;
340- modal ? .showModal ( ) ;
342+ if ( modal ) modal . showModal ( ) ;
341343 }
342344
343345 document . addEventListener ( 'DOMContentLoaded' , ( evt ) => {
0 commit comments