Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

check if cookies are disabled #261

Open
belst opened this issue Mar 10, 2018 · 2 comments
Open

check if cookies are disabled #261

belst opened this issue Mar 10, 2018 · 2 comments

Comments

@belst
Copy link
Contributor

belst commented Mar 10, 2018

if cookies are disabled remove localStorage options.

@GottZ
Copy link
Contributor

GottZ commented Mar 10, 2018

effects everything that concerns access to localStorage (causing a uncaught exception preventing further script execution in theese browsers)
this includes: background and volume (don't know if there is more)
navigator.cookieEnabled should be checked before trying to access localStorage. (even when trying to read from it)

best solution:
wrapping localStorage into our own setter / getter for settings.

@GottZ
Copy link
Contributor

GottZ commented Mar 15, 2018

if (typeof localStorage != "undefined") {
this.volume(Math.abs(localStorage.getItem("volume") || 0.3));
// 1/x to detect the special case of -0 for saving volume level 0 and the mute button being activated
this.muted(0 > 1/(localStorage.getItem("volume") || 0.3));
this.on("volumechange", function () {
localStorage.setItem("volume", (this.volume() * (this.muted() ? -1 : 1)));

if(localStorage.getItem('background') == undefined) {
if($.browser.mobile)
localStorage.setItem('background', 'false');
else
localStorage.setItem('background', 'true');
}
var background = localStorage.getItem('background') === 'true';

localStorage.setItem('background', background.toString());

$(".aside").fadeToggle(localStorage.comments = !(localStorage.comments == "true"));

var comments = localStorage.comments;
if (comments === undefined) localStorage.comments = true;
comments = comments === undefined || comments === "true";
$(".aside").toggle(comments);
$("#toggle").click(function(){$(".aside").fadeToggle(localStorage.comments = !(localStorage.comments == "true"))});

@jkhsjdhjs woop woop. we probably just need a custom storage object that deals with localStorage and otherwise displays notifications

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants