mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Add NG3K DXpedition calendar #17
This commit is contained in:
@@ -108,10 +108,10 @@ function saveSettings() {
|
||||
// Find all storeable UI elements, store a key of "element id:property name" mapped to the value of that
|
||||
// property. For a checkbox, that's the "checked" property.
|
||||
$(".storeable-checkbox").each(function() {
|
||||
localStorage.setItem($(this)[0].id + ":checked", $(this)[0].checked);
|
||||
localStorage.setItem("#" + $(this)[0].id + ":checked", $(this)[0].checked);
|
||||
});
|
||||
$(".storeable-select").each(function() {
|
||||
localStorage.setItem($(this)[0].id + ":value", $(this)[0].value);
|
||||
localStorage.setItem("#" + $(this)[0].id + ":value", $(this)[0].value);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -119,8 +119,10 @@ function saveSettings() {
|
||||
function loadSettings() {
|
||||
// Find all local storage entries and push their data to the corresponding UI element
|
||||
Object.keys(localStorage).forEach(function(key) {
|
||||
// Split the key back into an element ID and a property
|
||||
var split = key.split(":");
|
||||
$("#" + split[0]).prop(split[1], JSON.parse(localStorage.getItem(key)));
|
||||
if (key.startsWith("#") && key.includes(":")) {
|
||||
// Split the key back into an element ID and a property
|
||||
var split = key.split(":");
|
||||
$(split[0]).prop(split[1], JSON.parse(localStorage.getItem(key)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user