@@ -155,7 +155,9 @@ async function restorePrefs() {
155155 last_dialog_time : 0 ,
156156 dialogs_shown : { } , // time : type
157157 saved_sets : { } ,
158- custom_domains : { }
158+ custom_domains : {
159+ "sfgame.net" : { "set" : false }
160+ }
159161 } , storage => {
160162 prefs = storage ;
161163 document . body . style . accentColor = prefs . color ;
@@ -416,7 +418,13 @@ function get_domain(url) {
416418
417419async function enable_on_domain ( domain ) {
418420 chrome . storage . sync . get ( { "custom_domains" : { } } , storage => {
419- let custom_domains = storage . custom_domains ;
421+ const custom_domains = storage . custom_domains ;
422+ if ( ! custom_domains [ domain ] ) {
423+ if ( ! window . location . href . includes ( "?domain=" ) )
424+ window . location . href += "?domain=" + domain + "#disabled" ;
425+ return ;
426+ }
427+
420428 delete prefs . custom_domains [ domain ] [ "set" ] ;
421429 delete custom_domains [ domain ] [ "set" ] ;
422430 chrome . storage . sync . set ( { "custom_domains" : custom_domains } ) ;
@@ -428,7 +436,7 @@ async function enable_on_domain(domain) {
428436
429437async function disable_on_domain ( domain ) {
430438 chrome . storage . sync . get ( { "custom_domains" : { } } , storage => {
431- let custom_domains = storage . custom_domains ;
439+ const custom_domains = storage . custom_domains ;
432440 if ( ! custom_domains . hasOwnProperty ( domain ) ) custom_domains [ domain ] = { } ;
433441 custom_domains [ domain ] [ "set" ] = false ;
434442 chrome . storage . sync . set ( { "custom_domains" : custom_domains } ) ;
0 commit comments