remove intelligent autocomplete expiry
This commit is contained in:
@@ -21,17 +21,6 @@
|
|||||||
|
|
||||||
Danbooru.Autocomplete.prune_local_storage = function() {
|
Danbooru.Autocomplete.prune_local_storage = function() {
|
||||||
if (this.enable_local_storage) {
|
if (this.enable_local_storage) {
|
||||||
var now = new Date().getTime();
|
|
||||||
$.each($.localStorage.keys(), function(i, key) {
|
|
||||||
var obj = localStorage.getItem(key);
|
|
||||||
if (obj && obj.expires) {
|
|
||||||
var expiry = Date.parse(obj.expires);
|
|
||||||
if (expiry < now) {
|
|
||||||
$.localStorage.remove(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($.localStorage.keys().length > 4000) {
|
if ($.localStorage.keys().length > 4000) {
|
||||||
$.localStorage.removeAll();
|
$.localStorage.removeAll();
|
||||||
}
|
}
|
||||||
@@ -178,12 +167,8 @@
|
|||||||
if (this.enable_local_storage) {
|
if (this.enable_local_storage) {
|
||||||
var cached = $.localStorage.get(key);
|
var cached = $.localStorage.get(key);
|
||||||
if (cached) {
|
if (cached) {
|
||||||
if (cached.expires < new Date()) {
|
resp(cached.value);
|
||||||
$.localStorage.remove(key);
|
return;
|
||||||
} else {
|
|
||||||
resp(cached.value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user