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

View File

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

View File

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