1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-31 12:02:44 +00:00

Enhance detection of PV key validity in localStorage

This commit is contained in:
Cotes Chung
2021-04-07 15:01:23 +08:00
parent 11bcd7027d
commit 6341752986
2 changed files with 12 additions and 6 deletions

View File

@@ -75,14 +75,20 @@ const PvStorage = (function () {
return PvStorage.getAllPageviews() > pv.totalsForAllResults["ga:pageviews"];
},
inspectKeys() {
if (localStorage.getItem(KEY_PV) === null
|| localStorage.getItem(KEY_CREATION) === null) {
localStorage.clear();
for(let i = 0; i < localStorage.length; i++){
const key = localStorage.key(i);
switch (key) {
case KEY_PV:
case KEY_CREATION:
break;
default:
localStorage.clear();
return;
}
}
}
};
}()); /* PvData */
}()); /* PvStorage */
function countUp(min, max, destId) {
if (min < max) {