From ea163382d62dcb33abf06a051556eacb35bbc5bf Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 9 Nov 2014 14:18:03 -0800 Subject: [PATCH] Make IP count in thread stats optional. --- src/General/Config.coffee | 6 +++++- src/Monitoring/ThreadStats.coffee | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 354e7ced3..2cd2abd02 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -291,9 +291,13 @@ Config = true 'Display reply and image count.' ] + 'IP Count in Stats': [ + true + 'Display the unique IP count in the thread stats.' + ] 'Page Count in Stats': [ true - 'Display the page count in the thread stats as well.' + 'Display the page count in the thread stats.' ] 'Updater and Stats in Header': [ true, diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index 91d86a9f4..569bdc9fa 100755 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -2,19 +2,25 @@ ThreadStats = init: -> return if g.VIEW isnt 'thread' or !Conf['Thread Stats'] - countHTML = <%= html('? / ? / ?') %> - countHTML = <%= html('&{countHTML} / ?') %> if Conf['Page Count in Stats'] + statsHTML = <%= html('? / ?') %> + statsTitle = 'Post Count / File Count' + if Conf['IP Count in Stats'] + statsHTML = <%= html('&{statsHTML} / ?') %> + statsTitle += ' / IP Count' + if Conf['Page Count in Stats'] + statsHTML = <%= html('&{statsHTML} / ?') %> + statsTitle += ' / Page Count' if Conf['Updater and Stats in Header'] @dialog = sc = $.el 'span', - id: 'thread-stats' - title: 'Post Count / File Count / IP Count' + (if Conf["Page Count in Stats"] then " / Page Count" else "") - $.extend sc, countHTML + id: 'thread-stats' + title: statsTitle + $.extend sc, statsHTML $.ready -> Header.addShortcut sc else @dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;', - <%= html('
&{countHTML}
') %> + <%= html('
&{statsHTML}
') %> $.ready => $.add d.body, sc @@ -57,7 +63,8 @@ ThreadStats = {thread, postCountEl, fileCountEl, ipCountEl} = ThreadStats postCountEl.textContent = postCount fileCountEl.textContent = fileCount - ipCountEl.textContent = if ipCount? then ipCount else '?' + if Conf["IP Count in Stats"] + ipCountEl.textContent = if ipCount? then ipCount else '?' (if thread.postLimit and !thread.isSticky then $.addClass else $.rmClass) postCountEl, 'warning' (if thread.fileLimit and !thread.isSticky then $.addClass else $.rmClass) fileCountEl, 'warning'