add keyboard shortcuts, icons, preloading
[ppt-control.git] / settings.js
index 28078017adde2257831e2ca70ce8fbc7261c3e66..eb94f8ef49af8fc44b19e8917cd88a6ae06bb4ad 100644 (file)
@@ -25,21 +25,22 @@ function getCookie(cname) {
 }
 
 function saveSettings() {
-    settingsString = JSON.stringify({showcurrent: show_current.checked, shownext: show_next.checked});
-    console.log("Saving cookie " + settingsString);
+    settingsString = JSON.stringify({showcurrent: show_current.checked, shownext: show_next.checked, enable_shortcuts: shortcuts.checked});
     setCookie(COOKIENAME, settingsString, COOKIEEXP);
 }
 
 function initSettings() {
-    console.log("Retrieving cookie");
     if (getCookie(COOKIENAME) == 0) {
-        console.log("No cookie found - setting new cookie");
+               if (window.obssstudio) {
+                       shortcuts.checked = False;
+                       show_current.checked = False;
+               }
         saveSettings()
     } else {
         cookie = JSON.parse(getCookie(COOKIENAME));
-        console.log("Found cookie " + cookie);
         show_current.checked = cookie.showcurrent;
         show_next.checked = cookie.shownext;
+        shortcuts.checked = cookie.enable_shortcuts;
         sync_current();
         sync_next();
     }