Purge Position
Changed Page Count into Purge Position for /f/, since /f/ is always only 1 page. ccd0: minor changes to port to 4chan X, license update
This commit is contained in:
parent
3f50d50e6b
commit
dd64c07d53
2
LICENSE
2
LICENSE
@ -4,7 +4,7 @@
|
|||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||||
*
|
*
|
||||||
* Appchan X Copyright © 2013-2015 Zixaphir <zixaphirmoxphar@gmail.com>
|
* Appchan X Copyright © 2013-2016 Zixaphir <zixaphirmoxphar@gmail.com>
|
||||||
* http://zixaphir.github.io/appchan-x/
|
* http://zixaphir.github.io/appchan-x/
|
||||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* https://github.com/aeosynth/4chan-x
|
* https://github.com/aeosynth/4chan-x
|
||||||
|
|||||||
@ -5,11 +5,11 @@ ThreadStats =
|
|||||||
statsHTML = <%= html(
|
statsHTML = <%= html(
|
||||||
'<span id="post-count">?</span> / <span id="file-count">?</span>' +
|
'<span id="post-count">?</span> / <span id="file-count">?</span>' +
|
||||||
'?{Conf["IP Count in Stats"]}{ / <span id="ip-count">?</span>}' +
|
'?{Conf["IP Count in Stats"]}{ / <span id="ip-count">?</span>}' +
|
||||||
'?{Conf["Page Count in Stats"] && g.BOARD.ID !== "f"}{ / <span id="page-count">?</span>}'
|
'?{Conf["Page Count in Stats"]}{ / <span id="page-count">?</span>}'
|
||||||
) %>
|
) %>
|
||||||
statsTitle = 'Posts / Files'
|
statsTitle = 'Posts / Files'
|
||||||
statsTitle += ' / IPs' if Conf['IP Count in Stats']
|
statsTitle += ' / IPs' if Conf['IP Count in Stats']
|
||||||
statsTitle += ' / Page' if Conf['Page Count in Stats'] and g.BOARD.ID isnt 'f'
|
statsTitle += (if g.BOARD.ID is 'f' then ' / Purge Position' else ' / Page') if Conf['Page Count in Stats']
|
||||||
|
|
||||||
if Conf['Updater and Stats in Header']
|
if Conf['Updater and Stats in Header']
|
||||||
@dialog = sc = $.el 'span',
|
@dialog = sc = $.el 'span',
|
||||||
@ -56,7 +56,7 @@ ThreadStats =
|
|||||||
return unless ThreadStats.pageCountEl
|
return unless ThreadStats.pageCountEl
|
||||||
if newPosts.length
|
if newPosts.length
|
||||||
ThreadStats.lastPost = g.posts[newPosts[newPosts.length - 1]].info.date
|
ThreadStats.lastPost = g.posts[newPosts[newPosts.length - 1]].info.date
|
||||||
if ThreadStats.pageCountEl?.textContent isnt '1'
|
if g.BOARD.ID isnt 'f' and ThreadStats.pageCountEl?.textContent isnt '1'
|
||||||
ThreadStats.fetchPage()
|
ThreadStats.fetchPage()
|
||||||
|
|
||||||
update: (postCount, fileCount, ipCount) ->
|
update: (postCount, fileCount, ipCount) ->
|
||||||
@ -82,17 +82,24 @@ ThreadStats =
|
|||||||
onThreadsLoad: ->
|
onThreadsLoad: ->
|
||||||
if @status is 200
|
if @status is 200
|
||||||
for page in @response
|
for page in @response
|
||||||
for thread in page.threads when thread.no is ThreadStats.thread.ID
|
if g.BOARD.ID is 'f'
|
||||||
ThreadStats.pageCountEl.textContent = page.page
|
purgePos = 1
|
||||||
(if page.page is @response.length then $.addClass else $.rmClass) ThreadStats.pageCountEl, 'warning'
|
for thread in page.threads
|
||||||
ThreadStats.lastPageUpdate = new Date thread.last_modified * $.SECOND
|
if thread.no < ThreadStats.thread.ID
|
||||||
ThreadStats.retry()
|
purgePos++
|
||||||
return
|
ThreadStats.pageCountEl.textContent = purgePos
|
||||||
|
else
|
||||||
|
for thread in page.threads when thread.no is ThreadStats.thread.ID
|
||||||
|
ThreadStats.pageCountEl.textContent = page.page
|
||||||
|
(if page.page is @response.length then $.addClass else $.rmClass) ThreadStats.pageCountEl, 'warning'
|
||||||
|
ThreadStats.lastPageUpdate = new Date thread.last_modified * $.SECOND
|
||||||
|
ThreadStats.retry()
|
||||||
|
return
|
||||||
else if @status is 304
|
else if @status is 304
|
||||||
ThreadStats.retry()
|
ThreadStats.retry()
|
||||||
|
|
||||||
retry: ->
|
retry: ->
|
||||||
# If thread data is stale (modification date given < time of last post), try again.
|
# If thread data is stale (modification date given < time of last post), try again.
|
||||||
if ThreadStats.lastPost > ThreadStats.lastPageUpdate and ThreadStats.pageCountEl?.textContent isnt '1'
|
if g.BOARD.ID isnt 'f' and ThreadStats.lastPost > ThreadStats.lastPageUpdate and ThreadStats.pageCountEl?.textContent isnt '1'
|
||||||
clearTimeout ThreadStats.timeout
|
clearTimeout ThreadStats.timeout
|
||||||
ThreadStats.timeout = setTimeout ThreadStats.fetchPage, 5 * $.SECOND
|
ThreadStats.timeout = setTimeout ThreadStats.fetchPage, 5 * $.SECOND
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user