mirror of
https://github.com/krateng/maloja.git
synced 2025-06-10 20:32:28 +03:00
Moved range preferences from cookies to localstorage
This commit is contained in:
parent
ec914d1b40
commit
a4abf383a6
@ -1,3 +1,5 @@
|
|||||||
|
localStorage = window.localStorage;
|
||||||
|
|
||||||
function showRange(identifier,unit) {
|
function showRange(identifier,unit) {
|
||||||
// Make all modules disappear
|
// Make all modules disappear
|
||||||
modules = document.getElementsByClassName("stat_module_" + identifier);
|
modules = document.getElementsByClassName("stat_module_" + identifier);
|
||||||
@ -38,16 +40,25 @@ function showRange(identifier,unit) {
|
|||||||
|
|
||||||
function showRangeManual(identifier,unit) {
|
function showRangeManual(identifier,unit) {
|
||||||
showRange(identifier,unit);
|
showRange(identifier,unit);
|
||||||
neo.setCookie("rangeselect_" + identifier,unit);
|
//neo.setCookie("rangeselect_" + identifier,unit);
|
||||||
|
localStorage.setItem("rangeselect_" + identifier,unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded',function() {
|
document.addEventListener('DOMContentLoaded',function() {
|
||||||
for (let type of ["topartists","toptracks","pulse"]) {
|
for (let type of ["topartists","toptracks","pulse"]) {
|
||||||
var val = neo.getCookie("rangeselect_" + type);
|
var val = localStorage.getItem("rangeselect_" + type);
|
||||||
if (val != undefined) {
|
if (val != null) {
|
||||||
showRange(type,val);
|
showRange(type,val);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
var val = neo.getCookie("rangeselect_" + type);
|
||||||
|
if (val != undefined) {
|
||||||
|
showRangeManual(type,val); //sets local storage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user