From 8b0f4b5b7fca17d849e3df3adbf5c058e129c3c9 Mon Sep 17 00:00:00 2001 From: Tuxedo Takodachi Date: Thu, 23 Feb 2023 21:28:52 +0100 Subject: [PATCH] temporary fix optional chaining before = --- src/General/Index.coffee | 3 ++- src/Images/Volume.coffee | 6 ++++-- src/Miscellaneous/PSAHiding.coffee | 3 ++- src/Monitoring/ThreadStats.coffee | 3 ++- src/Posting/QR.coffee | 3 ++- src/main/Main.coffee | 3 ++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 52cee8cfa..6e25a0241 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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 diff --git a/src/Images/Volume.coffee b/src/Images/Volume.coffee index 2979090f0..9b291511b 100644 --- a/src/Images/Volume.coffee +++ b/src/Images/Volume.coffee @@ -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 diff --git a/src/Miscellaneous/PSAHiding.coffee b/src/Miscellaneous/PSAHiding.coffee index b04058b40..4c39b3ba4 100644 --- a/src/Miscellaneous/PSAHiding.coffee +++ b/src/Miscellaneous/PSAHiding.coffee @@ -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 diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index c06b01ad6..717602f38 100644 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -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) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 1d64e54d0..0c4758f04 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -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 diff --git a/src/main/Main.coffee b/src/main/Main.coffee index d9f232e43..040dcc8b7 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -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