From 1da26a6d2a7652610dd0f9b812438b0394398d05 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Wed, 21 Jan 2015 09:16:18 -0700 Subject: [PATCH] Fix QuoteThreading unthreading. --- builds/appchan-x.user.js | 17 +++++++++-------- builds/crx/script.js | 17 +++++++++-------- src/Quotelinks/QuoteThreading.coffee | 20 +++++++++++--------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 1dcb7c47f..43502ad14 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -8481,9 +8481,10 @@ $.extend(this.threadNewLink, { innerHTML: "Thread New Posts" }); - $.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; diff --git a/builds/crx/script.js b/builds/crx/script.js index f496e35c7..2b0b29e4f 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -8522,9 +8522,10 @@ $.extend(this.threadNewLink, { innerHTML: "Thread New Posts" }); - $.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; diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index a4874b494..c478293ed 100755 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -14,10 +14,12 @@ QuoteThreading = className: 'brackets-wrap threadnewlink' hidden: true $.extend @threadNewLink, <%= html('Thread New Posts') %> + + @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() \ No newline at end of file