Merge branch 'next' into multisite

This commit is contained in:
ccd0 2016-10-30 23:03:29 -07:00
commit 5a57879e01
24 changed files with 96 additions and 56 deletions

View File

@ -4,6 +4,9 @@
## v1.13.0 ## v1.13.0
**v1.13.0.18** *(2016-10-31)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.18/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.18/builds/4chan-X-noupdate.crx)]
- Improve robustness against invalid settings data, including thread watcher timestamps from future.
**v1.13.0.17** *(2016-10-30)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.17/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.17/builds/4chan-X-noupdate.crx)] **v1.13.0.17** *(2016-10-30)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.17/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.17/builds/4chan-X-noupdate.crx)]
- Various regression and bug fixes. - Various regression and bug fixes.

View File

@ -1,7 +1,8 @@
![screenshot](https://ccd0.github.io/4chan-x/img/screenshot.png) ![screenshot](https://ccd0.github.io/4chan-x/img/screenshot.png)
# 4chan X # 4chan X
Adds various features to 4chan. 4chan X is an unofficial script written by users of 4chan to add various features to the site.
Previously developed by [aeosynth](https://github.com/aeosynth/4chan-x), [Mayhem](https://github.com/MayhemYDG/4chan-x), [ihavenoface](https://github.com/ihavenoface/4chan-x), [Zixaphir](https://github.com/zixaphir/appchan-x), [Seaweed](https://github.com/seaweedchan/4chan-x), and [Spittie](https://github.com/Spittie/4chan-x), with contributions from many others.
It was previously developed by [aeosynth](https://github.com/aeosynth/4chan-x), [Mayhem](https://github.com/MayhemYDG/4chan-x), [ihavenoface](https://github.com/ihavenoface/4chan-x), [Zixaphir](https://github.com/zixaphir/appchan-x), [Seaweed](https://github.com/seaweedchan/4chan-x), and [Spittie](https://github.com/Spittie/4chan-x), with contributions from many others.
If you're looking for a maintained fork of OneeChan (a style script used in addition to 4chan X), try If you're looking for a maintained fork of OneeChan (a style script used in addition to 4chan X), try
https://github.com/Nebukazar/OneeChan. https://github.com/Nebukazar/OneeChan.

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.13.0.17 // @version 1.13.0.18
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.13.0.17 // @version 1.13.0.18
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -147,7 +147,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.0.17', VERSION: '1.13.0.18',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -5321,7 +5321,7 @@ DataBoard = (function() {
}; };
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now, ref, val; var boardID, now, ref, ref1, val;
$.forceSync(this.key); $.forceSync(this.key);
ref = this.data.boards; ref = this.data.boards;
for (boardID in ref) { for (boardID in ref) {
@ -5331,7 +5331,7 @@ DataBoard = (function() {
}); });
} }
now = Date.now(); now = Date.now();
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) { if (!((now - 2 * $.HOUR < (ref1 = this.data.lastChecked || 0) && ref1 <= now))) {
this.data.lastChecked = now; this.data.lastChecked = now;
for (boardID in this.data.boards) { for (boardID in this.data.boards) {
this.ajaxClean(boardID); this.ajaxClean(boardID);
@ -6617,9 +6617,13 @@ Redirect = (function() {
{ "uid": 31, "name": "Archive Of Sins", "domain": "archiveofsins.com", "http": true, "https": false, "software": "foolfuuka", "boards": [ "h", "hc", "hm", "r", "s", "soc" ], "files": [ "h", "hc", "hm", "r", "s", "soc" ] } { "uid": 31, "name": "Archive Of Sins", "domain": "archiveofsins.com", "http": true, "https": false, "software": "foolfuuka", "boards": [ "h", "hc", "hm", "r", "s", "soc" ], "files": [ "h", "hc", "hm", "r", "s", "soc" ] }
], ],
init: function() { init: function() {
var now, ref;
this.selectArchives(); this.selectArchives();
if (Conf['archiveAutoUpdate'] && Conf['lastarchivecheck'] < Date.now() - 2 * $.DAY) { if (Conf['archiveAutoUpdate']) {
return this.update(); now = Date.now();
if (!((now - 2 * $.DAY < (ref = Conf['lastarchivecheck']) && ref <= now))) {
return this.update();
}
} }
}, },
selectArchives: function() { selectArchives: function() {
@ -7891,7 +7895,9 @@ BoardConfig = (function() {
BoardConfig = { BoardConfig = {
cbs: [], cbs: [],
init: function() { init: function() {
if ((Conf['boardConfig'].lastChecked || 0) < Date.now() - 2 * $.HOUR) { var now, ref;
now = Date.now();
if (!((now - 2 * $.HOUR < (ref = Conf['boardConfig'].lastChecked || 0) && ref <= now))) {
return $.ajax('//a.4cdn.org/boards.json', { return $.ajax('//a.4cdn.org/boards.json', {
onloadend: this.load onloadend: this.load
}); });
@ -10068,6 +10074,8 @@ Index = (function() {
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}); });
default:
return liveThreadIDs;
} }
})(); })();
if (Index.search && (threadIDs = Index.querySearch(Index.search))) { if (Index.search && (threadIDs = Index.querySearch(Index.search))) {
@ -18172,7 +18180,7 @@ ThreadWatcher = (function() {
return ThreadWatcher.clearRequests(); return ThreadWatcher.clearRequests();
}, },
fetchAuto: function() { fetchAuto: function() {
var db, interval, now; var db, interval, now, ref;
clearTimeout(ThreadWatcher.timeout); clearTimeout(ThreadWatcher.timeout);
if (!Conf['Auto Update Thread Watcher']) { if (!Conf['Auto Update Thread Watcher']) {
return; return;
@ -18180,7 +18188,7 @@ ThreadWatcher = (function() {
db = ThreadWatcher.db; db = ThreadWatcher.db;
interval = ThreadWatcher.unreadEnabled && Conf['Show Unread Count'] ? 5 * $.MINUTE : 2 * $.HOUR; interval = ThreadWatcher.unreadEnabled && Conf['Show Unread Count'] ? 5 * $.MINUTE : 2 * $.HOUR;
now = Date.now(); now = Date.now();
if (now >= (db.data.lastChecked || 0) + interval) { if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) {
ThreadWatcher.fetchAllStatus(); ThreadWatcher.fetchAllStatus();
db.data.lastChecked = now; db.data.lastChecked = now;
db.save(); db.save();

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.0.17 // @version 1.13.0.18
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -147,7 +147,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.0.17', VERSION: '1.13.0.18',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -5321,7 +5321,7 @@ DataBoard = (function() {
}; };
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now, ref, val; var boardID, now, ref, ref1, val;
$.forceSync(this.key); $.forceSync(this.key);
ref = this.data.boards; ref = this.data.boards;
for (boardID in ref) { for (boardID in ref) {
@ -5331,7 +5331,7 @@ DataBoard = (function() {
}); });
} }
now = Date.now(); now = Date.now();
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) { if (!((now - 2 * $.HOUR < (ref1 = this.data.lastChecked || 0) && ref1 <= now))) {
this.data.lastChecked = now; this.data.lastChecked = now;
for (boardID in this.data.boards) { for (boardID in this.data.boards) {
this.ajaxClean(boardID); this.ajaxClean(boardID);
@ -6617,9 +6617,13 @@ Redirect = (function() {
{ "uid": 31, "name": "Archive Of Sins", "domain": "archiveofsins.com", "http": true, "https": false, "software": "foolfuuka", "boards": [ "h", "hc", "hm", "r", "s", "soc" ], "files": [ "h", "hc", "hm", "r", "s", "soc" ] } { "uid": 31, "name": "Archive Of Sins", "domain": "archiveofsins.com", "http": true, "https": false, "software": "foolfuuka", "boards": [ "h", "hc", "hm", "r", "s", "soc" ], "files": [ "h", "hc", "hm", "r", "s", "soc" ] }
], ],
init: function() { init: function() {
var now, ref;
this.selectArchives(); this.selectArchives();
if (Conf['archiveAutoUpdate'] && Conf['lastarchivecheck'] < Date.now() - 2 * $.DAY) { if (Conf['archiveAutoUpdate']) {
return this.update(); now = Date.now();
if (!((now - 2 * $.DAY < (ref = Conf['lastarchivecheck']) && ref <= now))) {
return this.update();
}
} }
}, },
selectArchives: function() { selectArchives: function() {
@ -7891,7 +7895,9 @@ BoardConfig = (function() {
BoardConfig = { BoardConfig = {
cbs: [], cbs: [],
init: function() { init: function() {
if ((Conf['boardConfig'].lastChecked || 0) < Date.now() - 2 * $.HOUR) { var now, ref;
now = Date.now();
if (!((now - 2 * $.HOUR < (ref = Conf['boardConfig'].lastChecked || 0) && ref <= now))) {
return $.ajax('//a.4cdn.org/boards.json', { return $.ajax('//a.4cdn.org/boards.json', {
onloadend: this.load onloadend: this.load
}); });
@ -10068,6 +10074,8 @@ Index = (function() {
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}); });
default:
return liveThreadIDs;
} }
})(); })();
if (Index.search && (threadIDs = Index.querySearch(Index.search))) { if (Index.search && (threadIDs = Index.querySearch(Index.search))) {
@ -18172,7 +18180,7 @@ ThreadWatcher = (function() {
return ThreadWatcher.clearRequests(); return ThreadWatcher.clearRequests();
}, },
fetchAuto: function() { fetchAuto: function() {
var db, interval, now; var db, interval, now, ref;
clearTimeout(ThreadWatcher.timeout); clearTimeout(ThreadWatcher.timeout);
if (!Conf['Auto Update Thread Watcher']) { if (!Conf['Auto Update Thread Watcher']) {
return; return;
@ -18180,7 +18188,7 @@ ThreadWatcher = (function() {
db = ThreadWatcher.db; db = ThreadWatcher.db;
interval = ThreadWatcher.unreadEnabled && Conf['Show Unread Count'] ? 5 * $.MINUTE : 2 * $.HOUR; interval = ThreadWatcher.unreadEnabled && Conf['Show Unread Count'] ? 5 * $.MINUTE : 2 * $.HOUR;
now = Date.now(); now = Date.now();
if (now >= (db.data.lastChecked || 0) + interval) { if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) {
ThreadWatcher.fetchAllStatus(); ThreadWatcher.fetchAllStatus();
db.data.lastChecked = now; db.data.lastChecked = now;
db.save(); db.save();

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.0.17 // @version 1.13.0.18
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.0.17 // @version 1.13.0.18
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -147,7 +147,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.0.17', VERSION: '1.13.0.18',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -5321,7 +5321,7 @@ DataBoard = (function() {
}; };
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now, ref, val; var boardID, now, ref, ref1, val;
$.forceSync(this.key); $.forceSync(this.key);
ref = this.data.boards; ref = this.data.boards;
for (boardID in ref) { for (boardID in ref) {
@ -5331,7 +5331,7 @@ DataBoard = (function() {
}); });
} }
now = Date.now(); now = Date.now();
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) { if (!((now - 2 * $.HOUR < (ref1 = this.data.lastChecked || 0) && ref1 <= now))) {
this.data.lastChecked = now; this.data.lastChecked = now;
for (boardID in this.data.boards) { for (boardID in this.data.boards) {
this.ajaxClean(boardID); this.ajaxClean(boardID);
@ -6617,9 +6617,13 @@ Redirect = (function() {
{ "uid": 31, "name": "Archive Of Sins", "domain": "archiveofsins.com", "http": true, "https": false, "software": "foolfuuka", "boards": [ "h", "hc", "hm", "r", "s", "soc" ], "files": [ "h", "hc", "hm", "r", "s", "soc" ] } { "uid": 31, "name": "Archive Of Sins", "domain": "archiveofsins.com", "http": true, "https": false, "software": "foolfuuka", "boards": [ "h", "hc", "hm", "r", "s", "soc" ], "files": [ "h", "hc", "hm", "r", "s", "soc" ] }
], ],
init: function() { init: function() {
var now, ref;
this.selectArchives(); this.selectArchives();
if (Conf['archiveAutoUpdate'] && Conf['lastarchivecheck'] < Date.now() - 2 * $.DAY) { if (Conf['archiveAutoUpdate']) {
return this.update(); now = Date.now();
if (!((now - 2 * $.DAY < (ref = Conf['lastarchivecheck']) && ref <= now))) {
return this.update();
}
} }
}, },
selectArchives: function() { selectArchives: function() {
@ -7891,7 +7895,9 @@ BoardConfig = (function() {
BoardConfig = { BoardConfig = {
cbs: [], cbs: [],
init: function() { init: function() {
if ((Conf['boardConfig'].lastChecked || 0) < Date.now() - 2 * $.HOUR) { var now, ref;
now = Date.now();
if (!((now - 2 * $.HOUR < (ref = Conf['boardConfig'].lastChecked || 0) && ref <= now))) {
return $.ajax('//a.4cdn.org/boards.json', { return $.ajax('//a.4cdn.org/boards.json', {
onloadend: this.load onloadend: this.load
}); });
@ -10068,6 +10074,8 @@ Index = (function() {
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}); });
default:
return liveThreadIDs;
} }
})(); })();
if (Index.search && (threadIDs = Index.querySearch(Index.search))) { if (Index.search && (threadIDs = Index.querySearch(Index.search))) {
@ -18172,7 +18180,7 @@ ThreadWatcher = (function() {
return ThreadWatcher.clearRequests(); return ThreadWatcher.clearRequests();
}, },
fetchAuto: function() { fetchAuto: function() {
var db, interval, now; var db, interval, now, ref;
clearTimeout(ThreadWatcher.timeout); clearTimeout(ThreadWatcher.timeout);
if (!Conf['Auto Update Thread Watcher']) { if (!Conf['Auto Update Thread Watcher']) {
return; return;
@ -18180,7 +18188,7 @@ ThreadWatcher = (function() {
db = ThreadWatcher.db; db = ThreadWatcher.db;
interval = ThreadWatcher.unreadEnabled && Conf['Show Unread Count'] ? 5 * $.MINUTE : 2 * $.HOUR; interval = ThreadWatcher.unreadEnabled && Conf['Show Unread Count'] ? 5 * $.MINUTE : 2 * $.HOUR;
now = Date.now(); now = Date.now();
if (now >= (db.data.lastChecked || 0) + interval) { if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) {
ThreadWatcher.fetchAllStatus(); ThreadWatcher.fetchAllStatus();
db.data.lastChecked = now; db.data.lastChecked = now;
db.save(); db.save();

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.13.0.17' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.13.0.18' />
</app> </app>
</gupdate> </gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.13.0.17' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.13.0.18' />
</app> </app>
</gupdate> </gupdate>

View File

@ -17,8 +17,8 @@
</div> </div>
<a class="screenshot" href="img/screenshot.png"><img src="img/screenshot.png" alt="Screenshot"></a> <a class="screenshot" href="img/screenshot.png"><img src="img/screenshot.png" alt="Screenshot"></a>
<p>Adds various features to 4chan. <p>4chan X is an unofficial script written by users of 4chan to add various features to the site.</p>
Previously developed by <a href="https://github.com/aeosynth/4chan-x">aeosynth</a>, <a href="https://github.com/MayhemYDG/4chan-x">Mayhem</a>, <a href="https://github.com/ihavenoface/4chan-x">ihavenoface</a>, <a href="https://github.com/zixaphir/appchan-x">Zixaphir</a>, <a href="https://github.com/seaweedchan/4chan-x">Seaweed</a>, and <a href="https://github.com/Spittie/4chan-x">Spittie</a>, with contributions from many others.</p> <p>It was previously developed by <a href="https://github.com/aeosynth/4chan-x">aeosynth</a>, <a href="https://github.com/MayhemYDG/4chan-x">Mayhem</a>, <a href="https://github.com/ihavenoface/4chan-x">ihavenoface</a>, <a href="https://github.com/zixaphir/appchan-x">Zixaphir</a>, <a href="https://github.com/seaweedchan/4chan-x">Seaweed</a>, and <a href="https://github.com/Spittie/4chan-x">Spittie</a>, with contributions from many others.</p>
<p>If you're looking for a maintained fork of OneeChan (a style script used in addition to 4chan X), try <p>If you're looking for a maintained fork of OneeChan (a style script used in addition to 4chan X), try
<a href="https://github.com/Nebukazar/OneeChan">https://github.com/Nebukazar/OneeChan</a>.</p> <a href="https://github.com/Nebukazar/OneeChan">https://github.com/Nebukazar/OneeChan</a>.</p>
<h2 id="please-note">Please note</h2> <h2 id="please-note">Please note</h2>

View File

@ -9,7 +9,9 @@ Redirect =
init: -> init: ->
@selectArchives() @selectArchives()
@update() if Conf['archiveAutoUpdate'] and Conf['lastarchivecheck'] < Date.now() - 2 * $.DAY if Conf['archiveAutoUpdate']
now = Date.now()
@update() unless now - 2 * $.DAY < Conf['lastarchivecheck'] <= now
selectArchives: -> selectArchives: ->
o = o =

View File

@ -2,7 +2,8 @@ BoardConfig =
cbs: [] cbs: []
init: -> init: ->
if (Conf['boardConfig'].lastChecked or 0) < Date.now() - 2 * $.HOUR now = Date.now()
unless now - 2 * $.HOUR < (Conf['boardConfig'].lastChecked or 0) <= now
$.ajax '//a.4cdn.org/boards.json', $.ajax '//a.4cdn.org/boards.json',
onloadend: @load onloadend: @load
else else

View File

@ -18,7 +18,7 @@ Get =
index = root.dataset.clone index = root.dataset.clone
if index then post.clones[index] else post if index then post.clones[index] else post
postFromNode: (root) -> postFromNode: (root) ->
Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root Get.postFromRoot $.x 'ancestor::div[contains(@class,"postContainer")][1]', root
postDataFromLink: (link) -> postDataFromLink: (link) ->
if link.hostname is 'boards.4chan.org' if link.hostname is 'boards.4chan.org'
path = link.pathname.split /\/+/ path = link.pathname.split /\/+/

View File

@ -95,17 +95,20 @@ Index =
@hideLabel = $ '#hidden-label', @navLinks @hideLabel = $ '#hidden-label', @navLinks
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
# Drop-down menus # Drop-down menus and reverse sort toggle
@selectRev = $ '#index-rev', @navLinks
@selectMode = $ '#index-mode', @navLinks @selectMode = $ '#index-mode', @navLinks
@selectSort = $ '#index-sort', @navLinks @selectSort = $ '#index-sort', @navLinks
@selectSize = $ '#index-size', @navLinks @selectSize = $ '#index-size', @navLinks
$.on @selectRev, 'change', @cb.sort
$.on @selectMode, 'change', @cb.mode $.on @selectMode, 'change', @cb.mode
$.on @selectSort, 'change', @cb.sort $.on @selectSort, 'change', @cb.sort
$.on @selectSize, 'change', $.cb.value $.on @selectSize, 'change', $.cb.value
$.on @selectSize, 'change', @cb.size $.on @selectSize, 'change', @cb.size
for select in [@selectMode, @selectSize] for select in [@selectMode, @selectSize]
select.value = Conf[select.name] select.value = Conf[select.name]
@selectSort.value = Index.currentSort @selectRev.checked = /-rev$/.test Index.currentSort
@selectSort.value = Index.currentSort.replace /-rev$/, ''
# Thread container # Thread container
@root = $.el 'div', className: 'board json-index' @root = $.el 'div', className: 'board json-index'
@ -252,7 +255,8 @@ Index =
Index.pageLoad false Index.pageLoad false
sort: -> sort: ->
Index.pushState {sort: @value} value = if Index.selectRev.checked then Index.selectSort.value + "-rev" else Index.selectSort.value
Index.pushState {sort: value}
Index.pageLoad false Index.pageLoad false
resort: (e) -> resort: (e) ->
@ -342,12 +346,12 @@ Index =
'all-pages': 'all pages' 'all-pages': 'all pages'
'catalog': 'catalog' 'catalog': 'catalog'
sort: sort:
'bump-order': 'bump' 'bump-order': 'bump'
'last-reply': 'lastreply' 'last-reply': 'lastreply'
'last-long-reply': 'lastlong' 'last-long-reply': 'lastlong'
'creation-date': 'birth' 'creation-date': 'birth'
'reply-count': 'replycount' 'reply-count': 'replycount'
'file-count': 'filecount' 'file-count': 'filecount'
processHash: -> processHash: ->
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=483304 # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=483304
@ -362,8 +366,9 @@ Index =
else if command is 'index' else if command is 'index'
state.mode = Conf['Previous Index Mode'] state.mode = Conf['Previous Index Mode']
state.page = 1 state.page = 1
else if (sort = Index.hashCommands.sort[command]) else if (sort = Index.hashCommands.sort[command.replace(/-rev$/, '')])
state.sort = sort state.sort = sort
state.sort += '-rev' if /-rev$/.test(command)
else if /^s=/.test command else if /^s=/.test command
state.search = decodeURIComponent(command[2..]).replace(/\+/g, ' ').trim() state.search = decodeURIComponent(command[2..]).replace(/\+/g, ' ').trim()
else else
@ -446,7 +451,8 @@ Index =
$('#hidden-toggle a', Index.navLinks).textContent = 'Show' $('#hidden-toggle a', Index.navLinks).textContent = 'Show'
setupSort: -> setupSort: ->
Index.selectSort.value = Index.currentSort Index.selectRev.checked = /-rev$/.test Index.currentSort
Index.selectSort.value = Index.currentSort.replace /-rev$/, ''
getPagesNum: -> getPagesNum: ->
if Index.search if Index.search
@ -744,7 +750,7 @@ Index =
sort: -> sort: ->
{liveThreadIDs, liveThreadData} = Index {liveThreadIDs, liveThreadData} = Index
return unless liveThreadData return unless liveThreadData
Index.sortedThreadIDs = switch Index.currentSort Index.sortedThreadIDs = switch Index.currentSort.replace(/-rev$/, '')
when 'lastreply' when 'lastreply'
[liveThreadData...].sort((a, b) -> [liveThreadData...].sort((a, b) ->
a = num[num.length - 1] if (num = a.last_replies) a = num[num.length - 1] if (num = a.last_replies)
@ -764,6 +770,8 @@ Index =
when 'replycount' then [liveThreadData...].sort((a, b) -> b.replies - a.replies).map (post) -> post.no when 'replycount' then [liveThreadData...].sort((a, b) -> b.replies - a.replies).map (post) -> post.no
when 'filecount' then [liveThreadData...].sort((a, b) -> b.images - a.images ).map (post) -> post.no when 'filecount' then [liveThreadData...].sort((a, b) -> b.images - a.images ).map (post) -> post.no
else liveThreadIDs else liveThreadIDs
if /-rev$/.test(Index.currentSort)
Index.sortedThreadIDs = [Index.sortedThreadIDs...].reverse()
if Index.search and (threadIDs = Index.querySearch Index.search) if Index.search and (threadIDs = Index.querySearch Index.search)
Index.sortedThreadIDs = threadIDs Index.sortedThreadIDs = threadIDs
# Sticky threads # Sticky threads

View File

@ -6,6 +6,7 @@
<input type="search" id="index-search" class="field" placeholder="Search"> <input type="search" id="index-search" class="field" placeholder="Search">
<a id="index-search-clear" href="javascript:;" title="Clear search">×</a> <a id="index-search-clear" href="javascript:;" title="Clear search">×</a>
<span id="hidden-label" hidden> &mdash; <span id="hidden-count"></span> <span id="hidden-toggle">[<a href="javascript:;">Show</a>]</span></span> <span id="hidden-label" hidden> &mdash; <span id="hidden-count"></span> <span id="hidden-toggle">[<a href="javascript:;">Show</a>]</span></span>
<input type="checkbox" id="index-rev" name="Reverse Sort" title="Reverse sort order">
<select id="index-mode" name="Index Mode"> <select id="index-mode" name="Index Mode">
<option disabled>Index Mode</option> <option disabled>Index Mode</option>
<option value="paged">Paged</option> <option value="paged">Paged</option>

View File

@ -40,7 +40,7 @@
<div>Index-only link: <code>g-index</code></div> <div>Index-only link: <code>g-index</code></div>
<div>Catalog-only link: <code>g-catalog</code></div> <div>Catalog-only link: <code>g-catalog</code></div>
<div>Index mode: <code>g-mode:&quot;infinite scrolling&quot;</code></div> <div>Index mode: <code>g-mode:&quot;infinite scrolling&quot;</code></div>
<div>Index sort: <code>g-sort:&quot;creation date&quot;</code></div> <div>Index sort: <code>g-sort:&quot;creation date rev&quot;</code></div>
<div>External link: <code>external-text:&quot;Google&quot;,&quot;http://www.google.com&quot;</code></div> <div>External link: <code>external-text:&quot;Google&quot;,&quot;http://www.google.com&quot;</code></div>
<div>Combinations are possible: <code>g-index-text:&quot;Technology Index&quot;</code></div> <div>Combinations are possible: <code>g-index-text:&quot;Technology Index&quot;</code></div>
<div>Full board list toggle: <code>toggle-all</code></div> <div>Full board list toggle: <code>toggle-all</code></div>

View File

@ -178,7 +178,7 @@ ThreadWatcher =
{db} = ThreadWatcher {db} = ThreadWatcher
interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR
now = Date.now() now = Date.now()
if now >= (db.data.lastChecked or 0) + interval unless now - interval < (db.data.lastChecked or 0) <= now
ThreadWatcher.fetchAllStatus() # calls forceSync ThreadWatcher.fetchAllStatus() # calls forceSync
db.data.lastChecked = now db.data.lastChecked = now
db.save() db.save()

View File

@ -84,7 +84,7 @@ class DataBoard
@deleteIfEmpty {boardID} @deleteIfEmpty {boardID}
now = Date.now() now = Date.now()
if (@data.lastChecked or 0) < now - 2 * $.HOUR unless now - 2 * $.HOUR < (@data.lastChecked or 0) <= now
@data.lastChecked = now @data.lastChecked = now
for boardID of @data.boards for boardID of @data.boards
@ajaxClean boardID @ajaxClean boardID

View File

@ -706,7 +706,7 @@ div[data-checked="false"] > .suboption-list {
#index-search:not([data-searching]) + #index-search-clear { #index-search:not([data-searching]) + #index-search-clear {
display: none; display: none;
} }
#index-mode, #index-sort, #index-size { #index-rev, #index-mode, #index-sort, #index-size {
float: right; float: right;
} }
.summary { .summary {

View File

@ -1,4 +1,4 @@
{ {
"version": "1.13.0.17", "version": "1.13.0.18",
"date": "2016-10-30T05:07:56.889Z" "date": "2016-10-31T02:53:57.311Z"
} }