Skip to content

Commit

Permalink
IA7 v1.5.700 - cookie support for notification preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
hplato committed Aug 12, 2017
1 parent 7c42218 commit 49aa421
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web/ia7/house/main.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<div class='col-sm-12 col-sm-offset-0 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2'>
<div class='col-sm-12'>
<p class="text-muted"><small> MisterHouse was created by Bruce Winter. Ron Klinkien developed the v2.3 web interface. Kevin Robert Keegan
designed the IA7 web prototype, updates by H.Plato. IA7 v1.5.670 Font Awesome by Dave Gandy - http://fontawesome.io</small></p>
designed the IA7 web prototype, updates by H.Plato. IA7 v1.5.700 Font Awesome by Dave Gandy - http://fontawesome.io</small></p>
</div>
</div>
</div>
Expand Down
23 changes: 22 additions & 1 deletion web/ia7/include/javascript.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// v1.5.670
// v1.5.700

var entity_store = {}; //global storage of entities
var json_store = {};
Expand Down Expand Up @@ -175,6 +175,25 @@ function changePage (){
} else {
notifications = "enabled";
}
//cookies override default config.
//TODO use_cookies option
if (json_store.ia7_config.prefs.use_cookies == undefined || (json_store.ia7_config.prefs.use_cookies !== undefined && json_store.ia7_config.prefs.use_cookies == "yes")) {
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for (var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf("speech_sound") == 0) {
speech_sound = c.substring(13, c.length);
}
if (c.indexOf("speech_banner") == 0) {
speech_banner = c.substring(14, c.length);
}
}
}

}
if (getJSONDataByPath("collections") === undefined){
// We need at minimum the basic collections data to render all pages
Expand Down Expand Up @@ -3343,6 +3362,8 @@ $(document).ready(function() {
$('.mhnotifyoff').removeClass('active');
if ((speech_banner === "no") && (speech_sound === "no")) $('.mhnotifyoff').addClass('active');
}
document.cookie = "speech_sound="+speech_sound;
document.cookie = "speech_banner="+speech_banner;
//if off, then unselect others
});
// parse the collection ID 500 and build a list of buttons
Expand Down

0 comments on commit 49aa421

Please sign in to comment.