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: {}, parent: {},
children: {}, children: {},
inserted: {}, 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() { setThread: function() {
QuoteThreading.thread = this; QuoteThreading.thread = this;
return $.asap((function() { return $.asap((function() {

View File

@ -8437,6 +8437,20 @@
parent: {}, parent: {},
children: {}, children: {},
inserted: {}, 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() { setThread: function() {
QuoteThreading.thread = this; QuoteThreading.thread = this;
return $.asap((function() { return $.asap((function() {

View File

@ -27,6 +27,7 @@ QuoteThreading =
Thread.callbacks.push Thread.callbacks.push
name: 'Quote Threading' name: 'Quote Threading'
cb: @setThread cb: @setThread
Post.callbacks.push Post.callbacks.push
name: 'Quote Threading' name: 'Quote Threading'
cb: @node cb: @node
@ -35,6 +36,22 @@ QuoteThreading =
children: {} children: {}
inserted: {} 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: -> setThread: ->
QuoteThreading.thread = @ QuoteThreading.thread = @
$.asap (-> !Conf['Thread Updater'] or $ '.navLinksBot > .updatelink'), -> $.asap (-> !Conf['Thread Updater'] or $ '.navLinksBot > .updatelink'), ->