repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 05c3347546bd79592d27f4ca2633573adb85c7c8:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 05c3347546bd79592d27f4ca2633573adb85c7c8
Author: James Baicoianu 
Date:   Wed Jan 13 01:11:54 2021 -0800

    room.cookies localStorage implementation

diff --git a/scripts/room.js b/scripts/room.js
index 91db079cc6581d1bcf95cdb37ebbc57cdf06a789..
index ..a49fd47f693e0c046309820738eaf38141e21cfb 100644
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -856,6 +856,11 @@ elation.require([
         this.properties.run_speed = room.run_speed || 5.4;
         this.properties.cursor_visible = room.cursor_visible;

+        let cookieStorageID = 'cookies.' + this.url;
+        if (cookieStorageID in localStorage) {
+          this.cookies = JSON.parse(localStorage['cookies.' + this.url]);
+        }
+
         if (room.onload) {
           this.properties.onload = room.onload;
           this.addEventListenerProxy('room_load_complete', (ev) => { let func = new Function(room.onload); func();});
@@ -1481,6 +1486,7 @@ elation.require([
     }
     this.addCookie = function(name, value) {
       this.cookies[name] = value;
+      localStorage['cookies.' + this.url] = JSON.stringify(this.cookies);
     }
     this.doScriptOnload = function() {
       if (--this.pendingScripts <= 0) {

-----END OF PAGE-----