Merge branch 'boardconfig'

This commit is contained in:
ccd0 2016-07-10 02:27:43 -07:00
commit 9fdc7b6acf
3 changed files with 19 additions and 19 deletions

View File

@ -253,12 +253,14 @@ Keybinds =
QR.nodes.com.focus()
tags: (tag, ta) ->
supported = switch tag
when 'spoiler' then !!$ '.postForm input[name=spoiler]'
when 'code' then g.BOARD.ID is 'g'
when 'math', 'eqn' then g.BOARD.ID is 'sci'
when 'sjis' then g.BOARD.ID is 'jp'
new Notice 'warning', "[#{tag}] tags are not supported on /#{g.BOARD}/.", 20 unless supported
BoardConfig.ready ->
{config} = g.BOARD
supported = switch tag
when 'spoiler' then !!config.spoilers
when 'code' then !!config.code_tags
when 'math', 'eqn' then !!config.math_tags
when 'sjis' then !!config.sjis_tags
new Notice 'warning', "[#{tag}] tags are not supported on /#{g.BOARD}/.", 20 unless supported
value = ta.value
selStart = ta.selectionStart

View File

@ -31,7 +31,7 @@ QR =
version = if Conf['Use Recaptcha v1'] and Main.jsEnabled then 'v1' else 'v2'
@captcha = Captcha[version]
$.on d, '4chanXInitFinished', @initReady
$.on d, '4chanXInitFinished', -> BoardConfig.ready QR.initReady
Callbacks.Post.push
name: 'Quick Reply'
@ -53,7 +53,6 @@ QR =
Header.addShortcut 'qr', sc, 540
initReady: ->
$.off d, '4chanXInitFinished', @initReady
QR.postingIsEnabled = !!$.id 'postForm'
return unless QR.postingIsEnabled
@ -483,16 +482,15 @@ QR =
if Conf['Show New Thread Option in Threads']
$.addClass QR.nodes.el, 'show-new-thread-option'
{config} = g.BOARD
{classList} = QR.nodes.el
QR.forcedAnon = !!$ 'form[name="post"] input[name="name"][type="hidden"]'
if QR.forcedAnon
$.addClass QR.nodes.el, 'forced-anon'
QR.spoiler = !!$ '.postForm input[name=spoiler]'
if QR.spoiler
$.addClass QR.nodes.el, 'has-spoiler'
if g.BOARD.ID is 'jp' and Conf['sjisPreview']
$.addClass QR.nodes.el, 'sjis-preview'
QR.spoiler = !!config.spoilers
classList.toggle 'forced-anon', QR.forcedAnon
classList.toggle 'has-spoiler', QR.spoiler
classList.toggle 'has-sjis', !!config.sjis_tags
classList.toggle 'has-math', !!config.math_tags
classList.toggle 'sjis-preview', !!config.sjis_tags and Conf['sjisPreview']
if parseInt(Conf['customCooldown'], 10) > 0
$.addClass QR.nodes.fileSubmit, 'custom-cooldown'

View File

@ -1314,8 +1314,8 @@ input[name="Default Volume"] {
#qr.reply-to-thread input[data-name="sub"]:not(.force-show),
body:not(.board_f) #qr select[name="filetag"],
#qr.reply-to-thread select[name="filetag"],
body:not(.board_jp) #sjis-toggle,
body:not(.board_sci) #tex-preview-button,
#qr:not(.has-sjis) #sjis-toggle,
#qr:not(.has-math) #tex-preview-button,
#qr.tex-preview .textarea > :not(#tex-preview),
#qr:not(.tex-preview) #tex-preview {
display: none;