From bc9f094a77a797b681677a9a1652aac99414fd1d Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Fri, 10 Jan 2014 18:07:14 -0700 Subject: [PATCH] Turns out I never finished my Thread Title magic... because @MayhemYDG had already done it and done it better. So I thought mine was working when it was just his... and then realized when I didn't disconnect it and the index was getting a title from a thread that it wasn't working and his was. So let's just use his code. --- builds/4chan-X.user.js | 13 ++++++------- builds/crx/script.js | 13 ++++++------- src/General/Navigate.coffee | 7 +++---- src/Monitoring/ThreadExcerpt.coffee | 4 ++-- src/Quotelinks/Quotify.coffee | 1 + 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 79e662e16..a1f6f870a 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -8641,6 +8641,9 @@ }, node: function() { return d.title = Get.threadExcerpt(this); + }, + disconnect: function() { + return Thread.callbacks.disconnect('Thread Excerpt'); } }; @@ -11860,7 +11863,7 @@ g.BOARD.threads = {}; return $.rmAll($('.board')); }, - threadFeatures: [['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], + threadFeatures: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], disconnect: function() { var err, errors, feature, features, name, _i, _len, _ref; features = g.VIEW === 'thread' ? Navigate.threadFeatures : []; @@ -12012,6 +12015,7 @@ if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) { return; } + $.addClass(Index.button, 'fa-spin'); path = this.pathname.split('/'); hash = this.hash; if (path[0] === '') { @@ -12087,7 +12091,7 @@ } }, parse: function(data) { - var OP, board, comment, errors, makePost, obj, post, posts, subject, thread, threadRoot, title, _i, _len, _ref; + var OP, board, errors, makePost, obj, post, posts, thread, threadRoot, _i, _len; board = g.BOARD; Navigate.threadRoot = threadRoot = Build.thread(board, OP = data.shift(), true); thread = new Thread(OP.no, board); @@ -12109,11 +12113,6 @@ } }; makePost($('.opContainer', threadRoot)); - _ref = posts[0].info, subject = _ref.subject, comment = _ref.comment; - title = "/" + g.BOARD.ID + "/ - " + (subject || comment); - if (title.length > 100) { - title = title.slice(0, 100); - } for (_i = 0, _len = data.length; _i < _len; _i++) { obj = data[_i]; post = Build.postFromObject(obj, board); diff --git a/builds/crx/script.js b/builds/crx/script.js index fc8bd48cc..39b5c9c40 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -8624,6 +8624,9 @@ }, node: function() { return d.title = Get.threadExcerpt(this); + }, + disconnect: function() { + return Thread.callbacks.disconnect('Thread Excerpt'); } }; @@ -11849,7 +11852,7 @@ g.BOARD.threads = {}; return $.rmAll($('.board')); }, - threadFeatures: [['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], + threadFeatures: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], disconnect: function() { var err, errors, feature, features, name, _i, _len, _ref; features = g.VIEW === 'thread' ? Navigate.threadFeatures : []; @@ -12001,6 +12004,7 @@ if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) { return; } + $.addClass(Index.button, 'fa-spin'); path = this.pathname.split('/'); hash = this.hash; if (path[0] === '') { @@ -12076,7 +12080,7 @@ } }, parse: function(data) { - var OP, board, comment, errors, makePost, obj, post, posts, subject, thread, threadRoot, title, _i, _len, _ref; + var OP, board, errors, makePost, obj, post, posts, thread, threadRoot, _i, _len; board = g.BOARD; Navigate.threadRoot = threadRoot = Build.thread(board, OP = data.shift(), true); thread = new Thread(OP.no, board); @@ -12098,11 +12102,6 @@ } }; makePost($('.opContainer', threadRoot)); - _ref = posts[0].info, subject = _ref.subject, comment = _ref.comment; - title = "/" + g.BOARD.ID + "/ - " + (subject || comment); - if (title.length > 100) { - title = title.slice(0, 100); - } for (_i = 0, _len = data.length; _i < _len; _i++) { obj = data[_i]; post = Build.postFromObject(obj, board); diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 85e0b306d..4fffe15c4 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -35,6 +35,7 @@ Navigate = $.rmAll $ '.board' threadFeatures: [ + ['Thread Excerpt', ThreadExcerpt] ['Unread Count', Unread] ['Quote Threading', QuoteThreading] ['Thread Stats', ThreadStats] @@ -170,6 +171,8 @@ Navigate = return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org' or (e and (e.shiftKey or (e.type is 'click' and e.button isnt 0))) # Not simply a left click + $.addClass Index.button, 'fa-spin' + path = @pathname.split '/' hash = @hash path.shift() if path[0] is '' @@ -258,10 +261,6 @@ Navigate = makePost $('.opContainer', threadRoot) - {subject, comment} = posts[0].info - title = "/#{g.BOARD.ID}/ - #{subject or comment}" - title = title[...100] if title.length > 100 - for obj in data post = Build.postFromObject obj, board makePost post diff --git a/src/Monitoring/ThreadExcerpt.coffee b/src/Monitoring/ThreadExcerpt.coffee index dc55c1b04..7398c5423 100755 --- a/src/Monitoring/ThreadExcerpt.coffee +++ b/src/Monitoring/ThreadExcerpt.coffee @@ -5,5 +5,5 @@ ThreadExcerpt = Thread.callbacks.push name: 'Thread Excerpt' cb: @node - node: -> - d.title = Get.threadExcerpt @ + node: -> d.title = Get.threadExcerpt @ + disconnect: -> Thread.callbacks.disconnect 'Thread Excerpt' diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 6d00037a7..efccdcd83 100755 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -8,6 +8,7 @@ Quotify = Post.callbacks.push name: 'Resurrect Quotes' cb: @node + node: -> for deadlink in $$ '.deadlink', @nodes.comment if @isClone