diff --git a/js/id/id.js b/js/id/id.js index a5b7451ea..ab41ab73d 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -8,11 +8,14 @@ window.iD = function () { // https://github.com/systemed/iD/issues/772 // http://mathiasbynens.be/notes/localstorage-pattern#comment-9 try { storage = localStorage; } catch (e) {} - storage = storage || { - getItem: function() {}, - setItem: function() {}, - removeItem: function() {} - }; + storage = storage || (function() { + var s = {}; + return { + getItem: function(k) { return s[k]; }, + setItem: function(k, v) { s[k] = v; }, + removeItem: function(k) { delete s[k] } + }; + })(); context.storage = function(k, v) { if (arguments.length === 1) return storage.getItem(k); diff --git a/js/id/ui/background.js b/js/id/ui/background.js index 35c29591e..f88ac2b4f 100644 --- a/js/id/ui/background.js +++ b/js/id/ui/background.js @@ -6,7 +6,7 @@ iD.ui.Background = function(context) { ['top', [0, -1]], ['right', [-1, 0]], ['bottom', [0, 1]]], - opacityDefault = (context.storage('background-opacity') !== undefined) ? + opacityDefault = (context.storage('background-opacity') != undefined) ? (+context.storage('background-opacity')) : 0.5; function background(selection) {