diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 0ca9fc619..970227583 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -189,6 +189,12 @@ Main = error: err Main.handleErrors errors if errors + if g.VIEW is 'thread' + scriptData = $('script:not([src])', d.head)?.textContent or '' + threads[0].postLimit = /\bbumplimit *= *1\b/.test scriptData + threads[0].fileLimit = /\bimagelimit *= *1\b/.test scriptData + threads[0].ipCount = if m = scriptData.match /\bunique_ips *= *(\d+)\b/ then +m[1] + Main.callbackNodes Thread, threads Main.callbackNodesDB Post, posts, -> $.event '4chanXInitFinished' diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index 8e847ca7a..b4a90c9cf 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -13,6 +13,7 @@ class Thread @isArchived = false @postLimit = false @fileLimit = false + @ipCount = undefined @OP = null @catalogView = null diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index 09332a834..59c10f093 100755 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -40,13 +40,9 @@ ThreadStats = postCount++ fileCount++ if post.file ThreadStats.lastPost = post.info.date if Conf["Page Count in Stats"] - for script in $$ 'script[type="text/javascript"]:not([src])', d.head - if m = script.textContent.match /\bvar unique_ips = (\d+);/ - ipCount = +m[1] - break ThreadStats.thread = @ ThreadStats.fetchPage() - ThreadStats.update postCount, fileCount, ipCount + ThreadStats.update postCount, fileCount, @ipCount $.on d, 'ThreadUpdate', ThreadStats.onUpdate onUpdate: (e) -> diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index ca4b7dfaf..b6dec04f1 100755 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -266,6 +266,7 @@ ThreadUpdater = ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed ThreadUpdater.thread.postLimit = !!OP.bumplimit ThreadUpdater.thread.fileLimit = !!OP.imagelimit + ThreadUpdater.thread.ipCount = OP.unique_ips if OP.unique_ips? posts = [] # post objects index = [] # existing posts