Reimplement QuoteThreading.disconnect cleanly

This commit is contained in:
Zixaphir 2015-01-11 20:45:21 -07:00
parent 8bebd26989
commit 19bd52341d
3 changed files with 45 additions and 0 deletions

View File

@ -8392,6 +8392,20 @@
parent: {},
children: {},
inserted: {},
disconnect: function() {
if (!(Conf['Quote Threading'] && g.VIEW === 'thread')) {
return;
}
Header.menu.rmEntry(this.entry);
delete this.enabled;
delete this.controls;
delete this.entry;
this.parent = {};
this.children = {};
this.inserted = {};
Thread.callbacks.disconnect('Quote Threading');
return Post.callbacks.disconnect('Quote Threading');
},
setThread: function() {
QuoteThreading.thread = this;
return $.asap((function() {

View File

@ -8437,6 +8437,20 @@
parent: {},
children: {},
inserted: {},
disconnect: function() {
if (!(Conf['Quote Threading'] && g.VIEW === 'thread')) {
return;
}
Header.menu.rmEntry(this.entry);
delete this.enabled;
delete this.controls;
delete this.entry;
this.parent = {};
this.children = {};
this.inserted = {};
Thread.callbacks.disconnect('Quote Threading');
return Post.callbacks.disconnect('Quote Threading');
},
setThread: function() {
QuoteThreading.thread = this;
return $.asap((function() {

View File

@ -27,6 +27,7 @@ QuoteThreading =
Thread.callbacks.push
name: 'Quote Threading'
cb: @setThread
Post.callbacks.push
name: 'Quote Threading'
cb: @node
@ -35,6 +36,22 @@ QuoteThreading =
children: {}
inserted: {}
disconnect: ->
return unless Conf['Quote Threading'] and g.VIEW is 'thread'
Header.menu.rmEntry @entry
delete @enabled
delete @controls
delete @entry
@parent = {}
@children = {}
@inserted = {}
Thread.callbacks.disconnect 'Quote Threading'
Post.callbacks.disconnect 'Quote Threading'
setThread: ->
QuoteThreading.thread = @
$.asap (-> !Conf['Thread Updater'] or $ '.navLinksBot > .updatelink'), ->