Remove dependency of Post, Thread, CatalogThread classes on Callbacks class.
This commit is contained in:
parent
070af1c3f2
commit
f1b82d013f
5
Makefile
5
Makefile
@ -40,12 +40,9 @@ sources_API := \
|
|||||||
src/Images/ImageCommon.coffee
|
src/Images/ImageCommon.coffee
|
||||||
|
|
||||||
sources_classes := \
|
sources_classes := \
|
||||||
src/classes/Callbacks.coffee \
|
|
||||||
src/classes/CatalogThread.coffee \
|
|
||||||
src/classes/Post.coffee src/classes/Clone.coffee \
|
src/classes/Post.coffee src/classes/Clone.coffee \
|
||||||
src/classes/Thread.coffee \
|
|
||||||
$(filter-out \
|
$(filter-out \
|
||||||
%/Callbacks.coffee %/CatalogThread.coffee %/Post.coffee %/Clone.coffee %/Thread.coffee \
|
%/Post.coffee %/Clone.coffee \
|
||||||
,$(call sort_dir,classes))
|
,$(call sort_dir,classes))
|
||||||
|
|
||||||
sources_General := \
|
sources_General := \
|
||||||
|
|||||||
@ -3,7 +3,7 @@ Anonymize =
|
|||||||
return unless g.VIEW in ['index', 'thread', 'archive'] and Conf['Anonymize']
|
return unless g.VIEW in ['index', 'thread', 'archive'] and Conf['Anonymize']
|
||||||
return @archive() if g.VIEW is 'archive'
|
return @archive() if g.VIEW is 'archive'
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Anonymize'
|
name: 'Anonymize'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ Filter =
|
|||||||
delete @filters[key]
|
delete @filters[key]
|
||||||
|
|
||||||
return unless Object.keys(@filters).length
|
return unless Object.keys(@filters).length
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Filter'
|
name: 'Filter'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ PostHiding =
|
|||||||
$.addClass doc, "reply-hide"
|
$.addClass doc, "reply-hide"
|
||||||
|
|
||||||
@db = new DataBoard 'hiddenPosts'
|
@db = new DataBoard 'hiddenPosts'
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Reply Hiding'
|
name: 'Reply Hiding'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ Recursive =
|
|||||||
recursives: {}
|
recursives: {}
|
||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['index', 'thread']
|
return unless g.VIEW in ['index', 'thread']
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Recursive'
|
name: 'Recursive'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ ThreadHiding =
|
|||||||
@db = new DataBoard 'hiddenThreads'
|
@db = new DataBoard 'hiddenThreads'
|
||||||
return @catalogWatch() if g.VIEW is 'catalog'
|
return @catalogWatch() if g.VIEW is 'catalog'
|
||||||
@catalogSet g.BOARD
|
@catalogSet g.BOARD
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Thread Hiding'
|
name: 'Thread Hiding'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ Build.Test =
|
|||||||
Build.Test.postsRemaining--
|
Build.Test.postsRemaining--
|
||||||
Build.Test.report() if Build.Test.postsRemaining is 0
|
Build.Test.report() if Build.Test.postsRemaining is 0
|
||||||
post2.isFetchedQuote = true
|
post2.isFetchedQuote = true
|
||||||
Main.callbackNodes Post, [post2]
|
Main.callbackNodes 'Post', [post2]
|
||||||
|
|
||||||
testAll: ->
|
testAll: ->
|
||||||
g.posts.forEach (post) ->
|
g.posts.forEach (post) ->
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Index =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.BOARD.ID is 'f' or !Conf['JSON Index'] or g.VIEW isnt 'index'
|
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'
|
name: 'Catalog Features'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
@ -599,8 +599,8 @@ Index =
|
|||||||
|
|
||||||
# Add the threads in a container to make sure all features work.
|
# Add the threads in a container to make sure all features work.
|
||||||
$.nodes Index.nodes
|
$.nodes Index.nodes
|
||||||
Main.callbackNodes Thread, threads
|
Main.callbackNodes 'Thread', threads
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes 'Post', posts
|
||||||
Index.updateHideLabel()
|
Index.updateHideLabel()
|
||||||
$.event 'IndexRefresh'
|
$.event 'IndexRefresh'
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ Index =
|
|||||||
$.add threadRoot, nodes
|
$.add threadRoot, nodes
|
||||||
|
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes 'Post', posts
|
||||||
|
|
||||||
buildCatalogViews: ->
|
buildCatalogViews: ->
|
||||||
threads = Index.sortedNodes
|
threads = Index.sortedNodes
|
||||||
@ -636,7 +636,7 @@ Index =
|
|||||||
catalogThreads = []
|
catalogThreads = []
|
||||||
for thread in threads when !thread.catalogView
|
for thread in threads when !thread.catalogView
|
||||||
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
||||||
Main.callbackNodes CatalogThread, catalogThreads
|
Main.callbackNodes 'CatalogThread', catalogThreads
|
||||||
threads.map (thread) -> thread.catalogView.nodes.root
|
threads.map (thread) -> thread.catalogView.nodes.root
|
||||||
|
|
||||||
sizeCatalogViews: (nodes) ->
|
sizeCatalogViews: (nodes) ->
|
||||||
|
|||||||
@ -291,8 +291,8 @@ Main =
|
|||||||
threads[0].fileLimit = /\bimagelimit *= *1\b/.test scriptData
|
threads[0].fileLimit = /\bimagelimit *= *1\b/.test scriptData
|
||||||
threads[0].ipCount = if m = scriptData.match /\bunique_ips *= *(\d+)\b/ then +m[1]
|
threads[0].ipCount = if m = scriptData.match /\bunique_ips *= *(\d+)\b/ then +m[1]
|
||||||
|
|
||||||
Main.callbackNodes Thread, threads
|
Main.callbackNodes 'Thread', threads
|
||||||
Main.callbackNodesDB Post, posts, ->
|
Main.callbackNodesDB 'Post', posts, ->
|
||||||
QuoteThreading.insert post for post in posts
|
QuoteThreading.insert post for post in posts
|
||||||
Main.expectInitFinished = true
|
Main.expectInitFinished = true
|
||||||
$.event '4chanXInitFinished'
|
$.event '4chanXInitFinished'
|
||||||
@ -303,14 +303,14 @@ Main =
|
|||||||
|
|
||||||
callbackNodes: (klass, nodes) ->
|
callbackNodes: (klass, nodes) ->
|
||||||
i = 0
|
i = 0
|
||||||
cb = klass.callbacks
|
cb = Callbacks[klass]
|
||||||
while node = nodes[i++]
|
while node = nodes[i++]
|
||||||
cb.execute node
|
cb.execute node
|
||||||
return
|
return
|
||||||
|
|
||||||
callbackNodesDB: (klass, nodes, cb) ->
|
callbackNodesDB: (klass, nodes, cb) ->
|
||||||
i = 0
|
i = 0
|
||||||
cbs = klass.callbacks
|
cbs = Callbacks[klass]
|
||||||
fn = ->
|
fn = ->
|
||||||
return false unless node = nodes[i]
|
return false unless node = nodes[i]
|
||||||
cbs.execute node
|
cbs.execute node
|
||||||
|
|||||||
@ -23,11 +23,11 @@ FappeTyme =
|
|||||||
if Conf['Werk Tyme']
|
if Conf['Werk Tyme']
|
||||||
$.sync 'werk', @set.bind(@, 'werk')
|
$.sync 'werk', @set.bind(@, 'werk')
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Fappe Tyme'
|
name: 'Fappe Tyme'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Werk Tyme'
|
name: 'Werk Tyme'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Gallery =
|
|||||||
|
|
||||||
Header.addShortcut el
|
Header.addShortcut el
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Gallery'
|
name: 'Gallery'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ ImageExpand =
|
|||||||
@videoControls = $.el 'span', className: 'video-controls'
|
@videoControls = $.el 'span', className: 'video-controls'
|
||||||
$.extend @videoControls, <%= html('\u00A0<a href="javascript:;" title="You can also contract the video by dragging it to the left.">contract</a>') %>
|
$.extend @videoControls, <%= html('\u00A0<a href="javascript:;" title="You can also contract the video by dragging it to the left.">contract</a>') %>
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Image Expansion'
|
name: 'Image Expansion'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,11 @@ ImageHover =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW not in ['index', 'thread']
|
return if g.VIEW not in ['index', 'thread']
|
||||||
if Conf['Image Hover']
|
if Conf['Image Hover']
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Image Hover'
|
name: 'Image Hover'
|
||||||
cb: @node
|
cb: @node
|
||||||
if Conf['Image Hover in Catalog']
|
if Conf['Image Hover in Catalog']
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Image Hover'
|
name: 'Image Hover'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ ImageLoader =
|
|||||||
return unless Conf['Image Prefetching'] or
|
return unless Conf['Image Prefetching'] or
|
||||||
Conf['Replace JPG'] or Conf['Replace PNG'] or Conf['Replace GIF'] or Conf['Replace WEBM']
|
Conf['Replace JPG'] or Conf['Replace PNG'] or Conf['Replace GIF'] or Conf['Replace WEBM']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Image Replace'
|
name: 'Image Replace'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ Metadata =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless Conf['WEBM Metadata'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
|
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'
|
name: 'WEBM Metadata'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ RevealSpoilers =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['index', 'thread'] and Conf['Reveal Spoiler Thumbnails']
|
return unless g.VIEW in ['index', 'thread'] and Conf['Reveal Spoiler Thumbnails']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Reveal Spoiler Thumbnails'
|
name: 'Reveal Spoiler Thumbnails'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Sauce =
|
|||||||
@link = $.el 'a',
|
@link = $.el 'a',
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
className: 'sauce'
|
className: 'sauce'
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Sauce'
|
name: 'Sauce'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -12,14 +12,14 @@ Volume =
|
|||||||
Volume.inputs?.volume.value = x
|
Volume.inputs?.volume.value = x
|
||||||
|
|
||||||
if Conf['Mouse Wheel Volume']
|
if Conf['Mouse Wheel Volume']
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Mouse Wheel Volume'
|
name: 'Mouse Wheel Volume'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
return unless g.BOARD.ID in ['gif', 'wsg']
|
return unless g.BOARD.ID in ['gif', 'wsg']
|
||||||
|
|
||||||
if Conf['Mouse Wheel Volume']
|
if Conf['Mouse Wheel Volume']
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Mouse Wheel Volume'
|
name: 'Mouse Wheel Volume'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,11 @@ Linkify =
|
|||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Linkify'
|
name: 'Linkify'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Linkify'
|
name: 'Linkify'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -9,11 +9,11 @@ Menu =
|
|||||||
$.extend @button, <%= html('<i class="fa fa-angle-down"></i>') %>
|
$.extend @button, <%= html('<i class="fa fa-angle-down"></i>') %>
|
||||||
|
|
||||||
@menu = new UI.Menu 'post'
|
@menu = new UI.Menu 'post'
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Menu'
|
name: 'Menu'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Menu'
|
name: 'Menu'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,10 @@ AntiAutoplay =
|
|||||||
$.addClass doc, 'anti-autoplay'
|
$.addClass doc, 'anti-autoplay'
|
||||||
@stop audio for audio in $$ 'audio[autoplay]', doc
|
@stop audio for audio in $$ 'audio[autoplay]', doc
|
||||||
window.addEventListener 'loadstart', ((e) => @stop e.target), true
|
window.addEventListener 'loadstart', ((e) => @stop e.target), true
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Disable Autoplaying Sounds'
|
name: 'Disable Autoplaying Sounds'
|
||||||
cb: @node
|
cb: @node
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Disable Autoplaying Sounds'
|
name: 'Disable Autoplaying Sounds'
|
||||||
cb: @node
|
cb: @node
|
||||||
$.ready => @process d.body
|
$.ready => @process d.body
|
||||||
|
|||||||
@ -21,10 +21,10 @@ CatalogLinks =
|
|||||||
return
|
return
|
||||||
|
|
||||||
if Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog']
|
if Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog']
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Catalog Link Rewrite'
|
name: 'Catalog Link Rewrite'
|
||||||
cb: @node
|
cb: @node
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Catalog Link Rewrite'
|
name: 'Catalog Link Rewrite'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ ExpandComment =
|
|||||||
@callbacks.push Fourchan.code if g.BOARD.ID is 'g'
|
@callbacks.push Fourchan.code if g.BOARD.ID is 'g'
|
||||||
@callbacks.push Fourchan.math if g.BOARD.ID is 'sci'
|
@callbacks.push Fourchan.math if g.BOARD.ID is 'sci'
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Comment Expansion'
|
name: 'Comment Expansion'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ ExpandThread =
|
|||||||
if Conf['JSON Index']
|
if Conf['JSON Index']
|
||||||
$.on d, 'IndexRefresh', @onIndexRefresh
|
$.on d, 'IndexRefresh', @onIndexRefresh
|
||||||
else
|
else
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Expand Thread'
|
name: 'Expand Thread'
|
||||||
cb: -> ExpandThread.setButton @
|
cb: -> ExpandThread.setButton @
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ ExpandThread =
|
|||||||
filesCount++ if 'file' of post
|
filesCount++ if 'file' of post
|
||||||
posts.push post
|
posts.push post
|
||||||
postsRoot.push root
|
postsRoot.push root
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes 'Post', posts
|
||||||
$.after a, postsRoot
|
$.after a, postsRoot
|
||||||
$.event 'PostsInserted'
|
$.event 'PostsInserted'
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ FileInfo =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW not in ['index', 'thread'] or !Conf['File Info Formatting']
|
return if g.VIEW not in ['index', 'thread'] or !Conf['File Info Formatting']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'File Info Formatting'
|
name: 'File Info Formatting'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ Fourchan =
|
|||||||
}));
|
}));
|
||||||
}, false);
|
}, false);
|
||||||
'''
|
'''
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Parse /g/ code'
|
name: 'Parse /g/ code'
|
||||||
cb: @code
|
cb: @code
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ Fourchan =
|
|||||||
window.MathJax.Hub.Queue ['Typeset', window.MathJax.Hub, e.target]
|
window.MathJax.Hub.Queue ['Typeset', window.MathJax.Hub, e.target]
|
||||||
, false
|
, false
|
||||||
, false
|
, false
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Parse /sci/ math'
|
name: 'Parse /sci/ math'
|
||||||
cb: @math
|
cb: @math
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Parse /sci/ math'
|
name: 'Parse /sci/ math'
|
||||||
cb: @math
|
cb: @math
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ IDColor =
|
|||||||
Heaven: [0, 0, 0, '#fff']
|
Heaven: [0, 0, 0, '#fff']
|
||||||
}
|
}
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Color User IDs'
|
name: 'Color User IDs'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ IDHighlight =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['index', 'thread']
|
return unless g.VIEW in ['index', 'thread']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Highlight by User ID'
|
name: 'Highlight by User ID'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ RelativeDates =
|
|||||||
$.on d, 'visibilitychange ThreadUpdate', @flush
|
$.on d, 'visibilitychange ThreadUpdate', @flush
|
||||||
|
|
||||||
if Conf['Relative Post Dates']
|
if Conf['Relative Post Dates']
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Relative Post Dates'
|
name: 'Relative Post Dates'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,11 @@ RemoveSpoilers =
|
|||||||
|
|
||||||
return unless Conf['Remove Spoilers']
|
return unless Conf['Remove Spoilers']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Reveal Spoilers'
|
name: 'Reveal Spoilers'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Reveal Spoilers'
|
name: 'Reveal Spoilers'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@ ThreadLinks =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW is 'index' and Conf['Open Threads in New Tab']
|
return unless g.VIEW is 'index' and Conf['Open Threads in New Tab']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Thread Links'
|
name: 'Thread Links'
|
||||||
cb: @node
|
cb: @node
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Thread Links'
|
name: 'Thread Links'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ Time =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['index', 'thread'] and Conf['Time Formatting']
|
return unless g.VIEW in ['index', 'thread'] and Conf['Time Formatting']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Time Formatting'
|
name: 'Time Formatting'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
MarkNewIPs =
|
MarkNewIPs =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Mark New IPs']
|
return if g.VIEW isnt 'thread' or !Conf['Mark New IPs']
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Mark New IPs'
|
name: 'Mark New IPs'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ ReplyPruning =
|
|||||||
el: el
|
el: el
|
||||||
order: 190
|
order: 190
|
||||||
|
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Reply Pruning'
|
name: 'Reply Pruning'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ ThreadExcerpt =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.BOARD.ID isnt 'f' or g.VIEW isnt 'thread' or !Conf['Thread Excerpt']
|
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'
|
name: 'Thread Excerpt'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: -> d.title = Get.threadExcerpt @
|
node: -> d.title = Get.threadExcerpt @
|
||||||
|
|||||||
@ -33,7 +33,7 @@ ThreadStats =
|
|||||||
|
|
||||||
$.on @pageCountEl, 'click', ThreadStats.fetchPage if @pageCountEl
|
$.on @pageCountEl, 'click', ThreadStats.fetchPage if @pageCountEl
|
||||||
|
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Thread Stats'
|
name: 'Thread Stats'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ ThreadUpdater =
|
|||||||
order: 110
|
order: 110
|
||||||
subEntries: subEntries
|
subEntries: subEntries
|
||||||
|
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Thread Updater'
|
name: 'Thread Updater'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ ThreadUpdater =
|
|||||||
unreadCount = Unread.posts?.size
|
unreadCount = Unread.posts?.size
|
||||||
unreadQYCount = Unread.postsQuotingYou?.size
|
unreadQYCount = Unread.postsQuotingYou?.size
|
||||||
|
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes 'Post', posts
|
||||||
|
|
||||||
if d.hidden or not d.hasFocus()
|
if d.hidden or not d.hasFocus()
|
||||||
if Conf['Beep Quoting You'] and Unread.postsQuotingYou?.size > unreadQYCount
|
if Conf['Beep Quoting You'] and Unread.postsQuotingYou?.size > unreadQYCount
|
||||||
|
|||||||
@ -61,10 +61,10 @@ ThreadWatcher =
|
|||||||
$.on @el, 'click', @cb
|
$.on @el, 'click', @cb
|
||||||
true
|
true
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Thread Watcher'
|
name: 'Thread Watcher'
|
||||||
cb: @node
|
cb: @node
|
||||||
CatalogThread.callbacks.push
|
Callbacks.CatalogThread.push
|
||||||
name: 'Thread Watcher'
|
name: 'Thread Watcher'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
|
|||||||
@ -20,11 +20,11 @@ Unread =
|
|||||||
@order = new RandomAccessList()
|
@order = new RandomAccessList()
|
||||||
@position = null
|
@position = null
|
||||||
|
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Unread'
|
name: 'Unread'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Unread'
|
name: 'Unread'
|
||||||
cb: @addPost
|
cb: @addPost
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ QR =
|
|||||||
|
|
||||||
$.on d, '4chanXInitFinished', @initReady
|
$.on d, '4chanXInitFinished', @initReady
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Quick Reply'
|
name: 'Quick Reply'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -14,10 +14,10 @@ QuoteBacklink =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Backlinks']
|
return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Backlinks']
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Quote Backlinking Part 1'
|
name: 'Quote Backlinking Part 1'
|
||||||
cb: @firstNode
|
cb: @firstNode
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Quote Backlinking Part 2'
|
name: 'Quote Backlinking Part 2'
|
||||||
cb: @secondNode
|
cb: @secondNode
|
||||||
firstNode: ->
|
firstNode: ->
|
||||||
|
|||||||
@ -7,7 +7,7 @@ QuoteCT =
|
|||||||
|
|
||||||
# \u00A0 is nbsp
|
# \u00A0 is nbsp
|
||||||
@text = '\u00A0(Cross-thread)'
|
@text = '\u00A0(Cross-thread)'
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Mark Cross-thread Quotes'
|
name: 'Mark Cross-thread Quotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: ->
|
node: ->
|
||||||
|
|||||||
@ -5,7 +5,7 @@ QuoteInline =
|
|||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Quote Inlining'
|
name: 'Quote Inlining'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ QuoteOP =
|
|||||||
|
|
||||||
# \u00A0 is nbsp
|
# \u00A0 is nbsp
|
||||||
@text = '\u00A0(OP)'
|
@text = '\u00A0(OP)'
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Mark OP Quotes'
|
name: 'Mark OP Quotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ QuotePreview =
|
|||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Quote Previewing'
|
name: 'Quote Previewing'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ QuoteStrikeThrough =
|
|||||||
return unless g.VIEW in ['index', 'thread'] and
|
return unless g.VIEW in ['index', 'thread'] and
|
||||||
(Conf['Reply Hiding Buttons'] or (Conf['Menu'] and Conf['Reply Hiding Link']) or Conf['Filter'])
|
(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'
|
name: 'Strike-through Quotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -26,11 +26,11 @@ QuoteThreading =
|
|||||||
el: @controls
|
el: @controls
|
||||||
order: 99
|
order: 99
|
||||||
|
|
||||||
Thread.callbacks.push
|
Callbacks.Thread.push
|
||||||
name: 'Quote Threading'
|
name: 'Quote Threading'
|
||||||
cb: @setThread
|
cb: @setThread
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Quote Threading'
|
name: 'Quote Threading'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ QuoteYou =
|
|||||||
|
|
||||||
# \u00A0 is nbsp
|
# \u00A0 is nbsp
|
||||||
@text = '\u00A0(You)'
|
@text = '\u00A0(You)'
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Mark Quotes of You'
|
name: 'Mark Quotes of You'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Quotify =
|
|||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|
||||||
Post.callbacks.push
|
Callbacks.Post.push
|
||||||
name: 'Resurrect Quotes'
|
name: 'Resurrect Quotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
class Callbacks
|
class Callbacks
|
||||||
|
@Post = new Callbacks 'Post'
|
||||||
|
@Thread = new Callbacks 'Thread'
|
||||||
|
@CatalogThread = new Callbacks 'Catalog Thread'
|
||||||
|
|
||||||
constructor: (@type) ->
|
constructor: (@type) ->
|
||||||
@keys = []
|
@keys = []
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
class CatalogThread
|
class CatalogThread
|
||||||
@callbacks = new Callbacks 'Catalog Thread'
|
|
||||||
toString: -> @ID
|
toString: -> @ID
|
||||||
|
|
||||||
constructor: (root, @thread) ->
|
constructor: (root, @thread) ->
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class Fetcher
|
|||||||
# Stop here if the container has been removed while loading.
|
# Stop here if the container has been removed while loading.
|
||||||
return unless @root.parentNode
|
return unless @root.parentNode
|
||||||
clone = post.addClone @quoter.context, ($.hasClass @root, 'dialog')
|
clone = post.addClone @quoter.context, ($.hasClass @root, 'dialog')
|
||||||
Main.callbackNodes Clone, [clone]
|
Main.callbackNodes 'Post', [clone]
|
||||||
|
|
||||||
# Get rid of the side arrows/stubs.
|
# Get rid of the side arrows/stubs.
|
||||||
{nodes} = clone
|
{nodes} = clone
|
||||||
@ -79,7 +79,7 @@ class Fetcher
|
|||||||
new Thread @threadID, board
|
new Thread @threadID, board
|
||||||
post = new Post Build.postFromObject(post, @boardID), thread, board
|
post = new Post Build.postFromObject(post, @boardID), thread, board
|
||||||
post.isFetchedQuote = true
|
post.isFetchedQuote = true
|
||||||
Main.callbackNodes Post, [post]
|
Main.callbackNodes 'Post', [post]
|
||||||
@insert post
|
@insert post
|
||||||
|
|
||||||
archivedPost: ->
|
archivedPost: ->
|
||||||
@ -185,7 +185,7 @@ class Fetcher
|
|||||||
post.kill()
|
post.kill()
|
||||||
post.file.thumbURL = o.file.thumbURL if post.file
|
post.file.thumbURL = o.file.thumbURL if post.file
|
||||||
post.isFetchedQuote = true
|
post.isFetchedQuote = true
|
||||||
Main.callbackNodes Post, [post]
|
Main.callbackNodes 'Post', [post]
|
||||||
@insert post
|
@insert post
|
||||||
|
|
||||||
archiveTags:
|
archiveTags:
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
class Post
|
class Post
|
||||||
@callbacks = new Callbacks 'Post'
|
|
||||||
toString: -> @ID
|
toString: -> @ID
|
||||||
|
|
||||||
constructor: (root, @thread, @board) ->
|
constructor: (root, @thread, @board) ->
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
class Thread
|
class Thread
|
||||||
@callbacks = new Callbacks 'Thread'
|
|
||||||
toString: -> @ID
|
toString: -> @ID
|
||||||
|
|
||||||
constructor: (@ID, @board) ->
|
constructor: (@ID, @board) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user