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

View File

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