Move read of initial IP count to Main.coffee; also read bump/image limit.
This commit is contained in:
parent
21d8871439
commit
24f5a743f7
@ -189,6 +189,12 @@ Main =
|
|||||||
error: err
|
error: err
|
||||||
Main.handleErrors errors if errors
|
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.callbackNodes Thread, threads
|
||||||
Main.callbackNodesDB Post, posts, ->
|
Main.callbackNodesDB Post, posts, ->
|
||||||
$.event '4chanXInitFinished'
|
$.event '4chanXInitFinished'
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class Thread
|
|||||||
@isArchived = false
|
@isArchived = false
|
||||||
@postLimit = false
|
@postLimit = false
|
||||||
@fileLimit = false
|
@fileLimit = false
|
||||||
|
@ipCount = undefined
|
||||||
|
|
||||||
@OP = null
|
@OP = null
|
||||||
@catalogView = null
|
@catalogView = null
|
||||||
|
|||||||
@ -40,13 +40,9 @@ ThreadStats =
|
|||||||
postCount++
|
postCount++
|
||||||
fileCount++ if post.file
|
fileCount++ if post.file
|
||||||
ThreadStats.lastPost = post.info.date if Conf["Page Count in Stats"]
|
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.thread = @
|
||||||
ThreadStats.fetchPage()
|
ThreadStats.fetchPage()
|
||||||
ThreadStats.update postCount, fileCount, ipCount
|
ThreadStats.update postCount, fileCount, @ipCount
|
||||||
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
||||||
|
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
|
|||||||
@ -266,6 +266,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed
|
ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed
|
||||||
ThreadUpdater.thread.postLimit = !!OP.bumplimit
|
ThreadUpdater.thread.postLimit = !!OP.bumplimit
|
||||||
ThreadUpdater.thread.fileLimit = !!OP.imagelimit
|
ThreadUpdater.thread.fileLimit = !!OP.imagelimit
|
||||||
|
ThreadUpdater.thread.ipCount = OP.unique_ips if OP.unique_ips?
|
||||||
|
|
||||||
posts = [] # post objects
|
posts = [] # post objects
|
||||||
index = [] # existing posts
|
index = [] # existing posts
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user