X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=www%2Fjs%2Fremoteglot.js;h=ac3f8e97adc6d29a08f92ed4027de9f5dac5e582;hp=cd2ffa5ccb04c548aa706cf05be73f6ad2c7c4d9;hb=80661ee7ca9f379b14dfd660362b05b7c455b7aa;hpb=1856a6b8a4c1facbb3ff1df0f240acc9d378b315
diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js
index cd2ffa5..ac3f8e9 100644
--- a/www/js/remoteglot.js
+++ b/www/js/remoteglot.js
@@ -829,6 +829,9 @@ var format_move_with_number = function(move, move_num, white_to_play) {
*/
var resort_refutation_lines = function(sort_by_score) {
sort_refutation_lines_by_score = sort_by_score;
+ if (supports_html5_storage()) {
+ localStorage['sort_refutation_lines_by_score'] = sort_by_score ? 1 : 0;
+ }
update_refutation_lines();
}
window['resort_refutation_lines'] = resort_refutation_lines;
@@ -964,12 +967,26 @@ var set_sound = function(param_enable_sound) {
$("#soundon").html("On");
$("#soundoff").html("Off");
}
+ if (supports_html5_storage()) {
+ localStorage['enable_sound'] = enable_sound ? 1 : 0;
+ }
}
window['set_sound'] = set_sound;
var init = function() {
unique = get_unique();
- set_sound(false);
+
+ // Load settings from HTML5 local storage if available.
+ if (supports_html5_storage() && localStorage['enable_sound']) {
+ set_sound(parseInt(localStorage['enable_sound']));
+ } else {
+ set_sound(false);
+ }
+ if (supports_html5_storage() && localStorage['sort_refutation_lines_by_score']) {
+ sort_refutation_lines_by_score = parseInt(localStorage['sort_refutation_lines_by_score']);
+ } else {
+ sort_refutation_lines_by_score = true;
+ }
// Create board.
board = new window.ChessBoard('board', 'start');