Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Bug 738399: Display a warning message when localStorage (cookies) is …
Browse files Browse the repository at this point in the history
…disabled
  • Loading branch information
glecollinet committed Mar 23, 2012
1 parent 8d5bc6a commit 943aead
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions client/css/main.css
Expand Up @@ -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;}
Expand Down Expand Up @@ -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';}
12 changes: 10 additions & 2 deletions client/index.html
Expand Up @@ -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>
Expand Down Expand Up @@ -337,7 +337,15 @@ <h1>
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>
Expand Down
4 changes: 2 additions & 2 deletions client/js/lib/modernizr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/js/storage.js
Expand Up @@ -31,7 +31,7 @@ define(function() {
},

hasLocalStorage: function() {
return window.localStorage && window.localStorage !== null;
return Modernizr.localstorage;
},

save: function() {
Expand Down

0 comments on commit 943aead

Please sign in to comment.