Detect multiple instances of 4chan X. #462
This commit is contained in:
parent
602a52897d
commit
d97a2c1d60
@ -13,6 +13,14 @@ Main =
|
|||||||
$.ready -> Captcha.fixes.init()
|
$.ready -> Captcha.fixes.init()
|
||||||
return
|
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 default values from Config into Conf
|
||||||
flatten = (parent, obj) ->
|
flatten = (parent, obj) ->
|
||||||
if obj instanceof Array
|
if obj instanceof Array
|
||||||
@ -150,7 +158,7 @@ Main =
|
|||||||
$.ready Main.initReady
|
$.ready Main.initReady
|
||||||
|
|
||||||
initStyle: ->
|
initStyle: ->
|
||||||
return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x'
|
return if !Main.isThisPageLegit()
|
||||||
|
|
||||||
# disable the mobile layout
|
# disable the mobile layout
|
||||||
$('link[href*=mobile]', d.head)?.disabled = true
|
$('link[href*=mobile]', d.head)?.disabled = true
|
||||||
@ -206,6 +214,7 @@ Main =
|
|||||||
unless Conf['JSON Navigation'] and g.VIEW is 'index'
|
unless Conf['JSON Navigation'] and g.VIEW is 'index'
|
||||||
Main.initThread()
|
Main.initThread()
|
||||||
else
|
else
|
||||||
|
Main.expectInitFinished = true
|
||||||
$.event '4chanXInitFinished'
|
$.event '4chanXInitFinished'
|
||||||
|
|
||||||
initThread: ->
|
initThread: ->
|
||||||
@ -237,9 +246,11 @@ Main =
|
|||||||
Main.callbackNodes Thread, threads
|
Main.callbackNodes Thread, threads
|
||||||
Main.callbackNodesDB Post, posts, ->
|
Main.callbackNodesDB Post, posts, ->
|
||||||
QuoteThreading.insert post for post in posts
|
QuoteThreading.insert post for post in posts
|
||||||
|
Main.expectInitFinished = true
|
||||||
$.event '4chanXInitFinished'
|
$.event '4chanXInitFinished'
|
||||||
|
|
||||||
else
|
else
|
||||||
|
Main.expectInitFinished = true
|
||||||
$.event '4chanXInitFinished'
|
$.event '4chanXInitFinished'
|
||||||
|
|
||||||
callbackNodes: (klass, nodes) ->
|
callbackNodes: (klass, nodes) ->
|
||||||
@ -318,7 +329,7 @@ Main =
|
|||||||
"""
|
"""
|
||||||
details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths
|
details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths
|
||||||
url = "<%= meta.newIssue.replace('%title', '#{encodeURIComponent title}').replace('%details', '#{encodeURIComponent details}') %>"
|
url = "<%= meta.newIssue.replace('%title', '#{encodeURIComponent title}').replace('%details', '#{encodeURIComponent details}') %>"
|
||||||
<%= html(' [<a href="${url}" target="_blank">report</a>]') %>
|
<%= html('<span class="report-error"> [<a href="${url}" target="_blank">report</a>]</span>') %>
|
||||||
|
|
||||||
isThisPageLegit: ->
|
isThisPageLegit: ->
|
||||||
# 404 error page or similar.
|
# 404 error page or similar.
|
||||||
|
|||||||
@ -444,6 +444,9 @@ audio.controls-added {
|
|||||||
.message a {
|
.message a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
:root.tainted .report-error {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Settings */
|
/* Settings */
|
||||||
:root.fourchan-x body {
|
:root.fourchan-x body {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user