Use boards.json to determine whether to activate [code] and [math] tag related functions. #525
This commit is contained in:
parent
45e5cda2da
commit
c5d01ce6d6
@ -2,9 +2,6 @@ ExpandComment =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW isnt 'index' or !Conf['Comment Expansion'] or Conf['JSON Index']
|
return if g.VIEW isnt 'index' or !Conf['Comment Expansion'] or Conf['JSON Index']
|
||||||
|
|
||||||
@callbacks.push Fourchan.code if g.BOARD.ID is 'g'
|
|
||||||
@callbacks.push Fourchan.math if g.BOARD.ID is 'sci'
|
|
||||||
|
|
||||||
Callbacks.Post.push
|
Callbacks.Post.push
|
||||||
name: 'Comment Expansion'
|
name: 'Comment Expansion'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
Fourchan =
|
Fourchan =
|
||||||
init: ->
|
init: ->
|
||||||
return unless g.VIEW in ['index', 'thread', 'archive']
|
return unless Site.software is 'yotsuba' and g.VIEW in ['index', 'thread', 'archive']
|
||||||
|
BoardConfig.ready @initBoard
|
||||||
|
Main.ready @initReady
|
||||||
|
|
||||||
if g.BOARD.ID is 'g'
|
initBoard: ->
|
||||||
|
if g.BOARD.config.code_tags
|
||||||
$.on window, 'prettyprint:cb', (e) ->
|
$.on window, 'prettyprint:cb', (e) ->
|
||||||
return if not (post = g.posts[e.detail.ID])
|
return if not (post = g.posts[e.detail.ID])
|
||||||
return if not (pre = $$('.prettyprint', post.nodes.comment)[e.detail.i])
|
return if not (pre = $$('.prettyprint', post.nodes.comment)[e.detail.i])
|
||||||
@ -21,10 +24,12 @@ Fourchan =
|
|||||||
}, false);
|
}, false);
|
||||||
'''
|
'''
|
||||||
Callbacks.Post.push
|
Callbacks.Post.push
|
||||||
name: 'Parse /g/ code'
|
name: 'Parse [code] tags'
|
||||||
cb: @code
|
cb: Fourchan.code
|
||||||
|
g.posts.forEach (post) -> Callbacks.Post.execute post, ['Parse [code] tags'], true
|
||||||
|
ExpandComment.callbacks.push Fourchan.code
|
||||||
|
|
||||||
if g.BOARD.ID is 'sci'
|
if g.BOARD.config.math_tags
|
||||||
$.global ->
|
$.global ->
|
||||||
window.addEventListener 'mathjax', (e) ->
|
window.addEventListener 'mathjax', (e) ->
|
||||||
if window.MathJax
|
if window.MathJax
|
||||||
@ -40,16 +45,18 @@ Fourchan =
|
|||||||
, false
|
, false
|
||||||
, false
|
, false
|
||||||
Callbacks.Post.push
|
Callbacks.Post.push
|
||||||
name: 'Parse /sci/ math'
|
name: 'Parse [math] tags'
|
||||||
cb: @math
|
cb: Fourchan.math
|
||||||
|
g.posts.forEach (post) -> Callbacks.Post.execute post, ['Parse [math] tags'], true
|
||||||
|
ExpandComment.callbacks.push Fourchan.math
|
||||||
|
|
||||||
# Disable 4chan's ID highlighting (replaced by IDHighlight) and reported post hiding.
|
# Disable 4chan's ID highlighting (replaced by IDHighlight) and reported post hiding.
|
||||||
Main.ready ->
|
initReady: ->
|
||||||
$.global ->
|
$.global ->
|
||||||
window.clickable_ids = false
|
window.clickable_ids = false
|
||||||
for node in document.querySelectorAll '.posteruid, .capcode'
|
for node in document.querySelectorAll '.posteruid, .capcode'
|
||||||
node.removeEventListener 'click', window.idClick, false
|
node.removeEventListener 'click', window.idClick, false
|
||||||
return
|
return
|
||||||
|
|
||||||
code: ->
|
code: ->
|
||||||
return if @isClone
|
return if @isClone
|
||||||
|
|||||||
@ -10,8 +10,8 @@ class Callbacks
|
|||||||
@keys.push name unless @[name]
|
@keys.push name unless @[name]
|
||||||
@[name] = cb
|
@[name] = cb
|
||||||
|
|
||||||
execute: (node, keys=@keys) ->
|
execute: (node, keys=@keys, force) ->
|
||||||
return if node.callbacksExecuted
|
return if node.callbacksExecuted and !force
|
||||||
node.callbacksExecuted = true
|
node.callbacksExecuted = true
|
||||||
for name in keys
|
for name in keys
|
||||||
try
|
try
|
||||||
|
|||||||
@ -9,7 +9,6 @@ SW.tinyboard =
|
|||||||
'Image Host Rewriting'
|
'Image Host Rewriting'
|
||||||
'Index Generator'
|
'Index Generator'
|
||||||
'Announcement Hiding'
|
'Announcement Hiding'
|
||||||
'Fourchan thingies'
|
|
||||||
'Resurrect Quotes'
|
'Resurrect Quotes'
|
||||||
'Quick Reply Personas'
|
'Quick Reply Personas'
|
||||||
'Quick Reply'
|
'Quick Reply'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user