mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Emscripten: change the localStorage key used for preferences.
I picked pathname + "#preferences" because Ben suggested either that or pathname + "/preferences", and I thought the former sounded neater. But Ben now suggests that it might be better to avoid using # in the key, just in case anyone should later want to use the whole URL _including_ the fragment ID as the key for some other localStorage usage - for example, autosaved progress per puzzle _instance_, keying off the puzzle URL with a fragment ID in the game description. So, per Ben's replacement suggestion, change the "#" to a space.
This commit is contained in:
@ -801,7 +801,7 @@ mergeInto(LibraryManager.library, {
|
|||||||
*/
|
*/
|
||||||
js_save_prefs: function(buf) {
|
js_save_prefs: function(buf) {
|
||||||
var prefsdata = UTF8ToString(buf);
|
var prefsdata = UTF8ToString(buf);
|
||||||
localStorage.setItem(location.pathname + "#preferences", prefsdata);
|
localStorage.setItem(location.pathname + " preferences", prefsdata);
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -811,7 +811,7 @@ mergeInto(LibraryManager.library, {
|
|||||||
* pass it back in as a string, via prefs_load_callback.
|
* pass it back in as a string, via prefs_load_callback.
|
||||||
*/
|
*/
|
||||||
js_load_prefs: function(me) {
|
js_load_prefs: function(me) {
|
||||||
var prefsdata = localStorage.getItem(location.pathname+"#preferences");
|
var prefsdata = localStorage.getItem(location.pathname+" preferences");
|
||||||
if (prefsdata !== undefined && prefsdata !== null) {
|
if (prefsdata !== undefined && prefsdata !== null) {
|
||||||
prefs_load_callback(me, prefsdata);
|
prefs_load_callback(me, prefsdata);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user