diff --git a/CHANGELOG.md b/CHANGELOG.md index c23bffa75..c37ac226a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ The attributions below are for work that has been incorporated into the script a The links to individual versions below are to copies of the script with the update URL removed. If you want automatic updates, install the script from the links on the [main page](https://github.com/ccd0/4chan-x). +### v1.9.10.1 +*2014-11-10* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.10.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.10.1/builds/4chan-X-noupdate.crx "Chromium version")] + +Backported from v1.9.11.1. + +**ccd0** +- Add unique IP count to thread stats. +- The IP count in the thread stats is now optional, controlled by the IP Count in Stats setting (default: on). + ### v1.9.10.0 *2014-11-02* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.10.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.10.0/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/LICENSE b/LICENSE index 0b3c49192..14f23cf9a 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.9.10.0 +* 4chan X - Version 1.9.10.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 351a98f86..ca2e9eab1 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index 1dcd0f957..38e05ba0b 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.9.10.0 +// @version 1.9.10.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 844981682..b24da4153 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.9.10.0 +// @version 1.9.10.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.10.0 +* 4chan X - Version 1.9.10.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -212,7 +212,8 @@ 'Thread Excerpt': [true, 'Show an excerpt of the thread in the tab title for threads in /f/.'], 'Remove Thread Excerpt': [false, 'Replace the excerpt of the thread in the tab title with the board title.'], 'Thread Stats': [true, 'Display reply and image count.'], - 'Page Count in Stats': [true, 'Display the page count in the thread stats as well.'], + '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.'], 'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'], 'Thread Watcher': [true, 'Bookmark threads.'], 'Toggleable Thread Watcher': [true, 'Adds a shortcut for the thread watcher, hides the watcher by default, and makes it scroll with the page.'] @@ -381,7 +382,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.10.0', + VERSION: '1.9.10.1', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -10570,30 +10571,38 @@ ThreadStats = { init: function() { - var countHTML, sc; + var sc, statsHTML, statsTitle; if (g.VIEW !== 'thread' || !Conf['Thread Stats']) { return; } - countHTML = { + statsHTML = { innerHTML: "? / ?" }; - if (Conf['Page Count in Stats']) { - countHTML = { - innerHTML: countHTML.innerHTML + " / ?" + statsTitle = 'Post Count / File Count'; + if (Conf['IP Count in Stats']) { + statsHTML = { + innerHTML: statsHTML.innerHTML + " / ?" }; + statsTitle += ' / IP Count'; + } + if (Conf['Page Count in Stats']) { + statsHTML = { + innerHTML: statsHTML.innerHTML + " / ?" + }; + statsTitle += ' / Page Count'; } if (Conf['Updater and Stats in Header']) { this.dialog = sc = $.el('span', { id: 'thread-stats', - title: 'Post Count / File Count' + (Conf["Page Count in Stats"] ? " / Page Count" : "") + title: statsTitle }); - $.extend(sc, countHTML); + $.extend(sc, statsHTML); $.ready(function() { return Header.addShortcut(sc); }); } else { this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', { - innerHTML: "
" + countHTML.innerHTML + "
" + innerHTML: "
" + statsHTML.innerHTML + "
" }); $.ready((function(_this) { return function() { @@ -10603,6 +10612,7 @@ } this.postCountEl = $('#post-count', sc); this.fileCountEl = $('#file-count', sc); + this.ipCountEl = $('#ip-count', sc); this.pageCountEl = $('#page-count', sc); return Thread.callbacks.push({ name: 'Thread Stats', @@ -10610,7 +10620,7 @@ }); }, node: function() { - var fileCount, postCount; + var fileCount, ipCount, m, postCount, script, _i, _len, _ref; postCount = 0; fileCount = 0; this.posts.forEach(function(post) { @@ -10622,18 +10632,26 @@ return ThreadStats.lastPost = post.info.date; } }); + _ref = $$('script[type="text/javascript"]:not([src])', d.head); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + script = _ref[_i]; + if (m = script.textContent.match(/\bvar unique_ips = (\d+);/)) { + ipCount = +m[1]; + break; + } + } ThreadStats.thread = this; ThreadStats.fetchPage(); - ThreadStats.update(postCount, fileCount); + ThreadStats.update(postCount, fileCount, ipCount); return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate); }, onUpdate: function(e) { - var fileCount, newPosts, postCount, _ref, _ref1; + var fileCount, ipCount, newPosts, postCount, _ref, _ref1; if (e.detail[404]) { return; } - _ref = e.detail, postCount = _ref.postCount, fileCount = _ref.fileCount, newPosts = _ref.newPosts; - ThreadStats.update(postCount, fileCount); + _ref = e.detail, postCount = _ref.postCount, fileCount = _ref.fileCount, ipCount = _ref.ipCount, newPosts = _ref.newPosts; + ThreadStats.update(postCount, fileCount, ipCount); if (!Conf["Page Count in Stats"]) { return; } @@ -10644,11 +10662,14 @@ return ThreadStats.fetchPage(); } }, - update: function(postCount, fileCount) { - var fileCountEl, postCountEl, thread; - thread = ThreadStats.thread, postCountEl = ThreadStats.postCountEl, fileCountEl = ThreadStats.fileCountEl; + update: function(postCount, fileCount, ipCount) { + var fileCountEl, ipCountEl, postCountEl, thread; + thread = ThreadStats.thread, postCountEl = ThreadStats.postCountEl, fileCountEl = ThreadStats.fileCountEl, ipCountEl = ThreadStats.ipCountEl; postCountEl.textContent = postCount; fileCountEl.textContent = fileCount; + if (Conf["IP Count in Stats"]) { + ipCountEl.textContent = ipCount != null ? ipCount : '?'; + } (thread.postLimit && !thread.isSticky ? $.addClass : $.rmClass)(postCountEl, 'warning'); return (thread.fileLimit && !thread.isSticky ? $.addClass : $.rmClass)(fileCountEl, 'warning'); }, @@ -11090,7 +11111,8 @@ return post.fullID; }), postCount: OP.replies + 1, - fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead) + fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead), + ipCount: OP.unique_ips }); } }; @@ -13688,7 +13710,7 @@ className: 'dialog' }); $.extend(dialog, { - innerHTML: "
" + innerHTML: "
" }); $.on($('.export', Settings.dialog), 'click', Settings["export"]); $.on($('.import', Settings.dialog), 'click', Settings["import"]); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 0e4ed7b76..dedf36314 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index b7e20ec27..08a8e2b9f 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.9.10.0 +// @version 1.9.10.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -23,7 +23,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.10.0 +* 4chan X - Version 1.9.10.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -211,7 +211,8 @@ 'Thread Excerpt': [true, 'Show an excerpt of the thread in the tab title for threads in /f/.'], 'Remove Thread Excerpt': [false, 'Replace the excerpt of the thread in the tab title with the board title.'], 'Thread Stats': [true, 'Display reply and image count.'], - 'Page Count in Stats': [true, 'Display the page count in the thread stats as well.'], + '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.'], 'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'], 'Thread Watcher': [true, 'Bookmark threads.'], 'Toggleable Thread Watcher': [true, 'Adds a shortcut for the thread watcher, hides the watcher by default, and makes it scroll with the page.'] @@ -380,7 +381,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.10.0', + VERSION: '1.9.10.1', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -10569,30 +10570,38 @@ ThreadStats = { init: function() { - var countHTML, sc; + var sc, statsHTML, statsTitle; if (g.VIEW !== 'thread' || !Conf['Thread Stats']) { return; } - countHTML = { + statsHTML = { innerHTML: "? / ?" }; - if (Conf['Page Count in Stats']) { - countHTML = { - innerHTML: countHTML.innerHTML + " / ?" + statsTitle = 'Post Count / File Count'; + if (Conf['IP Count in Stats']) { + statsHTML = { + innerHTML: statsHTML.innerHTML + " / ?" }; + statsTitle += ' / IP Count'; + } + if (Conf['Page Count in Stats']) { + statsHTML = { + innerHTML: statsHTML.innerHTML + " / ?" + }; + statsTitle += ' / Page Count'; } if (Conf['Updater and Stats in Header']) { this.dialog = sc = $.el('span', { id: 'thread-stats', - title: 'Post Count / File Count' + (Conf["Page Count in Stats"] ? " / Page Count" : "") + title: statsTitle }); - $.extend(sc, countHTML); + $.extend(sc, statsHTML); $.ready(function() { return Header.addShortcut(sc); }); } else { this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', { - innerHTML: "
" + countHTML.innerHTML + "
" + innerHTML: "
" + statsHTML.innerHTML + "
" }); $.ready((function(_this) { return function() { @@ -10602,6 +10611,7 @@ } this.postCountEl = $('#post-count', sc); this.fileCountEl = $('#file-count', sc); + this.ipCountEl = $('#ip-count', sc); this.pageCountEl = $('#page-count', sc); return Thread.callbacks.push({ name: 'Thread Stats', @@ -10609,7 +10619,7 @@ }); }, node: function() { - var fileCount, postCount; + var fileCount, ipCount, m, postCount, script, _i, _len, _ref; postCount = 0; fileCount = 0; this.posts.forEach(function(post) { @@ -10621,18 +10631,26 @@ return ThreadStats.lastPost = post.info.date; } }); + _ref = $$('script[type="text/javascript"]:not([src])', d.head); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + script = _ref[_i]; + if (m = script.textContent.match(/\bvar unique_ips = (\d+);/)) { + ipCount = +m[1]; + break; + } + } ThreadStats.thread = this; ThreadStats.fetchPage(); - ThreadStats.update(postCount, fileCount); + ThreadStats.update(postCount, fileCount, ipCount); return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate); }, onUpdate: function(e) { - var fileCount, newPosts, postCount, _ref, _ref1; + var fileCount, ipCount, newPosts, postCount, _ref, _ref1; if (e.detail[404]) { return; } - _ref = e.detail, postCount = _ref.postCount, fileCount = _ref.fileCount, newPosts = _ref.newPosts; - ThreadStats.update(postCount, fileCount); + _ref = e.detail, postCount = _ref.postCount, fileCount = _ref.fileCount, ipCount = _ref.ipCount, newPosts = _ref.newPosts; + ThreadStats.update(postCount, fileCount, ipCount); if (!Conf["Page Count in Stats"]) { return; } @@ -10643,11 +10661,14 @@ return ThreadStats.fetchPage(); } }, - update: function(postCount, fileCount) { - var fileCountEl, postCountEl, thread; - thread = ThreadStats.thread, postCountEl = ThreadStats.postCountEl, fileCountEl = ThreadStats.fileCountEl; + update: function(postCount, fileCount, ipCount) { + var fileCountEl, ipCountEl, postCountEl, thread; + thread = ThreadStats.thread, postCountEl = ThreadStats.postCountEl, fileCountEl = ThreadStats.fileCountEl, ipCountEl = ThreadStats.ipCountEl; postCountEl.textContent = postCount; fileCountEl.textContent = fileCount; + if (Conf["IP Count in Stats"]) { + ipCountEl.textContent = ipCount != null ? ipCount : '?'; + } (thread.postLimit && !thread.isSticky ? $.addClass : $.rmClass)(postCountEl, 'warning'); return (thread.fileLimit && !thread.isSticky ? $.addClass : $.rmClass)(fileCountEl, 'warning'); }, @@ -11089,7 +11110,8 @@ return post.fullID; }), postCount: OP.replies + 1, - fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead) + fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead), + ipCount: OP.unique_ips }); } }; @@ -13687,7 +13709,7 @@ className: 'dialog' }); $.extend(dialog, { - innerHTML: "
" + innerHTML: "
" }); $.on($('.export', Settings.dialog), 'click', Settings["export"]); $.on($('.import', Settings.dialog), 'click', Settings["import"]); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 074dc34f8..1371e9d33 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 2fc278b2f..2cbbea038 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.9.10.0 +// @version 1.9.10.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 6b9fbf295..ca19001dd 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.9.10.0 +// @version 1.9.10.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.10.0 +* 4chan X - Version 1.9.10.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -212,7 +212,8 @@ 'Thread Excerpt': [true, 'Show an excerpt of the thread in the tab title for threads in /f/.'], 'Remove Thread Excerpt': [false, 'Replace the excerpt of the thread in the tab title with the board title.'], 'Thread Stats': [true, 'Display reply and image count.'], - 'Page Count in Stats': [true, 'Display the page count in the thread stats as well.'], + '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.'], 'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'], 'Thread Watcher': [true, 'Bookmark threads.'], 'Toggleable Thread Watcher': [true, 'Adds a shortcut for the thread watcher, hides the watcher by default, and makes it scroll with the page.'] @@ -381,7 +382,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.10.0', + VERSION: '1.9.10.1', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -10570,30 +10571,38 @@ ThreadStats = { init: function() { - var countHTML, sc; + var sc, statsHTML, statsTitle; if (g.VIEW !== 'thread' || !Conf['Thread Stats']) { return; } - countHTML = { + statsHTML = { innerHTML: "? / ?" }; - if (Conf['Page Count in Stats']) { - countHTML = { - innerHTML: countHTML.innerHTML + " / ?" + statsTitle = 'Post Count / File Count'; + if (Conf['IP Count in Stats']) { + statsHTML = { + innerHTML: statsHTML.innerHTML + " / ?" }; + statsTitle += ' / IP Count'; + } + if (Conf['Page Count in Stats']) { + statsHTML = { + innerHTML: statsHTML.innerHTML + " / ?" + }; + statsTitle += ' / Page Count'; } if (Conf['Updater and Stats in Header']) { this.dialog = sc = $.el('span', { id: 'thread-stats', - title: 'Post Count / File Count' + (Conf["Page Count in Stats"] ? " / Page Count" : "") + title: statsTitle }); - $.extend(sc, countHTML); + $.extend(sc, statsHTML); $.ready(function() { return Header.addShortcut(sc); }); } else { this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', { - innerHTML: "
" + countHTML.innerHTML + "
" + innerHTML: "
" + statsHTML.innerHTML + "
" }); $.ready((function(_this) { return function() { @@ -10603,6 +10612,7 @@ } this.postCountEl = $('#post-count', sc); this.fileCountEl = $('#file-count', sc); + this.ipCountEl = $('#ip-count', sc); this.pageCountEl = $('#page-count', sc); return Thread.callbacks.push({ name: 'Thread Stats', @@ -10610,7 +10620,7 @@ }); }, node: function() { - var fileCount, postCount; + var fileCount, ipCount, m, postCount, script, _i, _len, _ref; postCount = 0; fileCount = 0; this.posts.forEach(function(post) { @@ -10622,18 +10632,26 @@ return ThreadStats.lastPost = post.info.date; } }); + _ref = $$('script[type="text/javascript"]:not([src])', d.head); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + script = _ref[_i]; + if (m = script.textContent.match(/\bvar unique_ips = (\d+);/)) { + ipCount = +m[1]; + break; + } + } ThreadStats.thread = this; ThreadStats.fetchPage(); - ThreadStats.update(postCount, fileCount); + ThreadStats.update(postCount, fileCount, ipCount); return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate); }, onUpdate: function(e) { - var fileCount, newPosts, postCount, _ref, _ref1; + var fileCount, ipCount, newPosts, postCount, _ref, _ref1; if (e.detail[404]) { return; } - _ref = e.detail, postCount = _ref.postCount, fileCount = _ref.fileCount, newPosts = _ref.newPosts; - ThreadStats.update(postCount, fileCount); + _ref = e.detail, postCount = _ref.postCount, fileCount = _ref.fileCount, ipCount = _ref.ipCount, newPosts = _ref.newPosts; + ThreadStats.update(postCount, fileCount, ipCount); if (!Conf["Page Count in Stats"]) { return; } @@ -10644,11 +10662,14 @@ return ThreadStats.fetchPage(); } }, - update: function(postCount, fileCount) { - var fileCountEl, postCountEl, thread; - thread = ThreadStats.thread, postCountEl = ThreadStats.postCountEl, fileCountEl = ThreadStats.fileCountEl; + update: function(postCount, fileCount, ipCount) { + var fileCountEl, ipCountEl, postCountEl, thread; + thread = ThreadStats.thread, postCountEl = ThreadStats.postCountEl, fileCountEl = ThreadStats.fileCountEl, ipCountEl = ThreadStats.ipCountEl; postCountEl.textContent = postCount; fileCountEl.textContent = fileCount; + if (Conf["IP Count in Stats"]) { + ipCountEl.textContent = ipCount != null ? ipCount : '?'; + } (thread.postLimit && !thread.isSticky ? $.addClass : $.rmClass)(postCountEl, 'warning'); return (thread.fileLimit && !thread.isSticky ? $.addClass : $.rmClass)(fileCountEl, 'warning'); }, @@ -11090,7 +11111,8 @@ return post.fullID; }), postCount: OP.replies + 1, - fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead) + fileCount: OP.images + (!!ThreadUpdater.thread.OP.file && !ThreadUpdater.thread.OP.file.isDead), + ipCount: OP.unique_ips }); } }; @@ -13688,7 +13710,7 @@ className: 'dialog' }); $.extend(dialog, { - innerHTML: "
" + innerHTML: "
" }); $.on($('.export', Settings.dialog), 'click', Settings["export"]); $.on($('.import', Settings.dialog), 'click', Settings["import"]); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 09dba7f1b..671e862f2 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index aacf6f3fb..e1bbb1030 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index a17037314..c46891c08 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index 17b0743be..1e5518601 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X", - "version": "1.9.10.0", + "version": "1.9.10.1", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",