Permalink
Browse files

Bug 738399: Display a warning message when localStorage (cookies) is …

…disabled
  • Loading branch information...
1 parent 8d5bc6a commit 943aeada165072208133ae1410581df612e3997f @glecollinet glecollinet committed Mar 23, 2012
Showing with 15 additions and 7 deletions.
  1. +2 −2 client/css/main.css
  2. +10 −2 client/index.html
  3. +2 −2 client/js/lib/modernizr.js
  4. +1 −1 client/js/storage.js
View
@@ -245,7 +245,7 @@ footer, header, hgroup, menu, nav, section {
.bubble {background:rgba(45,45,45,0.8);padding:0px 12px 0px 12px;border-radius:8px;color:rgba(255,255,255,0.8);display:inline-block;text-align:center;position:absolute;}
.thingy {height:10px;width:11px;background:url('../img/common/thingy.png');margin:0 auto;margin-top:-10px;top:10px;position:relative;}
- #noscript {height:50px;background:#d83939;width:100%;color:#eee;font-size:20px;font-family:'GraphicPixel', arial, sans-serif;text-align:center;line-height:50px;border-bottom:1px solid #000;}
+ .alert {height:50px;background:#d83939;width:100%;color:#eee;font-size:20px;font-family:'GraphicPixel', arial, sans-serif;text-align:center;line-height:50px;border-bottom:1px solid #000;}
#instructions, #achievements, #lists, #about, #credits, .ribbon, .play, .play div, .barbutton {-webkit-tap-highlight-color:transparent;}
#nameinput::-webkit-input-placeholder {color:#fff;}
@@ -1220,4 +1220,4 @@ footer, header, hgroup, menu, nav, section {
.windows #parchment, .windows #parchment input, .windows #notifications, .windows #instructions, .windows #achievements, .windows #achievement-notification,
.windows #playercount, .windows #credits, .windows #loadcharacter, .windows #confirmation, .windows #death, .windows #error, .windows #about,
- .windows #parchment p, .windows #portrait p, .windows #noscript, .windows footer, .windows .bubble p, .windows #population {font-family:'AdvoCut';}
+ .windows #parchment p, .windows #portrait p, .windows .alert, .windows footer, .windows .bubble p, .windows #population {font-family:'AdvoCut';}
View
@@ -44,7 +44,7 @@
<![endif]-->
<body class="intro">
<noscript>
- <div id="noscript">
+ <div class="alert">
You need to enable JavaScript to play BrowserQuest.
</div>
</noscript>
@@ -337,7 +337,15 @@ <h1 id="logo">
document.querySelector('body').className += ' upscaled';
}
- if(localStorage && localStorage.data) {
+ if(!Modernizr.localstorage) {
+ var alert = document.createElement("div");
+ alert.className = 'alert';
+ alertMsg = document.createTextNode("You need to enable cookies/localStorage to play BrowserQuest");
+ alert.appendChild(alertMsg);
+
+ target = document.getElementById("intro");
+ document.body.insertBefore(alert, target);
+ } else if(localStorage && localStorage.data) {
parchment.className = "loadcharacter";
}
</script>
Oops, something went wrong.
View
@@ -31,7 +31,7 @@ define(function() {
},
hasLocalStorage: function() {
- return window.localStorage && window.localStorage !== null;
+ return Modernizr.localstorage;
},
save: function() {

0 comments on commit 943aead

Please sign in to comment.