From b8082e30921bfebcdd00aaabbe392ee531295e43 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 5 Dec 2015 17:49:24 -0800 Subject: [PATCH] Remove subtree argument from $.onExists. --- src/General/$.coffee | 8 ++++---- src/General/Main.coffee | 6 +++--- src/General/Settings.coffee | 4 ++-- src/Miscellaneous/Report.coffee | 4 ++-- src/Posting/Captcha.fixes.coffee | 2 +- src/Posting/Captcha.replace.coffee | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/General/$.coffee b/src/General/$.coffee index 24f136b39..572ae89cf 100644 --- a/src/General/$.coffee +++ b/src/General/$.coffee @@ -120,25 +120,25 @@ $.asap = (test, cb) -> else setTimeout $.asap, 25, test, cb -$.onExists = (root, selector, subtree, cb) -> +$.onExists = (root, selector, cb) -> if el = $ selector, root return cb el # XXX Edge doesn't notify MutationObservers of nodes added as document loads. if $.engine is 'edge' and d.readyState is 'loading' $.asap (-> d.readyState isnt 'loading' or $ selector, root), -> - $.onExists root, selector, subtree, cb + $.onExists root, selector, cb return observer = new MutationObserver -> if el = $ selector, root observer.disconnect() cb el - observer.observe root, {childList: true, subtree} + observer.observe root, {childList: true, subtree: true} $.addStyle = (css, id, test='head') -> style = $.el 'style', textContent: css style.id = id if id? - $.onExists doc, test, true, -> + $.onExists doc, test, -> $.add d.head, style style diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 9bccb09da..7c8a32e8e 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -85,7 +85,7 @@ Main = switch hostname when 'www.4chan.org' - $.onExists doc, 'body', false, -> $.addStyle Main.cssWWW + $.onExists doc, 'body', -> $.addStyle Main.cssWWW Captcha.replace.init() return when 'sys.4chan.org' @@ -132,7 +132,7 @@ Main = g.posts = new SimpleDict() # set up CSS when is completely loaded - $.onExists doc, 'body', false, Main.initStyle + $.onExists doc, 'body', Main.initStyle # c.time 'All initializations' for [name, feature] in Main.features @@ -158,7 +158,7 @@ Main = $.addClass doc, 'fourchan-x', 'seaweedchan' $.addClass doc, if g.VIEW is 'thread' then 'thread-view' else g.VIEW $.addClass doc, $.engine if $.engine - $.onExists doc, '.ad-cnt', true, (ad) -> $.onExists ad, 'img', true, -> $.addClass doc, 'ads-loaded' + $.onExists doc, '.ad-cnt', (ad) -> $.onExists ad, 'img', -> $.addClass doc, 'ads-loaded' $.addStyle Main.css, 'fourchanx-css' keyboard = false diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 7623318b4..51a53d555 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -28,7 +28,7 @@ Settings = settings.disableAll = true localStorage.setItem '4chan-settings', JSON.stringify settings else - $.onExists doc, 'body', false, -> + $.onExists doc, 'body', -> $.global -> window.Config.disableAll = true open: (openSection) -> @@ -106,7 +106,7 @@ Settings = Enable it on boards.4chan.org in your browser's privacy settings (may be listed as part of "local data" or "cookies"). """ ads: (cb) -> - $.onExists doc, '.ad-cnt', true, (ad) -> $.onExists ad, 'img', true, -> + $.onExists doc, '.ad-cnt', (ad) -> $.onExists ad, 'img', -> cb $.el 'li', <%= html( 'To protect yourself from malicious ads,' + diff --git a/src/Miscellaneous/Report.coffee b/src/Miscellaneous/Report.coffee index 49934947a..2ec4c11cd 100644 --- a/src/Miscellaneous/Report.coffee +++ b/src/Miscellaneous/Report.coffee @@ -39,13 +39,13 @@ Report = Report.fit 'body' if !Conf['Use Recaptcha v2 in Reports'] and Main.jsEnabled and d.cookie.indexOf('pass_enabled=1') < 0 - $.onExists d.body, '#recaptcha_image', true, (image) -> + $.onExists d.body, '#recaptcha_image', (image) -> # XXX Native reload-on-click breaks audio captcha. $.global -> document.getElementById('recaptcha_image').removeEventListener 'click', window.onAltCaptchaClick, false $.on image, 'click', -> if $.id 'recaptcha_challenge_image' $.global -> window.Recaptcha.reload() - $.onExists d.body, '#recaptcha_response_field', true, (field) -> + $.onExists d.body, '#recaptcha_response_field', (field) -> $.on field, 'keydown', (e) -> if e.keyCode is 8 and not field.value $.global -> window.Recaptcha.reload() diff --git a/src/Posting/Captcha.fixes.coffee b/src/Posting/Captcha.fixes.coffee index 4b26e5624..9d1d59dd3 100644 --- a/src/Posting/Captcha.fixes.coffee +++ b/src/Posting/Captcha.fixes.coffee @@ -49,7 +49,7 @@ Captcha.fixes = when 'fallback' then @initNoscript() initMain: -> - $.onExists d.body, '#recaptcha-anchor', true, (checkbox) -> + $.onExists d.body, '#recaptcha-anchor', (checkbox) -> focus = -> if d.hasFocus() and d.activeElement isnt checkbox checkbox.focus() diff --git a/src/Posting/Captcha.replace.coffee b/src/Posting/Captcha.replace.coffee index ee11c13a2..4c5f63807 100644 --- a/src/Posting/Captcha.replace.coffee +++ b/src/Posting/Captcha.replace.coffee @@ -18,9 +18,9 @@ Captcha.replace = if Conf['captchaLanguage'].trim() or Conf['Captcha Fixes'] if location.hostname is 'boards.4chan.org' - $.onExists doc, '#captchaFormPart', true, (node) -> $.onExists node, 'iframe', true, Captcha.replace.iframe + $.onExists doc, '#captchaFormPart', (node) -> $.onExists node, 'iframe', Captcha.replace.iframe else - $.onExists doc, 'iframe', true, Captcha.replace.iframe + $.onExists doc, 'iframe', Captcha.replace.iframe noscript: -> return unless (original = $ '#g-recaptcha, #captchaContainerAlt') and (noscript = $ 'noscript') @@ -61,7 +61,7 @@ Captcha.replace = script = $.el 'script', src: url $.add d.head, script - $.onExists d.body, 'iframe', true, Captcha.replace.autocopy + $.onExists d.body, 'iframe', Captcha.replace.autocopy iframe: (iframe) -> if (lang = Conf['captchaLanguage'].trim())