Actually prune cached video titles
This commit is contained in:
parent
ca45ed6fe1
commit
f5c9927914
@ -8111,8 +8111,9 @@
|
|||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
if (Conf['Title Link']) {
|
if (Conf['Link Title']) {
|
||||||
$.sync('CachedTitles', Linkify.titleSync);
|
$.sync('CachedTitles', Linkify.titleSync);
|
||||||
|
this.clean();
|
||||||
}
|
}
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Linkify',
|
name: 'Linkify',
|
||||||
@ -8328,6 +8329,26 @@
|
|||||||
titleSync: function(value) {
|
titleSync: function(value) {
|
||||||
return Conf['CachedTitles'] = value;
|
return Conf['CachedTitles'] = value;
|
||||||
},
|
},
|
||||||
|
clean: function() {
|
||||||
|
var age, name, pruned, uid, _ref, _ref1;
|
||||||
|
pruned = false;
|
||||||
|
c.log('cleaning');
|
||||||
|
c.log(Object.keys(Conf.CachedTitles).length);
|
||||||
|
_ref = Conf['CachedTitles'];
|
||||||
|
for (uid in _ref) {
|
||||||
|
_ref1 = _ref[uid], name = _ref1[0], age = _ref1[1];
|
||||||
|
if (!(age + $.DAY > Date.now())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pruned = true;
|
||||||
|
delete Conf['CachedTitles'][uid];
|
||||||
|
}
|
||||||
|
c.log(Object.keys(Conf.CachedTitles).length);
|
||||||
|
c.log('cleaned');
|
||||||
|
if (pruned) {
|
||||||
|
return $.set('CachedTitles', Conf['CachedTitles']);
|
||||||
|
}
|
||||||
|
},
|
||||||
cb: {
|
cb: {
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var string, _ref;
|
var string, _ref;
|
||||||
|
|||||||
@ -8162,8 +8162,9 @@
|
|||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
if (Conf['Title Link']) {
|
if (Conf['Link Title']) {
|
||||||
$.sync('CachedTitles', Linkify.titleSync);
|
$.sync('CachedTitles', Linkify.titleSync);
|
||||||
|
this.clean();
|
||||||
}
|
}
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Linkify',
|
name: 'Linkify',
|
||||||
@ -8379,6 +8380,26 @@
|
|||||||
titleSync: function(value) {
|
titleSync: function(value) {
|
||||||
return Conf['CachedTitles'] = value;
|
return Conf['CachedTitles'] = value;
|
||||||
},
|
},
|
||||||
|
clean: function() {
|
||||||
|
var age, name, pruned, uid, _ref, _ref1;
|
||||||
|
pruned = false;
|
||||||
|
c.log('cleaning');
|
||||||
|
c.log(Object.keys(Conf.CachedTitles).length);
|
||||||
|
_ref = Conf['CachedTitles'];
|
||||||
|
for (uid in _ref) {
|
||||||
|
_ref1 = _ref[uid], name = _ref1[0], age = _ref1[1];
|
||||||
|
if (!(age + $.DAY > Date.now())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pruned = true;
|
||||||
|
delete Conf['CachedTitles'][uid];
|
||||||
|
}
|
||||||
|
c.log(Object.keys(Conf.CachedTitles).length);
|
||||||
|
c.log('cleaned');
|
||||||
|
if (pruned) {
|
||||||
|
return $.set('CachedTitles', Conf['CachedTitles']);
|
||||||
|
}
|
||||||
|
},
|
||||||
cb: {
|
cb: {
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var string, _ref;
|
var string, _ref;
|
||||||
|
|||||||
@ -5,8 +5,9 @@ Linkify =
|
|||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|
||||||
if Conf['Title Link']
|
if Conf['Link Title']
|
||||||
$.sync 'CachedTitles', Linkify.titleSync
|
$.sync 'CachedTitles', Linkify.titleSync
|
||||||
|
@clean()
|
||||||
|
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'Linkify'
|
name: 'Linkify'
|
||||||
@ -205,6 +206,13 @@ Linkify =
|
|||||||
titleSync: (value) ->
|
titleSync: (value) ->
|
||||||
Conf['CachedTitles'] = value
|
Conf['CachedTitles'] = value
|
||||||
|
|
||||||
|
clean: ->
|
||||||
|
pruned = false
|
||||||
|
for uid, [name, age] of Conf['CachedTitles'] when age + $.DAY > Date.now()
|
||||||
|
pruned = true
|
||||||
|
delete Conf['CachedTitles'][uid]
|
||||||
|
$.set 'CachedTitles', Conf['CachedTitles'] if pruned
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
toggle: ->
|
toggle: ->
|
||||||
[string, @textContent] = if $.hasClass @, "embedded"
|
[string, @textContent] = if $.hasClass @, "embedded"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user