@@ -166,12 +166,12 @@ function redirectToMainDomain() {
166166 const target = mainDomainUrl + window . location . pathname ;
167167 if ( window !== top ) {
168168 try {
169- top . location . href = target
169+ top . location . href = target ;
170170 } catch {
171171 try {
172- parent . location . href = target
172+ parent . location . href = target ;
173173 } catch {
174- window . location . href = target
174+ window . location . href = target ;
175175 }
176176 }
177177 } else window . location . href = mainDomainUrl + window . location . pathname ;
@@ -375,17 +375,17 @@ function randRange(min, max) {
375375
376376function exportSaveData ( ) {
377377 function getCookies ( ) {
378- let cookies = document . cookie . split ( '; ' ) ;
379- let cookieObj = { } ;
378+ const cookies = document . cookie . split ( "; " ) ;
379+ const cookieObj = { } ;
380380 cookies . forEach ( cookie => {
381- let [ name , value ] = cookie . split ( '=' ) ;
381+ const [ name , value ] = cookie . split ( "=" ) ;
382382 cookieObj [ name ] = value ;
383383 } ) ;
384384 return cookieObj ;
385385 }
386386 function getLocalStorage ( ) {
387- let localStorageObj = { } ;
388- for ( let key in localStorage ) {
387+ const localStorageObj = { } ;
388+ for ( const key in localStorage ) {
389389 if ( localStorage . hasOwnProperty ( key ) ) {
390390 localStorageObj [ key ] = localStorage . getItem ( key ) ;
391391 }
@@ -394,29 +394,29 @@ function exportSaveData() {
394394 }
395395 const data = {
396396 cookies : getCookies ( ) ,
397- localStorage : getLocalStorage ( )
397+ localStorage : getLocalStorage ( ) ,
398398 } ;
399399 const dataStr = JSON . stringify ( data , null , 2 ) ;
400- const blob = new Blob ( [ dataStr ] , { type : ' application/json' } ) ;
400+ const blob = new Blob ( [ dataStr ] , { type : " application/json" } ) ;
401401 const url = URL . createObjectURL ( blob ) ;
402- const a = document . createElement ( 'a' ) ;
402+ const a = document . createElement ( "a" ) ;
403403 a . href = url ;
404- a . download = ' save_data.json' ;
404+ a . download = " save_data.json" ;
405405 document . body . appendChild ( a ) ;
406406 a . click ( ) ;
407407 document . body . removeChild ( a ) ;
408408 URL . revokeObjectURL ( url ) ;
409409}
410410
411411function importSaveData ( ) {
412- const input = document . createElement ( ' input' ) ;
413- input . type = ' file' ;
414- input . accept = ' application/json' ;
415- input . onchange = function ( event ) {
412+ const input = document . createElement ( " input" ) ;
413+ input . type = " file" ;
414+ input . accept = " application/json" ;
415+ input . onchange = event => {
416416 const file = event . target . files [ 0 ] ;
417417 if ( ! file ) return ;
418418 const reader = new FileReader ( ) ;
419- reader . onload = function ( e ) {
419+ reader . onload = e => {
420420 try {
421421 const data = JSON . parse ( e . target . result ) ;
422422 if ( data . cookies ) {
@@ -429,14 +429,15 @@ function importSaveData() {
429429 localStorage . setItem ( key , value ) ;
430430 } ) ;
431431 }
432- alert ( 'Your save data has been imported. Please test it out.' )
433- alert ( 'If you find any issues then report it in GitHub or the Interstellar Discord.' )
432+ alert ( "Your save data has been imported. Please test it out." ) ;
433+ alert (
434+ "If you find any issues then report it in GitHub or the Interstellar Discord." ,
435+ ) ;
434436 } catch ( error ) {
435- console . error ( ' Error parsing JSON file:' , error ) ;
437+ console . error ( " Error parsing JSON file:" , error ) ;
436438 }
437439 } ;
438440 reader . readAsText ( file ) ;
439441 } ;
440442 input . click ( ) ;
441443}
442-
0 commit comments