From f1b82d013f40e0d5074a5e1875ae060cb37f4c6b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 15 Apr 2016 10:34:39 -0700 Subject: [PATCH] Remove dependency of Post, Thread, CatalogThread classes on Callbacks class. --- Makefile | 5 +---- src/Filtering/Anonymize.coffee | 2 +- src/Filtering/Filter.coffee | 2 +- src/Filtering/PostHiding.coffee | 2 +- src/Filtering/Recursive.coffee | 2 +- src/Filtering/ThreadHiding.coffee | 2 +- src/General/Build.Test.coffee | 2 +- src/General/Index.coffee | 10 +++++----- src/General/Main.coffee | 8 ++++---- src/Images/FappeTyme.coffee | 4 ++-- src/Images/Gallery.coffee | 2 +- src/Images/ImageExpand.coffee | 2 +- src/Images/ImageHover.coffee | 4 ++-- src/Images/ImageLoader.coffee | 2 +- src/Images/Metadata.coffee | 2 +- src/Images/RevealSpoilers.coffee | 2 +- src/Images/Sauce.coffee | 2 +- src/Images/Volume.coffee | 4 ++-- src/Linkification/Linkify.coffee | 4 ++-- src/Menu/Menu.coffee | 4 ++-- src/Miscellaneous/AntiAutoplay.coffee | 4 ++-- src/Miscellaneous/CatalogLinks.coffee | 4 ++-- src/Miscellaneous/ExpandComment.coffee | 2 +- src/Miscellaneous/ExpandThread.coffee | 4 ++-- src/Miscellaneous/FileInfo.coffee | 2 +- src/Miscellaneous/Fourchan.coffee | 6 +++--- src/Miscellaneous/IDColor.coffee | 2 +- src/Miscellaneous/IDHighlight.coffee | 2 +- src/Miscellaneous/RelativeDates.coffee | 2 +- src/Miscellaneous/RemoveSpoilers.coffee | 4 ++-- src/Miscellaneous/ThreadLinks.coffee | 4 ++-- src/Miscellaneous/Time.coffee | 2 +- src/Monitoring/MarkNewIPs.coffee | 2 +- src/Monitoring/ReplyPruning.coffee | 2 +- src/Monitoring/ThreadExcerpt.coffee | 2 +- src/Monitoring/ThreadStats.coffee | 2 +- src/Monitoring/ThreadUpdater.coffee | 4 ++-- src/Monitoring/ThreadWatcher.coffee | 4 ++-- src/Monitoring/Unread.coffee | 4 ++-- src/Posting/QR.coffee | 2 +- src/Quotelinks/QuoteBacklink.coffee | 4 ++-- src/Quotelinks/QuoteCT.coffee | 2 +- src/Quotelinks/QuoteInline.coffee | 2 +- src/Quotelinks/QuoteOP.coffee | 2 +- src/Quotelinks/QuotePreview.coffee | 2 +- src/Quotelinks/QuoteStrikeThrough.coffee | 2 +- src/Quotelinks/QuoteThreading.coffee | 4 ++-- src/Quotelinks/QuoteYou.coffee | 2 +- src/Quotelinks/Quotify.coffee | 2 +- src/classes/Callbacks.coffee | 4 ++++ src/classes/CatalogThread.coffee | 1 - src/classes/Fetcher.coffee | 6 +++--- src/classes/Post.coffee | 1 - src/classes/Thread.coffee | 1 - 54 files changed, 80 insertions(+), 82 deletions(-) diff --git a/Makefile b/Makefile index 1d353699d..0312dd91f 100644 --- a/Makefile +++ b/Makefile @@ -40,12 +40,9 @@ sources_API := \ src/Images/ImageCommon.coffee sources_classes := \ - src/classes/Callbacks.coffee \ - src/classes/CatalogThread.coffee \ src/classes/Post.coffee src/classes/Clone.coffee \ - src/classes/Thread.coffee \ $(filter-out \ - %/Callbacks.coffee %/CatalogThread.coffee %/Post.coffee %/Clone.coffee %/Thread.coffee \ + %/Post.coffee %/Clone.coffee \ ,$(call sort_dir,classes)) sources_General := \ diff --git a/src/Filtering/Anonymize.coffee b/src/Filtering/Anonymize.coffee index 56a6eef7c..ba3693342 100644 --- a/src/Filtering/Anonymize.coffee +++ b/src/Filtering/Anonymize.coffee @@ -3,7 +3,7 @@ Anonymize = return unless g.VIEW in ['index', 'thread', 'archive'] and Conf['Anonymize'] return @archive() if g.VIEW is 'archive' - Post.callbacks.push + Callbacks.Post.push name: 'Anonymize' cb: @node diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index f5b96d631..e7d896d8b 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -75,7 +75,7 @@ Filter = delete @filters[key] return unless Object.keys(@filters).length - Post.callbacks.push + Callbacks.Post.push name: 'Filter' cb: @node diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index f4220ad0c..3b64fa661 100644 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -6,7 +6,7 @@ PostHiding = $.addClass doc, "reply-hide" @db = new DataBoard 'hiddenPosts' - Post.callbacks.push + Callbacks.Post.push name: 'Reply Hiding' cb: @node diff --git a/src/Filtering/Recursive.coffee b/src/Filtering/Recursive.coffee index 8a8be01b3..902fce8b7 100644 --- a/src/Filtering/Recursive.coffee +++ b/src/Filtering/Recursive.coffee @@ -2,7 +2,7 @@ Recursive = recursives: {} init: -> return unless g.VIEW in ['index', 'thread'] - Post.callbacks.push + Callbacks.Post.push name: 'Recursive' cb: @node diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 97d62cb3c..7087deb12 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -4,7 +4,7 @@ ThreadHiding = @db = new DataBoard 'hiddenThreads' return @catalogWatch() if g.VIEW is 'catalog' @catalogSet g.BOARD - Post.callbacks.push + Callbacks.Post.push name: 'Thread Hiding' cb: @node diff --git a/src/General/Build.Test.coffee b/src/General/Build.Test.coffee index 05d9eede8..789575e5a 100644 --- a/src/General/Build.Test.coffee +++ b/src/General/Build.Test.coffee @@ -72,7 +72,7 @@ Build.Test = Build.Test.postsRemaining-- Build.Test.report() if Build.Test.postsRemaining is 0 post2.isFetchedQuote = true - Main.callbackNodes Post, [post2] + Main.callbackNodes 'Post', [post2] testAll: -> g.posts.forEach (post) -> diff --git a/src/General/Index.coffee b/src/General/Index.coffee index dcabd6f2a..8682dbab5 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -5,7 +5,7 @@ Index = init: -> return if g.BOARD.ID is 'f' or !Conf['JSON Index'] or g.VIEW isnt 'index' - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Catalog Features' cb: @catalogNode @@ -599,8 +599,8 @@ Index = # Add the threads in a container to make sure all features work. $.nodes Index.nodes - Main.callbackNodes Thread, threads - Main.callbackNodes Post, posts + Main.callbackNodes 'Thread', threads + Main.callbackNodes 'Post', posts Index.updateHideLabel() $.event 'IndexRefresh' @@ -627,7 +627,7 @@ Index = $.add threadRoot, nodes Main.handleErrors errors if errors - Main.callbackNodes Post, posts + Main.callbackNodes 'Post', posts buildCatalogViews: -> threads = Index.sortedNodes @@ -636,7 +636,7 @@ Index = catalogThreads = [] for thread in threads when !thread.catalogView catalogThreads.push new CatalogThread Build.catalogThread(thread), thread - Main.callbackNodes CatalogThread, catalogThreads + Main.callbackNodes 'CatalogThread', catalogThreads threads.map (thread) -> thread.catalogView.nodes.root sizeCatalogViews: (nodes) -> diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 0fbbb0811..ae4ea7ff5 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -291,8 +291,8 @@ Main = threads[0].fileLimit = /\bimagelimit *= *1\b/.test scriptData threads[0].ipCount = if m = scriptData.match /\bunique_ips *= *(\d+)\b/ then +m[1] - Main.callbackNodes Thread, threads - Main.callbackNodesDB Post, posts, -> + Main.callbackNodes 'Thread', threads + Main.callbackNodesDB 'Post', posts, -> QuoteThreading.insert post for post in posts Main.expectInitFinished = true $.event '4chanXInitFinished' @@ -303,14 +303,14 @@ Main = callbackNodes: (klass, nodes) -> i = 0 - cb = klass.callbacks + cb = Callbacks[klass] while node = nodes[i++] cb.execute node return callbackNodesDB: (klass, nodes, cb) -> i = 0 - cbs = klass.callbacks + cbs = Callbacks[klass] fn = -> return false unless node = nodes[i] cbs.execute node diff --git a/src/Images/FappeTyme.coffee b/src/Images/FappeTyme.coffee index 7bc05d7ff..fdcd46d8e 100644 --- a/src/Images/FappeTyme.coffee +++ b/src/Images/FappeTyme.coffee @@ -23,11 +23,11 @@ FappeTyme = if Conf['Werk Tyme'] $.sync 'werk', @set.bind(@, 'werk') - Post.callbacks.push + Callbacks.Post.push name: 'Fappe Tyme' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Werk Tyme' cb: @catalogNode diff --git a/src/Images/Gallery.coffee b/src/Images/Gallery.coffee index 2f7c8dbfd..c3c33110a 100644 --- a/src/Images/Gallery.coffee +++ b/src/Images/Gallery.coffee @@ -15,7 +15,7 @@ Gallery = Header.addShortcut el - Post.callbacks.push + Callbacks.Post.push name: 'Gallery' cb: @node diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 2d0eb8aef..cc6e66f08 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -14,7 +14,7 @@ ImageExpand = @videoControls = $.el 'span', className: 'video-controls' $.extend @videoControls, <%= html('\u00A0contract') %> - Post.callbacks.push + Callbacks.Post.push name: 'Image Expansion' cb: @node diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index b70a04f1e..6845812f4 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -2,11 +2,11 @@ ImageHover = init: -> return if g.VIEW not in ['index', 'thread'] if Conf['Image Hover'] - Post.callbacks.push + Callbacks.Post.push name: 'Image Hover' cb: @node if Conf['Image Hover in Catalog'] - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Image Hover' cb: @catalogNode diff --git a/src/Images/ImageLoader.coffee b/src/Images/ImageLoader.coffee index a6b9b0ee5..4362f6d19 100644 --- a/src/Images/ImageLoader.coffee +++ b/src/Images/ImageLoader.coffee @@ -4,7 +4,7 @@ ImageLoader = return unless Conf['Image Prefetching'] or Conf['Replace JPG'] or Conf['Replace PNG'] or Conf['Replace GIF'] or Conf['Replace WEBM'] - Post.callbacks.push + Callbacks.Post.push name: 'Image Replace' cb: @node diff --git a/src/Images/Metadata.coffee b/src/Images/Metadata.coffee index 68af80a63..c0581e9ee 100644 --- a/src/Images/Metadata.coffee +++ b/src/Images/Metadata.coffee @@ -2,7 +2,7 @@ Metadata = init: -> return unless Conf['WEBM Metadata'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' - Post.callbacks.push + Callbacks.Post.push name: 'WEBM Metadata' cb: @node diff --git a/src/Images/RevealSpoilers.coffee b/src/Images/RevealSpoilers.coffee index ed159a4ca..e0687ed27 100644 --- a/src/Images/RevealSpoilers.coffee +++ b/src/Images/RevealSpoilers.coffee @@ -2,7 +2,7 @@ RevealSpoilers = init: -> return unless g.VIEW in ['index', 'thread'] and Conf['Reveal Spoiler Thumbnails'] - Post.callbacks.push + Callbacks.Post.push name: 'Reveal Spoiler Thumbnails' cb: @node diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index 3ceb60e20..8c0a2c708 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -14,7 +14,7 @@ Sauce = @link = $.el 'a', target: '_blank' className: 'sauce' - Post.callbacks.push + Callbacks.Post.push name: 'Sauce' cb: @node diff --git a/src/Images/Volume.coffee b/src/Images/Volume.coffee index b4248a77f..c13831a15 100644 --- a/src/Images/Volume.coffee +++ b/src/Images/Volume.coffee @@ -12,14 +12,14 @@ Volume = Volume.inputs?.volume.value = x if Conf['Mouse Wheel Volume'] - Post.callbacks.push + Callbacks.Post.push name: 'Mouse Wheel Volume' cb: @node return unless g.BOARD.ID in ['gif', 'wsg'] if Conf['Mouse Wheel Volume'] - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Mouse Wheel Volume' cb: @catalogNode diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index f531be459..1b24db01c 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -5,11 +5,11 @@ Linkify = if Conf['Comment Expansion'] ExpandComment.callbacks.push @node - Post.callbacks.push + Callbacks.Post.push name: 'Linkify' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Linkify' cb: @catalogNode diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index 6ca40d1f5..d556a3b80 100644 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -9,11 +9,11 @@ Menu = $.extend @button, <%= html('') %> @menu = new UI.Menu 'post' - Post.callbacks.push + Callbacks.Post.push name: 'Menu' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Menu' cb: @catalogNode diff --git a/src/Miscellaneous/AntiAutoplay.coffee b/src/Miscellaneous/AntiAutoplay.coffee index 47cdcf65b..a8354e0e3 100644 --- a/src/Miscellaneous/AntiAutoplay.coffee +++ b/src/Miscellaneous/AntiAutoplay.coffee @@ -4,10 +4,10 @@ AntiAutoplay = $.addClass doc, 'anti-autoplay' @stop audio for audio in $$ 'audio[autoplay]', doc window.addEventListener 'loadstart', ((e) => @stop e.target), true - Post.callbacks.push + Callbacks.Post.push name: 'Disable Autoplaying Sounds' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Disable Autoplaying Sounds' cb: @node $.ready => @process d.body diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index 9033842c3..72155a6a0 100644 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -21,10 +21,10 @@ CatalogLinks = return if Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog'] - Post.callbacks.push + Callbacks.Post.push name: 'Catalog Link Rewrite' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Catalog Link Rewrite' cb: @node diff --git a/src/Miscellaneous/ExpandComment.coffee b/src/Miscellaneous/ExpandComment.coffee index 736168a86..4935e7ac4 100644 --- a/src/Miscellaneous/ExpandComment.coffee +++ b/src/Miscellaneous/ExpandComment.coffee @@ -5,7 +5,7 @@ ExpandComment = @callbacks.push Fourchan.code if g.BOARD.ID is 'g' @callbacks.push Fourchan.math if g.BOARD.ID is 'sci' - Post.callbacks.push + Callbacks.Post.push name: 'Comment Expansion' cb: @node diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 623ac5c83..344544c7b 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -5,7 +5,7 @@ ExpandThread = if Conf['JSON Index'] $.on d, 'IndexRefresh', @onIndexRefresh else - Thread.callbacks.push + Callbacks.Thread.push name: 'Expand Thread' cb: -> ExpandThread.setButton @ @@ -97,7 +97,7 @@ ExpandThread = filesCount++ if 'file' of post posts.push post postsRoot.push root - Main.callbackNodes Post, posts + Main.callbackNodes 'Post', posts $.after a, postsRoot $.event 'PostsInserted' diff --git a/src/Miscellaneous/FileInfo.coffee b/src/Miscellaneous/FileInfo.coffee index 542fc43b7..40cb3fce2 100644 --- a/src/Miscellaneous/FileInfo.coffee +++ b/src/Miscellaneous/FileInfo.coffee @@ -2,7 +2,7 @@ FileInfo = init: -> return if g.VIEW not in ['index', 'thread'] or !Conf['File Info Formatting'] - Post.callbacks.push + Callbacks.Post.push name: 'File Info Formatting' cb: @node diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index a68996442..9629e3a74 100644 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -20,7 +20,7 @@ Fourchan = })); }, false); ''' - Post.callbacks.push + Callbacks.Post.push name: 'Parse /g/ code' cb: @code @@ -39,10 +39,10 @@ Fourchan = window.MathJax.Hub.Queue ['Typeset', window.MathJax.Hub, e.target] , false , false - Post.callbacks.push + Callbacks.Post.push name: 'Parse /sci/ math' cb: @math - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Parse /sci/ math' cb: @math diff --git a/src/Miscellaneous/IDColor.coffee b/src/Miscellaneous/IDColor.coffee index 47ba83b74..9d956c3fe 100644 --- a/src/Miscellaneous/IDColor.coffee +++ b/src/Miscellaneous/IDColor.coffee @@ -5,7 +5,7 @@ IDColor = Heaven: [0, 0, 0, '#fff'] } - Post.callbacks.push + Callbacks.Post.push name: 'Color User IDs' cb: @node diff --git a/src/Miscellaneous/IDHighlight.coffee b/src/Miscellaneous/IDHighlight.coffee index 4befd3112..759a8b607 100644 --- a/src/Miscellaneous/IDHighlight.coffee +++ b/src/Miscellaneous/IDHighlight.coffee @@ -2,7 +2,7 @@ IDHighlight = init: -> return unless g.VIEW in ['index', 'thread'] - Post.callbacks.push + Callbacks.Post.push name: 'Highlight by User ID' cb: @node diff --git a/src/Miscellaneous/RelativeDates.coffee b/src/Miscellaneous/RelativeDates.coffee index 353442239..e7b1106e2 100644 --- a/src/Miscellaneous/RelativeDates.coffee +++ b/src/Miscellaneous/RelativeDates.coffee @@ -9,7 +9,7 @@ RelativeDates = $.on d, 'visibilitychange ThreadUpdate', @flush if Conf['Relative Post Dates'] - Post.callbacks.push + Callbacks.Post.push name: 'Relative Post Dates' cb: @node diff --git a/src/Miscellaneous/RemoveSpoilers.coffee b/src/Miscellaneous/RemoveSpoilers.coffee index 6bb7df137..47ee75a8d 100644 --- a/src/Miscellaneous/RemoveSpoilers.coffee +++ b/src/Miscellaneous/RemoveSpoilers.coffee @@ -5,11 +5,11 @@ RemoveSpoilers = return unless Conf['Remove Spoilers'] - Post.callbacks.push + Callbacks.Post.push name: 'Reveal Spoilers' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Reveal Spoilers' cb: @node diff --git a/src/Miscellaneous/ThreadLinks.coffee b/src/Miscellaneous/ThreadLinks.coffee index 61f69564b..fcaa01998 100644 --- a/src/Miscellaneous/ThreadLinks.coffee +++ b/src/Miscellaneous/ThreadLinks.coffee @@ -2,10 +2,10 @@ ThreadLinks = init: -> return unless g.VIEW is 'index' and Conf['Open Threads in New Tab'] - Post.callbacks.push + Callbacks.Post.push name: 'Thread Links' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Thread Links' cb: @catalogNode diff --git a/src/Miscellaneous/Time.coffee b/src/Miscellaneous/Time.coffee index f31ce0d7a..8e9128ea6 100644 --- a/src/Miscellaneous/Time.coffee +++ b/src/Miscellaneous/Time.coffee @@ -2,7 +2,7 @@ Time = init: -> return unless g.VIEW in ['index', 'thread'] and Conf['Time Formatting'] - Post.callbacks.push + Callbacks.Post.push name: 'Time Formatting' cb: @node diff --git a/src/Monitoring/MarkNewIPs.coffee b/src/Monitoring/MarkNewIPs.coffee index e3fa25f2c..f9c52b4c8 100644 --- a/src/Monitoring/MarkNewIPs.coffee +++ b/src/Monitoring/MarkNewIPs.coffee @@ -1,7 +1,7 @@ MarkNewIPs = init: -> return if g.VIEW isnt 'thread' or !Conf['Mark New IPs'] - Thread.callbacks.push + Callbacks.Thread.push name: 'Mark New IPs' cb: @node diff --git a/src/Monitoring/ReplyPruning.coffee b/src/Monitoring/ReplyPruning.coffee index 13fef8d9d..491362d0e 100644 --- a/src/Monitoring/ReplyPruning.coffee +++ b/src/Monitoring/ReplyPruning.coffee @@ -32,7 +32,7 @@ ReplyPruning = el: el order: 190 - Thread.callbacks.push + Callbacks.Thread.push name: 'Reply Pruning' cb: @node diff --git a/src/Monitoring/ThreadExcerpt.coffee b/src/Monitoring/ThreadExcerpt.coffee index 29148362d..f0f4ca545 100644 --- a/src/Monitoring/ThreadExcerpt.coffee +++ b/src/Monitoring/ThreadExcerpt.coffee @@ -2,7 +2,7 @@ ThreadExcerpt = init: -> return if g.BOARD.ID isnt 'f' or g.VIEW isnt 'thread' or !Conf['Thread Excerpt'] - Thread.callbacks.push + Callbacks.Thread.push name: 'Thread Excerpt' cb: @node node: -> d.title = Get.threadExcerpt @ diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index d27625e75..e579bc542 100644 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -33,7 +33,7 @@ ThreadStats = $.on @pageCountEl, 'click', ThreadStats.fetchPage if @pageCountEl - Thread.callbacks.push + Callbacks.Thread.push name: 'Thread Stats' cb: @node diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 85965e55f..f3f8a5714 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -58,7 +58,7 @@ ThreadUpdater = order: 110 subEntries: subEntries - Thread.callbacks.push + Callbacks.Thread.push name: 'Thread Updater' cb: @node @@ -316,7 +316,7 @@ ThreadUpdater = unreadCount = Unread.posts?.size unreadQYCount = Unread.postsQuotingYou?.size - Main.callbackNodes Post, posts + Main.callbackNodes 'Post', posts if d.hidden or not d.hasFocus() if Conf['Beep Quoting You'] and Unread.postsQuotingYou?.size > unreadQYCount diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 39bb5b61d..3b8ddc122 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -61,10 +61,10 @@ ThreadWatcher = $.on @el, 'click', @cb true - Post.callbacks.push + Callbacks.Post.push name: 'Thread Watcher' cb: @node - CatalogThread.callbacks.push + Callbacks.CatalogThread.push name: 'Thread Watcher' cb: @catalogNode diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 616dee4fe..43f7f4693 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -20,11 +20,11 @@ Unread = @order = new RandomAccessList() @position = null - Thread.callbacks.push + Callbacks.Thread.push name: 'Unread' cb: @node - Post.callbacks.push + Callbacks.Post.push name: 'Unread' cb: @addPost diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 2e0701263..cf26c1ce5 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -33,7 +33,7 @@ QR = $.on d, '4chanXInitFinished', @initReady - Post.callbacks.push + Callbacks.Post.push name: 'Quick Reply' cb: @node diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index 2d49d5efc..1250ac728 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -14,10 +14,10 @@ QuoteBacklink = init: -> return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Backlinks'] - Post.callbacks.push + Callbacks.Post.push name: 'Quote Backlinking Part 1' cb: @firstNode - Post.callbacks.push + Callbacks.Post.push name: 'Quote Backlinking Part 2' cb: @secondNode firstNode: -> diff --git a/src/Quotelinks/QuoteCT.coffee b/src/Quotelinks/QuoteCT.coffee index 7a32dc8d5..97563787c 100644 --- a/src/Quotelinks/QuoteCT.coffee +++ b/src/Quotelinks/QuoteCT.coffee @@ -7,7 +7,7 @@ QuoteCT = # \u00A0 is nbsp @text = '\u00A0(Cross-thread)' - Post.callbacks.push + Callbacks.Post.push name: 'Mark Cross-thread Quotes' cb: @node node: -> diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index 32af6f856..b62e87cbc 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -5,7 +5,7 @@ QuoteInline = if Conf['Comment Expansion'] ExpandComment.callbacks.push @node - Post.callbacks.push + Callbacks.Post.push name: 'Quote Inlining' cb: @node diff --git a/src/Quotelinks/QuoteOP.coffee b/src/Quotelinks/QuoteOP.coffee index 6e0f212b6..7a4a02612 100644 --- a/src/Quotelinks/QuoteOP.coffee +++ b/src/Quotelinks/QuoteOP.coffee @@ -7,7 +7,7 @@ QuoteOP = # \u00A0 is nbsp @text = '\u00A0(OP)' - Post.callbacks.push + Callbacks.Post.push name: 'Mark OP Quotes' cb: @node diff --git a/src/Quotelinks/QuotePreview.coffee b/src/Quotelinks/QuotePreview.coffee index 43fc8ab54..b443f7d0c 100644 --- a/src/Quotelinks/QuotePreview.coffee +++ b/src/Quotelinks/QuotePreview.coffee @@ -5,7 +5,7 @@ QuotePreview = if Conf['Comment Expansion'] ExpandComment.callbacks.push @node - Post.callbacks.push + Callbacks.Post.push name: 'Quote Previewing' cb: @node diff --git a/src/Quotelinks/QuoteStrikeThrough.coffee b/src/Quotelinks/QuoteStrikeThrough.coffee index fee420919..e566da9bf 100644 --- a/src/Quotelinks/QuoteStrikeThrough.coffee +++ b/src/Quotelinks/QuoteStrikeThrough.coffee @@ -3,7 +3,7 @@ QuoteStrikeThrough = return unless g.VIEW in ['index', 'thread'] and (Conf['Reply Hiding Buttons'] or (Conf['Menu'] and Conf['Reply Hiding Link']) or Conf['Filter']) - Post.callbacks.push + Callbacks.Post.push name: 'Strike-through Quotes' cb: @node diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index d60453143..3f30297a4 100644 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -26,11 +26,11 @@ QuoteThreading = el: @controls order: 99 - Thread.callbacks.push + Callbacks.Thread.push name: 'Quote Threading' cb: @setThread - Post.callbacks.push + Callbacks.Post.push name: 'Quote Threading' cb: @node diff --git a/src/Quotelinks/QuoteYou.coffee b/src/Quotelinks/QuoteYou.coffee index 9370b22aa..7041382b4 100644 --- a/src/Quotelinks/QuoteYou.coffee +++ b/src/Quotelinks/QuoteYou.coffee @@ -23,7 +23,7 @@ QuoteYou = # \u00A0 is nbsp @text = '\u00A0(You)' - Post.callbacks.push + Callbacks.Post.push name: 'Mark Quotes of You' cb: @node diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 1f2bc28b4..50a3cec8b 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -5,7 +5,7 @@ Quotify = if Conf['Comment Expansion'] ExpandComment.callbacks.push @node - Post.callbacks.push + Callbacks.Post.push name: 'Resurrect Quotes' cb: @node diff --git a/src/classes/Callbacks.coffee b/src/classes/Callbacks.coffee index c72ab987b..d5292175a 100644 --- a/src/classes/Callbacks.coffee +++ b/src/classes/Callbacks.coffee @@ -1,4 +1,8 @@ class Callbacks + @Post = new Callbacks 'Post' + @Thread = new Callbacks 'Thread' + @CatalogThread = new Callbacks 'Catalog Thread' + constructor: (@type) -> @keys = [] diff --git a/src/classes/CatalogThread.coffee b/src/classes/CatalogThread.coffee index 40f6fcd94..041692a67 100644 --- a/src/classes/CatalogThread.coffee +++ b/src/classes/CatalogThread.coffee @@ -1,5 +1,4 @@ class CatalogThread - @callbacks = new Callbacks 'Catalog Thread' toString: -> @ID constructor: (root, @thread) -> diff --git a/src/classes/Fetcher.coffee b/src/classes/Fetcher.coffee index 764655e8d..938745798 100644 --- a/src/classes/Fetcher.coffee +++ b/src/classes/Fetcher.coffee @@ -15,7 +15,7 @@ class Fetcher # Stop here if the container has been removed while loading. return unless @root.parentNode clone = post.addClone @quoter.context, ($.hasClass @root, 'dialog') - Main.callbackNodes Clone, [clone] + Main.callbackNodes 'Post', [clone] # Get rid of the side arrows/stubs. {nodes} = clone @@ -79,7 +79,7 @@ class Fetcher new Thread @threadID, board post = new Post Build.postFromObject(post, @boardID), thread, board post.isFetchedQuote = true - Main.callbackNodes Post, [post] + Main.callbackNodes 'Post', [post] @insert post archivedPost: -> @@ -185,7 +185,7 @@ class Fetcher post.kill() post.file.thumbURL = o.file.thumbURL if post.file post.isFetchedQuote = true - Main.callbackNodes Post, [post] + Main.callbackNodes 'Post', [post] @insert post archiveTags: diff --git a/src/classes/Post.coffee b/src/classes/Post.coffee index 51455a919..3438a0885 100644 --- a/src/classes/Post.coffee +++ b/src/classes/Post.coffee @@ -1,5 +1,4 @@ class Post - @callbacks = new Callbacks 'Post' toString: -> @ID constructor: (root, @thread, @board) -> diff --git a/src/classes/Thread.coffee b/src/classes/Thread.coffee index 7cddff905..d142a39f4 100644 --- a/src/classes/Thread.coffee +++ b/src/classes/Thread.coffee @@ -1,5 +1,4 @@ class Thread - @callbacks = new Callbacks 'Thread' toString: -> @ID constructor: (@ID, @board) ->