]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Various fixes for running with advanced JS optimizations, if we want to do that in...
[remoteglot] / www / js / remoteglot.js
index beaf63f74f1bfcba4437c3e4a6ca94aa30a91736..f252f5b3a1b903a3af605e4df58e4196c8430b45 100644 (file)
@@ -244,12 +244,12 @@ var supports_html5_storage = function() {
 // Of course, you can never fully protect against people deliberately wanting to spam.
 var get_unique = function() {
        var use_local_storage = supports_html5_storage();
-       if (use_local_storage && localStorage['unique']) {
-               return localStorage['unique'];
+       if (use_local_storage && window['localStorage']['unique']) {
+               return window['localStorage']['unique'];
        }
        var unique = Math.random();
        if (use_local_storage) {
-               localStorage['unique'] = unique;
+               window['localStorage']['unique'] = unique;
        }
        return unique;
 }
@@ -1971,7 +1971,7 @@ var set_sound = function(param_enable_sound) {
                document.getElementById("soundoff").innerHTML = "<strong>Off</strong>";
        }
        if (supports_html5_storage()) {
-               localStorage['enable_sound'] = enable_sound ? 1 : 0;
+               window['localStorage']['enable_sound'] = enable_sound ? 1 : 0;
        }
 }
 window['set_sound'] = set_sound;
@@ -2414,8 +2414,8 @@ var init = function() {
        unique = get_unique();
 
        // Load settings from HTML5 local storage if available.
-       if (supports_html5_storage() && localStorage['enable_sound']) {
-               set_sound(parseInt(localStorage['enable_sound']));
+       if (supports_html5_storage() && window['localStorage']['enable_sound']) {
+               set_sound(parseInt(window['localStorage']['enable_sound']));
        } else {
                set_sound(false);
        }