{Post,Thread}::callbacks => {Post,Thread}.callbacks

This commit is contained in:
Mayhem 2013-10-02 11:38:15 +02:00
parent 1bd09b2270
commit 10e93091d7
37 changed files with 40 additions and 40 deletions

View File

@ -64,7 +64,7 @@ Filter =
delete @filters[key] delete @filters[key]
return unless Object.keys(@filters).length return unless Object.keys(@filters).length
Post::callbacks.push Post.callbacks.push
name: 'Filter' name: 'Filter'
cb: @node cb: @node

View File

@ -3,7 +3,7 @@ PostHiding =
return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link']
@db = new DataBoard 'hiddenPosts' @db = new DataBoard 'hiddenPosts'
Post::callbacks.push Post.callbacks.push
name: 'Reply Hiding' name: 'Reply Hiding'
cb: @node cb: @node

View File

@ -3,7 +3,7 @@ Recursive =
init: -> init: ->
return if g.VIEW is 'catalog' return if g.VIEW is 'catalog'
Post::callbacks.push Post.callbacks.push
name: 'Recursive' name: 'Recursive'
cb: @node cb: @node

View File

@ -4,7 +4,7 @@ ThreadHiding =
@db = new DataBoard 'hiddenThreads' @db = new DataBoard 'hiddenThreads'
@syncCatalog() @syncCatalog()
Thread::callbacks.push Thread.callbacks.push
name: 'Thread Hiding' name: 'Thread Hiding'
cb: @node cb: @node

View File

@ -206,7 +206,7 @@ Main =
callbackNodes: (klass, nodes) -> callbackNodes: (klass, nodes) ->
# get the nodes' length only once # get the nodes' length only once
len = nodes.length len = nodes.length
for callback in klass::callbacks for callback in klass.callbacks
# c.profile callback.name # c.profile callback.name
for i in [0...len] by 1 for i in [0...len] by 1
node = nodes[i] node = nodes[i]
@ -233,7 +233,7 @@ Main =
else else
return return
obj.callback.isAddon = true obj.callback.isAddon = true
Klass::callbacks.push obj.callback Klass.callbacks.push obj.callback
handleErrors: (errors) -> handleErrors: (errors) ->
unless errors instanceof Array unless errors instanceof Array

View File

@ -1,5 +1,5 @@
class Post class Post
callbacks: [] @callbacks = []
toString: -> @ID toString: -> @ID
constructor: (root, @thread, @board, that={}) -> constructor: (root, @thread, @board, that={}) ->

View File

@ -1,5 +1,5 @@
class Thread class Thread
callbacks: [] @callbacks = []
toString: -> @ID toString: -> @ID
constructor: (@ID, @board) -> constructor: (@ID, @board) ->

View File

@ -2,7 +2,7 @@ AutoGIF =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Auto-GIF'] or g.BOARD.ID in ['gif', 'wsg'] return if g.VIEW is 'catalog' or !Conf['Auto-GIF'] or g.BOARD.ID in ['gif', 'wsg']
Post::callbacks.push Post.callbacks.push
name: 'Auto-GIF' name: 'Auto-GIF'
cb: @node cb: @node
node: -> node: ->

View File

@ -9,7 +9,7 @@ ImageExpand =
$.on @EAI, 'click', ImageExpand.cb.toggleAll $.on @EAI, 'click', ImageExpand.cb.toggleAll
Header.addShortcut @EAI, 2 Header.addShortcut @EAI, 2
Post::callbacks.push Post.callbacks.push
name: 'Image Expansion' name: 'Image Expansion'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ ImageHover =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Image Hover'] return if g.VIEW is 'catalog' or !Conf['Image Hover']
Post::callbacks.push Post.callbacks.push
name: 'Image Hover' name: 'Image Hover'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ RevealSpoilers =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Reveal Spoilers'] return if g.VIEW is 'catalog' or !Conf['Reveal Spoilers']
Post::callbacks.push Post.callbacks.push
name: 'Reveal Spoilers' name: 'Reveal Spoilers'
cb: @node cb: @node
node: -> node: ->

View File

@ -11,7 +11,7 @@ Sauce =
return unless links.length return unless links.length
@links = links @links = links
@link = $.el 'a', target: '_blank' @link = $.el 'a', target: '_blank'
Post::callbacks.push Post.callbacks.push
name: 'Sauce' name: 'Sauce'
cb: @node cb: @node
createSauceLink: (link) -> createSauceLink: (link) ->

View File

@ -39,7 +39,7 @@ Linkify =
) )
///g ///g
Post::callbacks.push Post.callbacks.push
name: 'Linkify' name: 'Linkify'
cb: @node cb: @node

View File

@ -3,7 +3,7 @@ Menu =
return if g.VIEW is 'catalog' or !Conf['Menu'] return if g.VIEW is 'catalog' or !Conf['Menu']
@menu = new UI.Menu 'post' @menu = new UI.Menu 'post'
Post::callbacks.push Post.callbacks.push
name: 'Menu' name: 'Menu'
cb: @node cb: @node

View File

@ -2,7 +2,7 @@ Anonymize =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Anonymize'] return if g.VIEW is 'catalog' or !Conf['Anonymize']
Post::callbacks.push Post.callbacks.push
name: 'Anonymize' name: 'Anonymize'
cb: @node cb: @node
node: -> node: ->

View File

@ -1,7 +1,7 @@
Dice = Dice =
init: -> init: ->
return if g.BOARD.ID isnt 'tg' or g.VIEW is 'catalog' or !Conf['Show Dice Roll'] return if g.BOARD.ID isnt 'tg' or g.VIEW is 'catalog' or !Conf['Show Dice Roll']
Post::callbacks.push Post.callbacks.push
name: 'Show Dice Roll' name: 'Show Dice Roll'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ ExpandComment =
init: -> init: ->
return if g.VIEW isnt 'index' or !Conf['Comment Expansion'] return if g.VIEW isnt 'index' or !Conf['Comment Expansion']
Post::callbacks.push Post.callbacks.push
name: 'Comment Expansion' name: 'Comment Expansion'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ ExpandThread =
init: -> init: ->
return if g.VIEW isnt 'index' or !Conf['Thread Expansion'] return if g.VIEW isnt 'index' or !Conf['Thread Expansion']
Thread::callbacks.push Thread.callbacks.push
name: 'Thread Expansion' name: 'Thread Expansion'
cb: @node cb: @node
node: -> node: ->

View File

@ -3,7 +3,7 @@ FileInfo =
return if g.VIEW is 'catalog' or !Conf['File Info Formatting'] return if g.VIEW is 'catalog' or !Conf['File Info Formatting']
@funk = @createFunc Conf['fileInfo'] @funk = @createFunc Conf['fileInfo']
Post::callbacks.push Post.callbacks.push
name: 'File Info Formatting' name: 'File Info Formatting'
cb: @node cb: @node
node: -> node: ->

View File

@ -10,7 +10,7 @@ Fourchan =
pre.innerHTML = prettyPrintOne(pre.innerHTML); pre.innerHTML = prettyPrintOne(pre.innerHTML);
}, false); }, false);
""" """
Post::callbacks.push Post.callbacks.push
name: 'Parse /g/ code' name: 'Parse /g/ code'
cb: @code cb: @code
if board is 'sci' if board is 'sci'
@ -27,7 +27,7 @@ Fourchan =
} }
}, false); }, false);
""" """
Post::callbacks.push Post.callbacks.push
name: 'Parse /sci/ math' name: 'Parse /sci/ math'
cb: @math cb: @math
code: -> code: ->

View File

@ -3,7 +3,7 @@ IDColor =
return if g.VIEW is 'catalog' or !Conf['Color User IDs'] return if g.VIEW is 'catalog' or !Conf['Color User IDs']
@ids = {} @ids = {}
Post::callbacks.push Post.callbacks.push
name: 'Color User IDs' name: 'Color User IDs'
cb: @node cb: @node

View File

@ -9,7 +9,7 @@ RelativeDates =
# Start the timeout. # Start the timeout.
@flush() @flush()
Post::callbacks.push Post.callbacks.push
name: 'Relative Post Dates' name: 'Relative Post Dates'
cb: @node cb: @node
node: -> node: ->

View File

@ -3,7 +3,7 @@ Time =
return if g.VIEW is 'catalog' or !Conf['Time Formatting'] return if g.VIEW is 'catalog' or !Conf['Time Formatting']
@funk = @createFunc Conf['time'] @funk = @createFunc Conf['time']
Post::callbacks.push Post.callbacks.push
name: 'Time Formatting' name: 'Time Formatting'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ ThreadExcerpt =
init: -> init: ->
return if g.VIEW isnt 'thread' or !Conf['Thread Excerpt'] return if g.VIEW isnt 'thread' or !Conf['Thread Excerpt']
Thread::callbacks.push Thread.callbacks.push
name: 'Thread Excerpt' name: 'Thread Excerpt'
cb: @node cb: @node
node: -> node: ->

View File

@ -9,7 +9,7 @@ ThreadStats =
@fileCountEl = $ '#file-count', @dialog @fileCountEl = $ '#file-count', @dialog
@pageCountEl = $ '#page-count', @dialog @pageCountEl = $ '#page-count', @dialog
Thread::callbacks.push Thread.callbacks.push
name: 'Thread Stats' name: 'Thread Stats'
cb: @node cb: @node
node: -> node: ->

View File

@ -16,7 +16,7 @@ ThreadUpdater =
@status = $ '#update-status', @dialog @status = $ '#update-status', @dialog
@isUpdating = Conf['Auto Update'] @isUpdating = Conf['Auto Update']
Thread::callbacks.push Thread.callbacks.push
name: 'Thread Updater' name: 'Thread Updater'
cb: @node cb: @node

View File

@ -19,7 +19,7 @@ ThreadWatcher =
ThreadWatcher.fetchAllStatus() ThreadWatcher.fetchAllStatus()
@db.save() @db.save()
Thread::callbacks.push Thread.callbacks.push
name: 'Thread Watcher' name: 'Thread Watcher'
cb: @node cb: @node
node: -> node: ->

View File

@ -8,7 +8,7 @@ Unread =
@posts = [] @posts = []
@postsQuotingYou = [] @postsQuotingYou = []
Thread::callbacks.push Thread.callbacks.push
name: 'Unread' name: 'Unread'
cb: @node cb: @node

View File

@ -9,7 +9,7 @@ QR =
$.on d, '4chanXInitFinished', @initReady $.on d, '4chanXInitFinished', @initReady
Post::callbacks.push Post.callbacks.push
name: 'Quick Reply' name: 'Quick Reply'
cb: @node cb: @node

View File

@ -16,10 +16,10 @@ QuoteBacklink =
format = Conf['backlink'].replace /%id/g, "' + id + '" format = Conf['backlink'].replace /%id/g, "' + id + '"
@funk = Function 'id', "return '#{format}'" @funk = Function 'id', "return '#{format}'"
@containers = {} @containers = {}
Post::callbacks.push Post.callbacks.push
name: 'Quote Backlinking Part 1' name: 'Quote Backlinking Part 1'
cb: @firstNode cb: @firstNode
Post::callbacks.push Post.callbacks.push
name: 'Quote Backlinking Part 2' name: 'Quote Backlinking Part 2'
cb: @secondNode cb: @secondNode
firstNode: -> firstNode: ->

View File

@ -4,7 +4,7 @@ QuoteCT =
# \u00A0 is nbsp # \u00A0 is nbsp
@text = '\u00A0(Cross-thread)' @text = '\u00A0(Cross-thread)'
Post::callbacks.push Post.callbacks.push
name: 'Mark Cross-thread Quotes' name: 'Mark Cross-thread Quotes'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ QuoteInline =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Quote Inlining'] return if g.VIEW is 'catalog' or !Conf['Quote Inlining']
Post::callbacks.push Post.callbacks.push
name: 'Quote Inlining' name: 'Quote Inlining'
cb: @node cb: @node
node: -> node: ->

View File

@ -4,7 +4,7 @@ QuoteOP =
# \u00A0 is nbsp # \u00A0 is nbsp
@text = '\u00A0(OP)' @text = '\u00A0(OP)'
Post::callbacks.push Post.callbacks.push
name: 'Mark OP Quotes' name: 'Mark OP Quotes'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ QuotePreview =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Quote Previewing'] return if g.VIEW is 'catalog' or !Conf['Quote Previewing']
Post::callbacks.push Post.callbacks.push
name: 'Quote Previewing' name: 'Quote Previewing'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ QuoteStrikeThrough =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] and !Conf['Filter'] return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] and !Conf['Filter']
Post::callbacks.push Post.callbacks.push
name: 'Strike-through Quotes' name: 'Strike-through Quotes'
cb: @node cb: @node

View File

@ -4,7 +4,7 @@ QuoteYou =
# \u00A0 is nbsp # \u00A0 is nbsp
@text = '\u00A0(You)' @text = '\u00A0(You)'
Post::callbacks.push Post.callbacks.push
name: 'Mark Quotes of You' name: 'Mark Quotes of You'
cb: @node cb: @node
node: -> node: ->

View File

@ -2,7 +2,7 @@ Quotify =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Resurrect Quotes'] return if g.VIEW is 'catalog' or !Conf['Resurrect Quotes']
Post::callbacks.push Post.callbacks.push
name: 'Resurrect Quotes' name: 'Resurrect Quotes'
cb: @node cb: @node
node: -> node: ->