forked from FOSS/BangleApps
popcon: regenerate JS
parent
eb0af982c5
commit
988945f0dc
|
@ -1,7 +1,6 @@
|
||||||
var oldRead = require("Storage").readJSON;
|
var oldRead = require("Storage").readJSON;
|
||||||
var monthAgo = Date.now() - 1000 * 86400 * 28;
|
var monthAgo = Date.now() - 1000 * 86400 * 28;
|
||||||
var cache;
|
var cache;
|
||||||
var orderchanged = false;
|
|
||||||
var ensureCache = function () {
|
var ensureCache = function () {
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
cache = oldRead("popcon.cache.json", true);
|
cache = oldRead("popcon.cache.json", true);
|
||||||
|
@ -10,12 +9,12 @@ var ensureCache = function () {
|
||||||
}
|
}
|
||||||
return cache;
|
return cache;
|
||||||
};
|
};
|
||||||
var saveCache = function () {
|
var saveCache = function (orderChanged) {
|
||||||
require("Storage").writeJSON("popcon.cache.json", cache);
|
require("Storage").writeJSON("popcon.cache.json", cache);
|
||||||
if (orderchanged) {
|
if (orderChanged) {
|
||||||
require("Storage")
|
var info = oldRead("popcon.info", true);
|
||||||
.list(/launch.*cache/)
|
info.cacheBuster = !info.cacheBuster;
|
||||||
.forEach(function (f) { return require("Storage").erase(f); });
|
require("Storage").writeJSON("popcon.info", info);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var sortCache = function () {
|
var sortCache = function () {
|
||||||
|
@ -40,12 +39,14 @@ var sortCache = function () {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
var orderChanged = false;
|
||||||
for (var _i = 0, ents_1 = ents; _i < ents_1.length; _i++) {
|
for (var _i = 0, ents_1 = ents; _i < ents_1.length; _i++) {
|
||||||
var ent = ents_1[_i];
|
var ent = ents_1[_i];
|
||||||
if (ent.sortorder !== i)
|
if (ent.sortorder !== i)
|
||||||
orderchanged = true;
|
orderChanged = true;
|
||||||
ent.sortorder = i++;
|
ent.sortorder = i++;
|
||||||
}
|
}
|
||||||
|
return orderChanged;
|
||||||
};
|
};
|
||||||
require("Storage").readJSON = (function (fname, skipExceptions) {
|
require("Storage").readJSON = (function (fname, skipExceptions) {
|
||||||
var _a;
|
var _a;
|
||||||
|
@ -71,8 +72,8 @@ global.load = function (src) {
|
||||||
});
|
});
|
||||||
ent.pop++;
|
ent.pop++;
|
||||||
ent.last = Date.now();
|
ent.last = Date.now();
|
||||||
sortCache();
|
var orderChanged = sortCache();
|
||||||
saveCache();
|
saveCache(orderChanged);
|
||||||
}
|
}
|
||||||
return oldLoad(src);
|
return oldLoad(src);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue