diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 37e91e3d9..0b64c3007 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -13,6 +13,14 @@ Main = $.ready -> Captcha.fixes.init() return + # Detect multiple copies of 4chan X + $.on d, '4chanXInitFinished', -> + if Main.expectInitFinished + delete Main.expectInitFinished + else + new Notice 'error', 'Error: Multiple copies of 4chan X are enabled.' + $.addClass doc, 'tainted' + # Flatten default values from Config into Conf flatten = (parent, obj) -> if obj instanceof Array @@ -150,7 +158,7 @@ Main = $.ready Main.initReady initStyle: -> - return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x' + return if !Main.isThisPageLegit() # disable the mobile layout $('link[href*=mobile]', d.head)?.disabled = true @@ -206,6 +214,7 @@ Main = unless Conf['JSON Navigation'] and g.VIEW is 'index' Main.initThread() else + Main.expectInitFinished = true $.event '4chanXInitFinished' initThread: -> @@ -237,9 +246,11 @@ Main = Main.callbackNodes Thread, threads Main.callbackNodesDB Post, posts, -> QuoteThreading.insert post for post in posts + Main.expectInitFinished = true $.event '4chanXInitFinished' else + Main.expectInitFinished = true $.event '4chanXInitFinished' callbackNodes: (klass, nodes) -> @@ -318,7 +329,7 @@ Main = """ details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths url = "<%= meta.newIssue.replace('%title', '#{encodeURIComponent title}').replace('%details', '#{encodeURIComponent details}') %>" - <%= html(' [report]') %> + <%= html(' [report]') %> isThisPageLegit: -> # 404 error page or similar. diff --git a/src/css/style.css b/src/css/style.css index a16ec7ce1..f944b459f 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -444,6 +444,9 @@ audio.controls-added { .message a { text-decoration: underline; } +:root.tainted .report-error { + display: none; +} /* Settings */ :root.fourchan-x body {