temporary fix optional chaining before =

This commit is contained in:
Tuxedo Takodachi 2023-02-23 21:28:52 +01:00
parent 60ae31ead0
commit 8b0f4b5b7f
6 changed files with 14 additions and 7 deletions

View File

@ -588,7 +588,8 @@ Index =
# Optional notification for manual refreshes
Index.notice or= new Notice 'info', 'Refreshing index...'
Index.nTimeout or= setTimeout ->
Index.notice?.el.lastElementChild.textContent += ' (disable JSON Index if this takes too long)'
# TODO check if notice exists
Index.notice.el.lastElementChild.textContent += ' (disable JSON Index if this takes too long)'
, 3 * $.SECOND
else
# Also display notice if Index Refresh is taking too long

View File

@ -5,11 +5,13 @@ Volume =
$.sync 'Allow Sound', (x) ->
Conf['Allow Sound'] = x
Volume.inputs?.unmute.checked = x
# TODO check if inputs exits
Volume.inputs.unmute.checked = x
$.sync 'Default Volume', (x) ->
Conf['Default Volume'] = x
Volume.inputs?.volume.value = x
# TODO check if inputs exits
Volume.inputs.volume.value = x
if Conf['Mouse Wheel Volume']
Callbacks.Post.push

View File

@ -59,4 +59,5 @@ PSAHiding =
$.add content, [psa.childNodes...]
else
$.add psa, [content.childNodes...]
PSAHiding.hr?.hidden = psa.hidden
# TODO check if hr exists
PSAHiding.hr.hidden = psa.hidden

View File

@ -77,7 +77,8 @@ ThreadStats =
{thread, postCountEl, fileCountEl, ipCountEl} = ThreadStats
postCountEl.textContent = ThreadStats.postCount
fileCountEl.textContent = ThreadStats.fileCount
ipCountEl?.textContent = thread.ipCount ? '?'
# TOTO check if ipCountEl exists
ipCountEl.textContent = thread.ipCount ? '?'
postCountEl.classList.toggle 'warning', (thread.postLimit and !thread.isSticky)
fileCountEl.classList.toggle 'warning', (thread.fileLimit and !thread.isSticky)

View File

@ -786,7 +786,8 @@ QR =
post.unlock()
if (err = @response?.getElementById 'errmsg') # error!
$('a', err)?.target = '_blank' # duplicate image link
# TODO: check if exists
$('a', err).target = '_blank' # duplicate image link
else if (connErr = (!@response or @response.title isnt 'Post successful!'))
err = QR.connectionError()
Captcha.cache.save QR.currentCaptcha if QR.captcha is Captcha.v2 and QR.currentCaptcha

View File

@ -223,7 +223,8 @@ Main =
return if !Main.isThisPageLegit()
# disable the mobile layout
$('link[href*=mobile]', d.head)?.disabled = true
# TODO check if exists
$('link[href*=mobile]', d.head).disabled = true
doc.dataset.host = location.host
$.addClass doc, "sw-#{g.SITE.software}"
$.addClass doc, if g.VIEW is 'thread' then 'thread-view' else g.VIEW