diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 6542b4f78..7dc4c1478 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -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 diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index c19b36dee..e06bcbfb6 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -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' diff --git a/src/css/style.css b/src/css/style.css index 4799ce273..50d7fa1d3 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -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;