Fix QuoteThreading unthreading.

This commit is contained in:
Zixaphir 2015-01-21 09:16:18 -07:00
parent 6eb21cad76
commit 1da26a6d2a
3 changed files with 29 additions and 25 deletions

View File

@ -8481,9 +8481,10 @@
$.extend(this.threadNewLink, {
innerHTML: "<a href=\"javascript:;\">Thread New Posts</a>"
});
$.on($('input', this.controls), 'change', this.cb.thread);
this.input = $('input', this.controls);
$.on(this.input, 'change', this.cb.thread);
$.on(this.threadNewLink.firstElementChild, 'click', this.cb.click);
$.on(d, '4chanXInitFinished', this.cb.thread);
$.one(d, '4chanXInitFinished', this.cb.thread);
Header.menu.addEntry(this.entry = {
el: this.controls,
order: 98
@ -8505,15 +8506,15 @@
return;
}
Header.menu.rmEntry(this.entry);
delete this.enabled;
delete this.controls;
delete this.entry;
this.parent = {};
this.children = {};
this.inserted = {};
$.off($('input', this.controls), 'change', this.cb.thread);
$.off(this.threadNewLink.firstElementChild, 'click', this.cb.click);
$.off(this.input, 'change', this.cb.thread);
$.off(d, '4chanXInitFinished', this.cb.thread);
delete this.enabled;
delete this.controls;
delete this.entry;
delete this.input;
Thread.callbacks.disconnect('Quote Threading');
return Post.callbacks.disconnect('Quote Threading');
},
@ -8657,7 +8658,7 @@
},
cb: {
thread: function() {
return QuoteThreading.rethread(QuoteThreading.checked);
return QuoteThreading.rethread(QuoteThreading.input.checked);
},
click: function() {
QuoteThreading.threadNewLink.hidden = true;

View File

@ -8522,9 +8522,10 @@
$.extend(this.threadNewLink, {
innerHTML: "<a href=\"javascript:;\">Thread New Posts</a>"
});
$.on($('input', this.controls), 'change', this.cb.thread);
this.input = $('input', this.controls);
$.on(this.input, 'change', this.cb.thread);
$.on(this.threadNewLink.firstElementChild, 'click', this.cb.click);
$.on(d, '4chanXInitFinished', this.cb.thread);
$.one(d, '4chanXInitFinished', this.cb.thread);
Header.menu.addEntry(this.entry = {
el: this.controls,
order: 98
@ -8546,15 +8547,15 @@
return;
}
Header.menu.rmEntry(this.entry);
delete this.enabled;
delete this.controls;
delete this.entry;
this.parent = {};
this.children = {};
this.inserted = {};
$.off($('input', this.controls), 'change', this.cb.thread);
$.off(this.threadNewLink.firstElementChild, 'click', this.cb.click);
$.off(this.input, 'change', this.cb.thread);
$.off(d, '4chanXInitFinished', this.cb.thread);
delete this.enabled;
delete this.controls;
delete this.entry;
delete this.input;
Thread.callbacks.disconnect('Quote Threading');
return Post.callbacks.disconnect('Quote Threading');
},
@ -8698,7 +8699,7 @@
},
cb: {
thread: function() {
return QuoteThreading.rethread(QuoteThreading.checked);
return QuoteThreading.rethread(QuoteThreading.input.checked);
},
click: function() {
QuoteThreading.threadNewLink.hidden = true;

View File

@ -14,10 +14,12 @@ QuoteThreading =
className: 'brackets-wrap threadnewlink'
hidden: true
$.extend @threadNewLink, <%= html('<a href="javascript:;">Thread New Posts</a>') %>
@input = $('input', @controls)
$.on $('input', @controls), 'change', @cb.thread
$.on @input, 'change', @cb.thread
$.on @threadNewLink.firstElementChild, 'click', @cb.click
$.on d, '4chanXInitFinished', @cb.thread
$.one d, '4chanXInitFinished', @cb.thread
Header.menu.addEntry @entry =
el: @controls
@ -40,18 +42,18 @@ QuoteThreading =
Header.menu.rmEntry @entry
delete @enabled
delete @controls
delete @entry
@parent = {}
@children = {}
@inserted = {}
$.off $('input', @controls), 'change', @cb.thread
$.off @threadNewLink.firstElementChild, 'click', @cb.click
$.off @input, 'change', @cb.thread
$.off d, '4chanXInitFinished', @cb.thread
delete @enabled
delete @controls
delete @entry
delete @input
Thread.callbacks.disconnect 'Quote Threading'
Post.callbacks.disconnect 'Quote Threading'
@ -146,7 +148,7 @@ QuoteThreading =
Unread.update()
cb:
thread: -> QuoteThreading.rethread QuoteThreading.checked
thread: -> QuoteThreading.rethread QuoteThreading.input.checked
click: ->
QuoteThreading.threadNewLink.hidden = true
QuoteThreading.cb.thread()