Release 4chan X v1.9.13.0.
This commit is contained in:
parent
eeeedab8b2
commit
55e787931c
@ -2,6 +2,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).
|
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.13.x -->
|
||||||
|
### v1.9.13.0
|
||||||
|
*2014-11-23* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.13.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.13.0/builds/4chan-X-noupdate.crx "Chromium version")]
|
||||||
|
|
||||||
|
**ccd0**
|
||||||
|
- Improve unread count compatibility with quote threading.
|
||||||
|
- Add `Fullscreen Gallery` option (off by default).
|
||||||
|
- Make close, pause, and slideshow keybinds of gallery configurable.
|
||||||
|
|
||||||
<!-- v1.9.12.x -->
|
<!-- v1.9.12.x -->
|
||||||
### v1.9.12.5
|
### v1.9.12.5
|
||||||
*2014-11-22* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.12.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.12.5/builds/4chan-X-noupdate.crx "Chromium version")]
|
*2014-11-22* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.12.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.12.5/builds/4chan-X-noupdate.crx "Chromium version")]
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.9.12.5
|
* 4chan X - Version 1.9.13.0
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X beta
|
// @name 4chan X beta
|
||||||
// @version 1.9.12.5
|
// @version 1.9.13.0
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X beta
|
// @name 4chan X beta
|
||||||
// @version 1.9.12.5
|
// @version 1.9.13.0
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
@ -24,7 +24,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.9.12.5
|
* 4chan X - Version 1.9.13.0
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -178,6 +178,7 @@
|
|||||||
'Image Hover': [true, 'Show full image / video on mouseover.'],
|
'Image Hover': [true, 'Show full image / video on mouseover.'],
|
||||||
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'],
|
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'],
|
||||||
'Gallery': [true, 'Adds a simple and cute image gallery.'],
|
'Gallery': [true, 'Adds a simple and cute image gallery.'],
|
||||||
|
'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.'],
|
||||||
'PDF in Gallery': [false, 'Show PDF files in gallery.'],
|
'PDF in Gallery': [false, 'Show PDF files in gallery.'],
|
||||||
'Sauce': [true, 'Add sauce links to images.'],
|
'Sauce': [true, 'Add sauce links to images.'],
|
||||||
'Reveal Spoiler Thumbnails': [false, 'Replace spoiler thumbnails with the original image.'],
|
'Reveal Spoiler Thumbnails': [false, 'Replace spoiler thumbnails with the original image.'],
|
||||||
@ -267,7 +268,7 @@
|
|||||||
'Fit Width': [true],
|
'Fit Width': [true],
|
||||||
'Fit Height': [true],
|
'Fit Height': [true],
|
||||||
'Scroll to Post': [true],
|
'Scroll to Post': [true],
|
||||||
'Slide Delay': [5.0]
|
'Slide Delay': [6.0]
|
||||||
},
|
},
|
||||||
threadWatcher: {
|
threadWatcher: {
|
||||||
'Current Board': [false, 'Only show watched threads from the current board.'],
|
'Current Board': [false, 'Only show watched threads from the current board.'],
|
||||||
@ -330,7 +331,7 @@
|
|||||||
'Open empty QR': ['q', 'Open QR without post number inserted.'],
|
'Open empty QR': ['q', 'Open QR without post number inserted.'],
|
||||||
'Open QR': ['Shift+q', 'Open QR with post number inserted.'],
|
'Open QR': ['Shift+q', 'Open QR with post number inserted.'],
|
||||||
'Open settings': ['Alt+o', 'Open Settings.'],
|
'Open settings': ['Alt+o', 'Open Settings.'],
|
||||||
'Close': ['Esc', 'Close Settings, Notifications or QR.'],
|
'Close': ['Esc', 'Close Settings/Notifications/QR/Gallery.'],
|
||||||
'Spoiler tags': ['Ctrl+s', 'Insert spoiler tags.'],
|
'Spoiler tags': ['Ctrl+s', 'Insert spoiler tags.'],
|
||||||
'Code tags': ['Alt+c', 'Insert code tags.'],
|
'Code tags': ['Alt+c', 'Insert code tags.'],
|
||||||
'Eqn tags': ['Alt+e', 'Insert eqn tags.'],
|
'Eqn tags': ['Alt+e', 'Insert eqn tags.'],
|
||||||
@ -342,6 +343,8 @@
|
|||||||
'Expand image': ['Shift+e', 'Expand selected image.'],
|
'Expand image': ['Shift+e', 'Expand selected image.'],
|
||||||
'Expand images': ['e', 'Expand all images.'],
|
'Expand images': ['e', 'Expand all images.'],
|
||||||
'Open Gallery': ['g', 'Opens the gallery.'],
|
'Open Gallery': ['g', 'Opens the gallery.'],
|
||||||
|
'Pause': ['p', 'Pause/play videos in the gallery.'],
|
||||||
|
'Slideshow': ['s', 'Toggle the gallery slideshow mode.'],
|
||||||
'fappeTyme': ['f', 'Toggle Fappe Tyme.'],
|
'fappeTyme': ['f', 'Toggle Fappe Tyme.'],
|
||||||
'werkTyme': ['Shift+w', 'Toggle Werk Tyme.'],
|
'werkTyme': ['Shift+w', 'Toggle Werk Tyme.'],
|
||||||
'Front page': ['1', 'Jump to front page.'],
|
'Front page': ['1', 'Jump to front page.'],
|
||||||
@ -385,7 +388,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.9.12.5',
|
VERSION: '1.9.13.0',
|
||||||
NAMESPACE: '4chan X.',
|
NAMESPACE: '4chan X.',
|
||||||
NAME: '4chan X',
|
NAME: '4chan X',
|
||||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||||
@ -708,6 +711,15 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.one = function(el, events, handler) {
|
||||||
|
var cb;
|
||||||
|
cb = function(e) {
|
||||||
|
$.off(el, events, cb);
|
||||||
|
return handler.call(this, e);
|
||||||
|
};
|
||||||
|
return $.on(el, events, cb);
|
||||||
|
};
|
||||||
|
|
||||||
$.event = function(event, detail, root) {
|
$.event = function(event, detail, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = d;
|
root = d;
|
||||||
@ -6026,9 +6038,7 @@
|
|||||||
el: this.controls,
|
el: this.controls,
|
||||||
order: 98
|
order: 98
|
||||||
});
|
});
|
||||||
if (!Conf['Unread Count']) {
|
$.on(d, '4chanXInitFinished', this.ready);
|
||||||
$.on(d, '4chanXInitFinished', this.ready);
|
|
||||||
}
|
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Quote Threading',
|
name: 'Quote Threading',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
@ -6044,10 +6054,8 @@
|
|||||||
return post.cb(true);
|
return post.cb(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (Conf['Unread Count'] && Unread.thread.OP.nodes.root.parentElement.parentElement) {
|
Unread.read();
|
||||||
Unread.read();
|
return Unread.update();
|
||||||
return Unread.update();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var keys, len, posts, quote, _i, _len, _ref;
|
var keys, len, posts, quote, _i, _len, _ref;
|
||||||
@ -6055,9 +6063,7 @@
|
|||||||
if (this.isClone || !QuoteThreading.enabled) {
|
if (this.isClone || !QuoteThreading.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Conf['Unread Count']) {
|
Unread.addPost(this);
|
||||||
Unread.addPost(this);
|
|
||||||
}
|
|
||||||
if (this.thread.OP === this || this.isHidden) {
|
if (this.thread.OP === this || this.isHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6087,7 +6093,7 @@
|
|||||||
if (!force) {
|
if (!force) {
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
_ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
_ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
||||||
if (!((Conf['Unread Count'] && posts[post.ID]) || ((bottom < height) && (top > 0)))) {
|
if (!(posts[post.ID] || ((bottom < height) && (top > 0)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6103,9 +6109,6 @@
|
|||||||
$.after(root, threadContainer);
|
$.after(root, threadContainer);
|
||||||
$.addClass(root, 'threadOP');
|
$.addClass(root, 'threadOP');
|
||||||
}
|
}
|
||||||
if (!Conf['Unread Count']) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (post = posts[post.ID]) {
|
if (post = posts[post.ID]) {
|
||||||
posts.after(post, posts[this.ID]);
|
posts.after(post, posts[this.ID]);
|
||||||
} else if (posts[this.ID]) {
|
} else if (posts[this.ID]) {
|
||||||
@ -8298,6 +8301,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Conf['Fullscreen Gallery']) {
|
||||||
|
$.one(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', function() {
|
||||||
|
return $.on(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', cb.close);
|
||||||
|
});
|
||||||
|
if (typeof doc.mozRequestFullScreen === "function") {
|
||||||
|
doc.mozRequestFullScreen();
|
||||||
|
}
|
||||||
|
if (typeof doc.webkitRequestFullScreen === "function") {
|
||||||
|
doc.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
$.addClass(doc, 'gallery-open');
|
$.addClass(doc, 'gallery-open');
|
||||||
$.add(d.body, dialog);
|
$.add(d.body, dialog);
|
||||||
nodes.thumbs.scrollTop = 0;
|
nodes.thumbs.scrollTop = 0;
|
||||||
@ -8457,7 +8471,7 @@
|
|||||||
}
|
}
|
||||||
cb = (function() {
|
cb = (function() {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'Esc':
|
case Conf['Close']:
|
||||||
case Conf['Open Gallery']:
|
case Conf['Open Gallery']:
|
||||||
return Gallery.cb.close;
|
return Gallery.cb.close;
|
||||||
case 'Right':
|
case 'Right':
|
||||||
@ -8467,9 +8481,9 @@
|
|||||||
case 'Left':
|
case 'Left':
|
||||||
case '':
|
case '':
|
||||||
return Gallery.cb.prev;
|
return Gallery.cb.prev;
|
||||||
case 'p':
|
case Conf['Pause']:
|
||||||
return Gallery.cb.pause;
|
return Gallery.cb.pause;
|
||||||
case 's':
|
case Conf['Slideshow']:
|
||||||
return Gallery.cb.toggleSlideshow;
|
return Gallery.cb.toggleSlideshow;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -8553,6 +8567,15 @@
|
|||||||
}
|
}
|
||||||
$.rm(Gallery.nodes.el);
|
$.rm(Gallery.nodes.el);
|
||||||
$.rmClass(doc, 'gallery-open');
|
$.rmClass(doc, 'gallery-open');
|
||||||
|
if (Conf['Fullscreen Gallery']) {
|
||||||
|
$.off(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', Gallery.cb.close);
|
||||||
|
if (typeof d.mozCancelFullScreen === "function") {
|
||||||
|
d.mozCancelFullScreen();
|
||||||
|
}
|
||||||
|
if (typeof d.webkitExitFullscreen === "function") {
|
||||||
|
d.webkitExitFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
delete Gallery.nodes;
|
delete Gallery.nodes;
|
||||||
delete Gallery.fullIDs;
|
delete Gallery.fullIDs;
|
||||||
doc.style.overflow = '';
|
doc.style.overflow = '';
|
||||||
@ -11786,7 +11809,7 @@
|
|||||||
|
|
||||||
Unread = {
|
Unread = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Unread Line'] && !Conf['Desktop Notifications'] && !(Conf['Thread Watcher'] && Conf['Show Unread Count'])) {
|
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Unread Line'] && !Conf['Scroll to Last Read Post'] && !Conf['Thread Watcher'] && !Conf['Desktop Notifications'] && !Conf['Quote Threading']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.db = new DataBoard('lastReadPosts', this.sync);
|
this.db = new DataBoard('lastReadPosts', this.sync);
|
||||||
@ -11809,7 +11832,7 @@
|
|||||||
threadID: this.ID,
|
threadID: this.ID,
|
||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
});
|
});
|
||||||
$.on(d, '4chanXInitFinished', Unread.ready);
|
$.one(d, '4chanXInitFinished', Unread.ready);
|
||||||
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
||||||
$.on(d, 'scroll visibilitychange', Unread.read);
|
$.on(d, 'scroll visibilitychange', Unread.read);
|
||||||
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
||||||
@ -11818,7 +11841,6 @@
|
|||||||
},
|
},
|
||||||
ready: function() {
|
ready: function() {
|
||||||
var posts;
|
var posts;
|
||||||
$.off(d, '4chanXInitFinished', Unread.ready);
|
|
||||||
if (!Conf['Quote Threading']) {
|
if (!Conf['Quote Threading']) {
|
||||||
posts = [];
|
posts = [];
|
||||||
Unread.thread.posts.forEach(function(post) {
|
Unread.thread.posts.forEach(function(post) {
|
||||||
@ -11836,31 +11858,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
scroll: function() {
|
scroll: function() {
|
||||||
var down, hash, keys, post, posts, root;
|
var ID, hash, posts, root, _i, _ref;
|
||||||
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
|
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (post = Unread.posts.first) {
|
posts = Unread.thread.posts;
|
||||||
while (root = $.x('preceding-sibling::div[contains(@class,"replyContainer")][1]', post.data.nodes.root)) {
|
_ref = posts.keys;
|
||||||
if (!(post = Get.postFromRoot(root)).isHidden) {
|
for (_i = _ref.length - 1; _i >= 0; _i += -1) {
|
||||||
break;
|
ID = _ref[_i];
|
||||||
}
|
if (!(+ID <= Unread.lastReadPost)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!root) {
|
root = posts[ID].nodes.root;
|
||||||
return;
|
if (root.getBoundingClientRect().height) {
|
||||||
|
Header.scrollToIfNeeded(root, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
down = true;
|
|
||||||
} else {
|
|
||||||
posts = Unread.thread.posts;
|
|
||||||
keys = posts.keys;
|
|
||||||
root = posts[keys[keys.length - 1]].nodes.root;
|
|
||||||
}
|
|
||||||
if (Header.getBottomOf(root) < 0) {
|
|
||||||
return Header.scrollTo(root, down);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sync: function() {
|
sync: function() {
|
||||||
var ID, lastReadPost, post;
|
var ID, lastReadPost, _i, _len, _ref;
|
||||||
if (Unread.lastReadPost == null) {
|
if (Unread.lastReadPost == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -11873,13 +11890,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.lastReadPost = lastReadPost;
|
Unread.lastReadPost = lastReadPost;
|
||||||
post = Unread.posts.first;
|
_ref = Unread.thread.posts.keys;
|
||||||
while (post) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
if (post.ID > Unread.lastReadPost) {
|
ID = _ref[_i];
|
||||||
|
if (+ID > Unread.lastReadPost) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ID = post.ID;
|
|
||||||
post = post.next;
|
|
||||||
Unread.posts.rm(ID);
|
Unread.posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
}
|
}
|
||||||
@ -11901,13 +11917,14 @@
|
|||||||
return Unread.addPostQuotingYou(post);
|
return Unread.addPostQuotingYou(post);
|
||||||
},
|
},
|
||||||
addPosts: function(posts) {
|
addPosts: function(posts) {
|
||||||
var post, _i, _len, _ref, _ref1;
|
var oldCount, post, _i, _len;
|
||||||
|
oldCount = Unread.posts.length;
|
||||||
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
||||||
post = posts[_i];
|
post = posts[_i];
|
||||||
Unread.addPost(post);
|
Unread.addPost(post);
|
||||||
}
|
}
|
||||||
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
||||||
Unread.setLine((_ref = (_ref1 = Unread.posts.first) != null ? _ref1.data : void 0, __indexOf.call(posts, _ref) >= 0));
|
Unread.setLine(oldCount === 0 && Unread.posts.length !== 0);
|
||||||
}
|
}
|
||||||
Unread.read();
|
Unread.read();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
@ -11971,28 +11988,25 @@
|
|||||||
if (!posts[ID]) {
|
if (!posts[ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (post === posts.first && !(Conf['Quote Threading'] && Unread.posts.length)) {
|
|
||||||
Unread.lastReadPost = ID;
|
|
||||||
Unread.saveLastReadPost();
|
|
||||||
}
|
|
||||||
posts.rm(ID);
|
posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
|
Unread.saveLastReadPost();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
},
|
},
|
||||||
read: $.debounce(100, function(e) {
|
read: $.debounce(100, function(e) {
|
||||||
var ID, data, height, maxID, post, posts, _ref;
|
var ID, count, data, height, post, posts, _ref;
|
||||||
if (d.hidden || !Unread.posts.length) {
|
if (d.hidden || !Unread.posts.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
posts = Unread.posts;
|
posts = Unread.posts;
|
||||||
maxID = 0;
|
count = 0;
|
||||||
while (post = posts.first) {
|
while (post = posts.first) {
|
||||||
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) {
|
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ID = post.ID, data = post.data;
|
ID = post.ID, data = post.data;
|
||||||
maxID = Math.max(maxID, ID);
|
count++;
|
||||||
posts.rm(ID);
|
posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
if (Conf['Mark Quotes of You'] && ((_ref = QR.db) != null ? _ref.get({
|
if (Conf['Mark Quotes of You'] && ((_ref = QR.db) != null ? _ref.get({
|
||||||
@ -12003,23 +12017,30 @@
|
|||||||
QuoteYou.lastRead = data.nodes.root;
|
QuoteYou.lastRead = data.nodes.root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!maxID) {
|
if (!count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(Conf['Quote Threading'] && posts.length)) {
|
Unread.saveLastReadPost();
|
||||||
if (Unread.lastReadPost < maxID || !Unread.lastReadPost) {
|
|
||||||
Unread.lastReadPost = maxID;
|
|
||||||
}
|
|
||||||
Unread.saveLastReadPost();
|
|
||||||
}
|
|
||||||
if (e) {
|
if (e) {
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
saveLastReadPost: $.debounce(2 * $.SECOND, function() {
|
saveLastReadPost: $.debounce(2 * $.SECOND, function() {
|
||||||
|
var ID, _i, _len, _ref;
|
||||||
|
_ref = Unread.thread.posts.keys;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
ID = _ref[_i];
|
||||||
|
if (Unread.posts[ID]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (+ID > Unread.lastReadPost) {
|
||||||
|
Unread.lastReadPost = +ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Unread.thread.isDead && !Unread.thread.isArchived) {
|
if (Unread.thread.isDead && !Unread.thread.isArchived) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Unread.db.forceSync();
|
||||||
return Unread.db.set({
|
return Unread.db.set({
|
||||||
boardID: Unread.thread.board.ID,
|
boardID: Unread.thread.board.ID,
|
||||||
threadID: Unread.thread.ID,
|
threadID: Unread.thread.ID,
|
||||||
@ -12027,15 +12048,20 @@
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
setLine: function(force) {
|
setLine: function(force) {
|
||||||
var post;
|
var ID, posts, _i, _ref;
|
||||||
if (!(d.hidden || force === true)) {
|
if (!(d.hidden || force === true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(post = Unread.posts.first)) {
|
if (!Unread.posts.length) {
|
||||||
return $.rm(Unread.hr);
|
return $.rm(Unread.hr);
|
||||||
}
|
}
|
||||||
if ($.x('preceding-sibling::div[contains(@class,"replyContainer")]', post.data.nodes.root)) {
|
posts = Unread.thread.posts;
|
||||||
return $.before(post.data.nodes.root, Unread.hr);
|
_ref = posts.keys;
|
||||||
|
for (_i = _ref.length - 1; _i >= 0; _i += -1) {
|
||||||
|
ID = _ref[_i];
|
||||||
|
if (+ID <= Unread.lastReadPost) {
|
||||||
|
return $.after(posts[ID].nodes.root, Unread.hr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
@ -13169,7 +13195,7 @@
|
|||||||
Gallery.cb.toggle();
|
Gallery.cb.toggle();
|
||||||
break;
|
break;
|
||||||
case Conf['fappeTyme']:
|
case Conf['fappeTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!Conf['Fappe Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
FappeTyme.cb.toggle.call({
|
||||||
@ -13177,7 +13203,7 @@
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case Conf['werkTyme']:
|
case Conf['werkTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!Conf['Werk Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
FappeTyme.cb.toggle.call({
|
||||||
@ -13833,7 +13859,7 @@
|
|||||||
className: 'dialog'
|
className: 'dialog'
|
||||||
});
|
});
|
||||||
$.extend(dialog, {
|
$.extend(dialog, {
|
||||||
innerHTML: "<nav><div class=sections-list></div><p class='imp-exp-result warning'></p><div class=credits><a class=export>Export</a> | <a class=import>Import</a> | <a class=reset>Reset Settings</a> | <input type=file hidden><a href='https://github.com/ccd0/4chan-x' target=_blank>4chan X</a> | <a href='https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md' target=_blank>1.9.12.5</a> | <a href='https://github.com/ccd0/4chan-x/issues' target=_blank>Issues</a> | <a href=javascript:; class='close fa fa-times' title=Close></a></div></nav><div class=section-container><section></section></div>"
|
innerHTML: "<nav><div class=sections-list></div><p class='imp-exp-result warning'></p><div class=credits><a class=export>Export</a> | <a class=import>Import</a> | <a class=reset>Reset Settings</a> | <input type=file hidden><a href='https://github.com/ccd0/4chan-x' target=_blank>4chan X</a> | <a href='https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md' target=_blank>1.9.13.0</a> | <a href='https://github.com/ccd0/4chan-x/issues' target=_blank>Issues</a> | <a href=javascript:; class='close fa fa-times' title=Close></a></div></nav><div class=section-container><section></section></div>"
|
||||||
});
|
});
|
||||||
$.on($('.export', Settings.dialog), 'click', Settings["export"]);
|
$.on($('.export', Settings.dialog), 'click', Settings["export"]);
|
||||||
$.on($('.import', Settings.dialog), 'click', Settings["import"]);
|
$.on($('.import', Settings.dialog), 'click', Settings["import"]);
|
||||||
|
|||||||
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.9.12.5
|
// @version 1.9.13.0
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
@ -23,7 +23,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.9.12.5
|
* 4chan X - Version 1.9.13.0
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -177,6 +177,7 @@
|
|||||||
'Image Hover': [true, 'Show full image / video on mouseover.'],
|
'Image Hover': [true, 'Show full image / video on mouseover.'],
|
||||||
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'],
|
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'],
|
||||||
'Gallery': [true, 'Adds a simple and cute image gallery.'],
|
'Gallery': [true, 'Adds a simple and cute image gallery.'],
|
||||||
|
'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.'],
|
||||||
'PDF in Gallery': [false, 'Show PDF files in gallery.'],
|
'PDF in Gallery': [false, 'Show PDF files in gallery.'],
|
||||||
'Sauce': [true, 'Add sauce links to images.'],
|
'Sauce': [true, 'Add sauce links to images.'],
|
||||||
'Reveal Spoiler Thumbnails': [false, 'Replace spoiler thumbnails with the original image.'],
|
'Reveal Spoiler Thumbnails': [false, 'Replace spoiler thumbnails with the original image.'],
|
||||||
@ -266,7 +267,7 @@
|
|||||||
'Fit Width': [true],
|
'Fit Width': [true],
|
||||||
'Fit Height': [true],
|
'Fit Height': [true],
|
||||||
'Scroll to Post': [true],
|
'Scroll to Post': [true],
|
||||||
'Slide Delay': [5.0]
|
'Slide Delay': [6.0]
|
||||||
},
|
},
|
||||||
threadWatcher: {
|
threadWatcher: {
|
||||||
'Current Board': [false, 'Only show watched threads from the current board.'],
|
'Current Board': [false, 'Only show watched threads from the current board.'],
|
||||||
@ -329,7 +330,7 @@
|
|||||||
'Open empty QR': ['q', 'Open QR without post number inserted.'],
|
'Open empty QR': ['q', 'Open QR without post number inserted.'],
|
||||||
'Open QR': ['Shift+q', 'Open QR with post number inserted.'],
|
'Open QR': ['Shift+q', 'Open QR with post number inserted.'],
|
||||||
'Open settings': ['Alt+o', 'Open Settings.'],
|
'Open settings': ['Alt+o', 'Open Settings.'],
|
||||||
'Close': ['Esc', 'Close Settings, Notifications or QR.'],
|
'Close': ['Esc', 'Close Settings/Notifications/QR/Gallery.'],
|
||||||
'Spoiler tags': ['Ctrl+s', 'Insert spoiler tags.'],
|
'Spoiler tags': ['Ctrl+s', 'Insert spoiler tags.'],
|
||||||
'Code tags': ['Alt+c', 'Insert code tags.'],
|
'Code tags': ['Alt+c', 'Insert code tags.'],
|
||||||
'Eqn tags': ['Alt+e', 'Insert eqn tags.'],
|
'Eqn tags': ['Alt+e', 'Insert eqn tags.'],
|
||||||
@ -341,6 +342,8 @@
|
|||||||
'Expand image': ['Shift+e', 'Expand selected image.'],
|
'Expand image': ['Shift+e', 'Expand selected image.'],
|
||||||
'Expand images': ['e', 'Expand all images.'],
|
'Expand images': ['e', 'Expand all images.'],
|
||||||
'Open Gallery': ['g', 'Opens the gallery.'],
|
'Open Gallery': ['g', 'Opens the gallery.'],
|
||||||
|
'Pause': ['p', 'Pause/play videos in the gallery.'],
|
||||||
|
'Slideshow': ['s', 'Toggle the gallery slideshow mode.'],
|
||||||
'fappeTyme': ['f', 'Toggle Fappe Tyme.'],
|
'fappeTyme': ['f', 'Toggle Fappe Tyme.'],
|
||||||
'werkTyme': ['Shift+w', 'Toggle Werk Tyme.'],
|
'werkTyme': ['Shift+w', 'Toggle Werk Tyme.'],
|
||||||
'Front page': ['1', 'Jump to front page.'],
|
'Front page': ['1', 'Jump to front page.'],
|
||||||
@ -384,7 +387,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.9.12.5',
|
VERSION: '1.9.13.0',
|
||||||
NAMESPACE: '4chan X.',
|
NAMESPACE: '4chan X.',
|
||||||
NAME: '4chan X',
|
NAME: '4chan X',
|
||||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||||
@ -707,6 +710,15 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.one = function(el, events, handler) {
|
||||||
|
var cb;
|
||||||
|
cb = function(e) {
|
||||||
|
$.off(el, events, cb);
|
||||||
|
return handler.call(this, e);
|
||||||
|
};
|
||||||
|
return $.on(el, events, cb);
|
||||||
|
};
|
||||||
|
|
||||||
$.event = function(event, detail, root) {
|
$.event = function(event, detail, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = d;
|
root = d;
|
||||||
@ -6025,9 +6037,7 @@
|
|||||||
el: this.controls,
|
el: this.controls,
|
||||||
order: 98
|
order: 98
|
||||||
});
|
});
|
||||||
if (!Conf['Unread Count']) {
|
$.on(d, '4chanXInitFinished', this.ready);
|
||||||
$.on(d, '4chanXInitFinished', this.ready);
|
|
||||||
}
|
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Quote Threading',
|
name: 'Quote Threading',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
@ -6043,10 +6053,8 @@
|
|||||||
return post.cb(true);
|
return post.cb(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (Conf['Unread Count'] && Unread.thread.OP.nodes.root.parentElement.parentElement) {
|
Unread.read();
|
||||||
Unread.read();
|
return Unread.update();
|
||||||
return Unread.update();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var keys, len, posts, quote, _i, _len, _ref;
|
var keys, len, posts, quote, _i, _len, _ref;
|
||||||
@ -6054,9 +6062,7 @@
|
|||||||
if (this.isClone || !QuoteThreading.enabled) {
|
if (this.isClone || !QuoteThreading.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Conf['Unread Count']) {
|
Unread.addPost(this);
|
||||||
Unread.addPost(this);
|
|
||||||
}
|
|
||||||
if (this.thread.OP === this || this.isHidden) {
|
if (this.thread.OP === this || this.isHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6086,7 +6092,7 @@
|
|||||||
if (!force) {
|
if (!force) {
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
_ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
_ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
||||||
if (!((Conf['Unread Count'] && posts[post.ID]) || ((bottom < height) && (top > 0)))) {
|
if (!(posts[post.ID] || ((bottom < height) && (top > 0)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6102,9 +6108,6 @@
|
|||||||
$.after(root, threadContainer);
|
$.after(root, threadContainer);
|
||||||
$.addClass(root, 'threadOP');
|
$.addClass(root, 'threadOP');
|
||||||
}
|
}
|
||||||
if (!Conf['Unread Count']) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (post = posts[post.ID]) {
|
if (post = posts[post.ID]) {
|
||||||
posts.after(post, posts[this.ID]);
|
posts.after(post, posts[this.ID]);
|
||||||
} else if (posts[this.ID]) {
|
} else if (posts[this.ID]) {
|
||||||
@ -8297,6 +8300,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Conf['Fullscreen Gallery']) {
|
||||||
|
$.one(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', function() {
|
||||||
|
return $.on(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', cb.close);
|
||||||
|
});
|
||||||
|
if (typeof doc.mozRequestFullScreen === "function") {
|
||||||
|
doc.mozRequestFullScreen();
|
||||||
|
}
|
||||||
|
if (typeof doc.webkitRequestFullScreen === "function") {
|
||||||
|
doc.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
$.addClass(doc, 'gallery-open');
|
$.addClass(doc, 'gallery-open');
|
||||||
$.add(d.body, dialog);
|
$.add(d.body, dialog);
|
||||||
nodes.thumbs.scrollTop = 0;
|
nodes.thumbs.scrollTop = 0;
|
||||||
@ -8456,7 +8470,7 @@
|
|||||||
}
|
}
|
||||||
cb = (function() {
|
cb = (function() {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'Esc':
|
case Conf['Close']:
|
||||||
case Conf['Open Gallery']:
|
case Conf['Open Gallery']:
|
||||||
return Gallery.cb.close;
|
return Gallery.cb.close;
|
||||||
case 'Right':
|
case 'Right':
|
||||||
@ -8466,9 +8480,9 @@
|
|||||||
case 'Left':
|
case 'Left':
|
||||||
case '':
|
case '':
|
||||||
return Gallery.cb.prev;
|
return Gallery.cb.prev;
|
||||||
case 'p':
|
case Conf['Pause']:
|
||||||
return Gallery.cb.pause;
|
return Gallery.cb.pause;
|
||||||
case 's':
|
case Conf['Slideshow']:
|
||||||
return Gallery.cb.toggleSlideshow;
|
return Gallery.cb.toggleSlideshow;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -8552,6 +8566,15 @@
|
|||||||
}
|
}
|
||||||
$.rm(Gallery.nodes.el);
|
$.rm(Gallery.nodes.el);
|
||||||
$.rmClass(doc, 'gallery-open');
|
$.rmClass(doc, 'gallery-open');
|
||||||
|
if (Conf['Fullscreen Gallery']) {
|
||||||
|
$.off(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', Gallery.cb.close);
|
||||||
|
if (typeof d.mozCancelFullScreen === "function") {
|
||||||
|
d.mozCancelFullScreen();
|
||||||
|
}
|
||||||
|
if (typeof d.webkitExitFullscreen === "function") {
|
||||||
|
d.webkitExitFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
delete Gallery.nodes;
|
delete Gallery.nodes;
|
||||||
delete Gallery.fullIDs;
|
delete Gallery.fullIDs;
|
||||||
doc.style.overflow = '';
|
doc.style.overflow = '';
|
||||||
@ -11785,7 +11808,7 @@
|
|||||||
|
|
||||||
Unread = {
|
Unread = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Unread Line'] && !Conf['Desktop Notifications'] && !(Conf['Thread Watcher'] && Conf['Show Unread Count'])) {
|
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Unread Line'] && !Conf['Scroll to Last Read Post'] && !Conf['Thread Watcher'] && !Conf['Desktop Notifications'] && !Conf['Quote Threading']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.db = new DataBoard('lastReadPosts', this.sync);
|
this.db = new DataBoard('lastReadPosts', this.sync);
|
||||||
@ -11808,7 +11831,7 @@
|
|||||||
threadID: this.ID,
|
threadID: this.ID,
|
||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
});
|
});
|
||||||
$.on(d, '4chanXInitFinished', Unread.ready);
|
$.one(d, '4chanXInitFinished', Unread.ready);
|
||||||
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
||||||
$.on(d, 'scroll visibilitychange', Unread.read);
|
$.on(d, 'scroll visibilitychange', Unread.read);
|
||||||
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
||||||
@ -11817,7 +11840,6 @@
|
|||||||
},
|
},
|
||||||
ready: function() {
|
ready: function() {
|
||||||
var posts;
|
var posts;
|
||||||
$.off(d, '4chanXInitFinished', Unread.ready);
|
|
||||||
if (!Conf['Quote Threading']) {
|
if (!Conf['Quote Threading']) {
|
||||||
posts = [];
|
posts = [];
|
||||||
Unread.thread.posts.forEach(function(post) {
|
Unread.thread.posts.forEach(function(post) {
|
||||||
@ -11835,31 +11857,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
scroll: function() {
|
scroll: function() {
|
||||||
var down, hash, keys, post, posts, root;
|
var ID, hash, posts, root, _i, _ref;
|
||||||
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
|
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (post = Unread.posts.first) {
|
posts = Unread.thread.posts;
|
||||||
while (root = $.x('preceding-sibling::div[contains(@class,"replyContainer")][1]', post.data.nodes.root)) {
|
_ref = posts.keys;
|
||||||
if (!(post = Get.postFromRoot(root)).isHidden) {
|
for (_i = _ref.length - 1; _i >= 0; _i += -1) {
|
||||||
break;
|
ID = _ref[_i];
|
||||||
}
|
if (!(+ID <= Unread.lastReadPost)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!root) {
|
root = posts[ID].nodes.root;
|
||||||
return;
|
if (root.getBoundingClientRect().height) {
|
||||||
|
Header.scrollToIfNeeded(root, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
down = true;
|
|
||||||
} else {
|
|
||||||
posts = Unread.thread.posts;
|
|
||||||
keys = posts.keys;
|
|
||||||
root = posts[keys[keys.length - 1]].nodes.root;
|
|
||||||
}
|
|
||||||
if (Header.getBottomOf(root) < 0) {
|
|
||||||
return Header.scrollTo(root, down);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sync: function() {
|
sync: function() {
|
||||||
var ID, lastReadPost, post;
|
var ID, lastReadPost, _i, _len, _ref;
|
||||||
if (Unread.lastReadPost == null) {
|
if (Unread.lastReadPost == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -11872,13 +11889,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.lastReadPost = lastReadPost;
|
Unread.lastReadPost = lastReadPost;
|
||||||
post = Unread.posts.first;
|
_ref = Unread.thread.posts.keys;
|
||||||
while (post) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
if (post.ID > Unread.lastReadPost) {
|
ID = _ref[_i];
|
||||||
|
if (+ID > Unread.lastReadPost) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ID = post.ID;
|
|
||||||
post = post.next;
|
|
||||||
Unread.posts.rm(ID);
|
Unread.posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
}
|
}
|
||||||
@ -11900,13 +11916,14 @@
|
|||||||
return Unread.addPostQuotingYou(post);
|
return Unread.addPostQuotingYou(post);
|
||||||
},
|
},
|
||||||
addPosts: function(posts) {
|
addPosts: function(posts) {
|
||||||
var post, _i, _len, _ref, _ref1;
|
var oldCount, post, _i, _len;
|
||||||
|
oldCount = Unread.posts.length;
|
||||||
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
||||||
post = posts[_i];
|
post = posts[_i];
|
||||||
Unread.addPost(post);
|
Unread.addPost(post);
|
||||||
}
|
}
|
||||||
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
||||||
Unread.setLine((_ref = (_ref1 = Unread.posts.first) != null ? _ref1.data : void 0, __indexOf.call(posts, _ref) >= 0));
|
Unread.setLine(oldCount === 0 && Unread.posts.length !== 0);
|
||||||
}
|
}
|
||||||
Unread.read();
|
Unread.read();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
@ -11970,28 +11987,25 @@
|
|||||||
if (!posts[ID]) {
|
if (!posts[ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (post === posts.first && !(Conf['Quote Threading'] && Unread.posts.length)) {
|
|
||||||
Unread.lastReadPost = ID;
|
|
||||||
Unread.saveLastReadPost();
|
|
||||||
}
|
|
||||||
posts.rm(ID);
|
posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
|
Unread.saveLastReadPost();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
},
|
},
|
||||||
read: $.debounce(100, function(e) {
|
read: $.debounce(100, function(e) {
|
||||||
var ID, data, height, maxID, post, posts, _ref;
|
var ID, count, data, height, post, posts, _ref;
|
||||||
if (d.hidden || !Unread.posts.length) {
|
if (d.hidden || !Unread.posts.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
posts = Unread.posts;
|
posts = Unread.posts;
|
||||||
maxID = 0;
|
count = 0;
|
||||||
while (post = posts.first) {
|
while (post = posts.first) {
|
||||||
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) {
|
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ID = post.ID, data = post.data;
|
ID = post.ID, data = post.data;
|
||||||
maxID = Math.max(maxID, ID);
|
count++;
|
||||||
posts.rm(ID);
|
posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
if (Conf['Mark Quotes of You'] && ((_ref = QR.db) != null ? _ref.get({
|
if (Conf['Mark Quotes of You'] && ((_ref = QR.db) != null ? _ref.get({
|
||||||
@ -12002,23 +12016,30 @@
|
|||||||
QuoteYou.lastRead = data.nodes.root;
|
QuoteYou.lastRead = data.nodes.root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!maxID) {
|
if (!count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(Conf['Quote Threading'] && posts.length)) {
|
Unread.saveLastReadPost();
|
||||||
if (Unread.lastReadPost < maxID || !Unread.lastReadPost) {
|
|
||||||
Unread.lastReadPost = maxID;
|
|
||||||
}
|
|
||||||
Unread.saveLastReadPost();
|
|
||||||
}
|
|
||||||
if (e) {
|
if (e) {
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
saveLastReadPost: $.debounce(2 * $.SECOND, function() {
|
saveLastReadPost: $.debounce(2 * $.SECOND, function() {
|
||||||
|
var ID, _i, _len, _ref;
|
||||||
|
_ref = Unread.thread.posts.keys;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
ID = _ref[_i];
|
||||||
|
if (Unread.posts[ID]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (+ID > Unread.lastReadPost) {
|
||||||
|
Unread.lastReadPost = +ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Unread.thread.isDead && !Unread.thread.isArchived) {
|
if (Unread.thread.isDead && !Unread.thread.isArchived) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Unread.db.forceSync();
|
||||||
return Unread.db.set({
|
return Unread.db.set({
|
||||||
boardID: Unread.thread.board.ID,
|
boardID: Unread.thread.board.ID,
|
||||||
threadID: Unread.thread.ID,
|
threadID: Unread.thread.ID,
|
||||||
@ -12026,15 +12047,20 @@
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
setLine: function(force) {
|
setLine: function(force) {
|
||||||
var post;
|
var ID, posts, _i, _ref;
|
||||||
if (!(d.hidden || force === true)) {
|
if (!(d.hidden || force === true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(post = Unread.posts.first)) {
|
if (!Unread.posts.length) {
|
||||||
return $.rm(Unread.hr);
|
return $.rm(Unread.hr);
|
||||||
}
|
}
|
||||||
if ($.x('preceding-sibling::div[contains(@class,"replyContainer")]', post.data.nodes.root)) {
|
posts = Unread.thread.posts;
|
||||||
return $.before(post.data.nodes.root, Unread.hr);
|
_ref = posts.keys;
|
||||||
|
for (_i = _ref.length - 1; _i >= 0; _i += -1) {
|
||||||
|
ID = _ref[_i];
|
||||||
|
if (+ID <= Unread.lastReadPost) {
|
||||||
|
return $.after(posts[ID].nodes.root, Unread.hr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
@ -13168,7 +13194,7 @@
|
|||||||
Gallery.cb.toggle();
|
Gallery.cb.toggle();
|
||||||
break;
|
break;
|
||||||
case Conf['fappeTyme']:
|
case Conf['fappeTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!Conf['Fappe Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
FappeTyme.cb.toggle.call({
|
||||||
@ -13176,7 +13202,7 @@
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case Conf['werkTyme']:
|
case Conf['werkTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!Conf['Werk Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
FappeTyme.cb.toggle.call({
|
||||||
@ -13832,7 +13858,7 @@
|
|||||||
className: 'dialog'
|
className: 'dialog'
|
||||||
});
|
});
|
||||||
$.extend(dialog, {
|
$.extend(dialog, {
|
||||||
innerHTML: "<nav><div class=sections-list></div><p class='imp-exp-result warning'></p><div class=credits><a class=export>Export</a> | <a class=import>Import</a> | <a class=reset>Reset Settings</a> | <input type=file hidden><a href='https://github.com/ccd0/4chan-x' target=_blank>4chan X</a> | <a href='https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md' target=_blank>1.9.12.5</a> | <a href='https://github.com/ccd0/4chan-x/issues' target=_blank>Issues</a> | <a href=javascript:; class='close fa fa-times' title=Close></a></div></nav><div class=section-container><section></section></div>"
|
innerHTML: "<nav><div class=sections-list></div><p class='imp-exp-result warning'></p><div class=credits><a class=export>Export</a> | <a class=import>Import</a> | <a class=reset>Reset Settings</a> | <input type=file hidden><a href='https://github.com/ccd0/4chan-x' target=_blank>4chan X</a> | <a href='https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md' target=_blank>1.9.13.0</a> | <a href='https://github.com/ccd0/4chan-x/issues' target=_blank>Issues</a> | <a href=javascript:; class='close fa fa-times' title=Close></a></div></nav><div class=section-container><section></section></div>"
|
||||||
});
|
});
|
||||||
$.on($('.export', Settings.dialog), 'click', Settings["export"]);
|
$.on($('.export', Settings.dialog), 'click', Settings["export"]);
|
||||||
$.on($('.import', Settings.dialog), 'click', Settings["import"]);
|
$.on($('.import', Settings.dialog), 'click', Settings["import"]);
|
||||||
|
|||||||
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.9.12.5
|
// @version 1.9.13.0
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.9.12.5
|
// @version 1.9.13.0
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
@ -24,7 +24,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.9.12.5
|
* 4chan X - Version 1.9.13.0
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -178,6 +178,7 @@
|
|||||||
'Image Hover': [true, 'Show full image / video on mouseover.'],
|
'Image Hover': [true, 'Show full image / video on mouseover.'],
|
||||||
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'],
|
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'],
|
||||||
'Gallery': [true, 'Adds a simple and cute image gallery.'],
|
'Gallery': [true, 'Adds a simple and cute image gallery.'],
|
||||||
|
'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.'],
|
||||||
'PDF in Gallery': [false, 'Show PDF files in gallery.'],
|
'PDF in Gallery': [false, 'Show PDF files in gallery.'],
|
||||||
'Sauce': [true, 'Add sauce links to images.'],
|
'Sauce': [true, 'Add sauce links to images.'],
|
||||||
'Reveal Spoiler Thumbnails': [false, 'Replace spoiler thumbnails with the original image.'],
|
'Reveal Spoiler Thumbnails': [false, 'Replace spoiler thumbnails with the original image.'],
|
||||||
@ -267,7 +268,7 @@
|
|||||||
'Fit Width': [true],
|
'Fit Width': [true],
|
||||||
'Fit Height': [true],
|
'Fit Height': [true],
|
||||||
'Scroll to Post': [true],
|
'Scroll to Post': [true],
|
||||||
'Slide Delay': [5.0]
|
'Slide Delay': [6.0]
|
||||||
},
|
},
|
||||||
threadWatcher: {
|
threadWatcher: {
|
||||||
'Current Board': [false, 'Only show watched threads from the current board.'],
|
'Current Board': [false, 'Only show watched threads from the current board.'],
|
||||||
@ -330,7 +331,7 @@
|
|||||||
'Open empty QR': ['q', 'Open QR without post number inserted.'],
|
'Open empty QR': ['q', 'Open QR without post number inserted.'],
|
||||||
'Open QR': ['Shift+q', 'Open QR with post number inserted.'],
|
'Open QR': ['Shift+q', 'Open QR with post number inserted.'],
|
||||||
'Open settings': ['Alt+o', 'Open Settings.'],
|
'Open settings': ['Alt+o', 'Open Settings.'],
|
||||||
'Close': ['Esc', 'Close Settings, Notifications or QR.'],
|
'Close': ['Esc', 'Close Settings/Notifications/QR/Gallery.'],
|
||||||
'Spoiler tags': ['Ctrl+s', 'Insert spoiler tags.'],
|
'Spoiler tags': ['Ctrl+s', 'Insert spoiler tags.'],
|
||||||
'Code tags': ['Alt+c', 'Insert code tags.'],
|
'Code tags': ['Alt+c', 'Insert code tags.'],
|
||||||
'Eqn tags': ['Alt+e', 'Insert eqn tags.'],
|
'Eqn tags': ['Alt+e', 'Insert eqn tags.'],
|
||||||
@ -342,6 +343,8 @@
|
|||||||
'Expand image': ['Shift+e', 'Expand selected image.'],
|
'Expand image': ['Shift+e', 'Expand selected image.'],
|
||||||
'Expand images': ['e', 'Expand all images.'],
|
'Expand images': ['e', 'Expand all images.'],
|
||||||
'Open Gallery': ['g', 'Opens the gallery.'],
|
'Open Gallery': ['g', 'Opens the gallery.'],
|
||||||
|
'Pause': ['p', 'Pause/play videos in the gallery.'],
|
||||||
|
'Slideshow': ['s', 'Toggle the gallery slideshow mode.'],
|
||||||
'fappeTyme': ['f', 'Toggle Fappe Tyme.'],
|
'fappeTyme': ['f', 'Toggle Fappe Tyme.'],
|
||||||
'werkTyme': ['Shift+w', 'Toggle Werk Tyme.'],
|
'werkTyme': ['Shift+w', 'Toggle Werk Tyme.'],
|
||||||
'Front page': ['1', 'Jump to front page.'],
|
'Front page': ['1', 'Jump to front page.'],
|
||||||
@ -385,7 +388,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.9.12.5',
|
VERSION: '1.9.13.0',
|
||||||
NAMESPACE: '4chan X.',
|
NAMESPACE: '4chan X.',
|
||||||
NAME: '4chan X',
|
NAME: '4chan X',
|
||||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||||
@ -708,6 +711,15 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.one = function(el, events, handler) {
|
||||||
|
var cb;
|
||||||
|
cb = function(e) {
|
||||||
|
$.off(el, events, cb);
|
||||||
|
return handler.call(this, e);
|
||||||
|
};
|
||||||
|
return $.on(el, events, cb);
|
||||||
|
};
|
||||||
|
|
||||||
$.event = function(event, detail, root) {
|
$.event = function(event, detail, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = d;
|
root = d;
|
||||||
@ -6026,9 +6038,7 @@
|
|||||||
el: this.controls,
|
el: this.controls,
|
||||||
order: 98
|
order: 98
|
||||||
});
|
});
|
||||||
if (!Conf['Unread Count']) {
|
$.on(d, '4chanXInitFinished', this.ready);
|
||||||
$.on(d, '4chanXInitFinished', this.ready);
|
|
||||||
}
|
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Quote Threading',
|
name: 'Quote Threading',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
@ -6044,10 +6054,8 @@
|
|||||||
return post.cb(true);
|
return post.cb(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (Conf['Unread Count'] && Unread.thread.OP.nodes.root.parentElement.parentElement) {
|
Unread.read();
|
||||||
Unread.read();
|
return Unread.update();
|
||||||
return Unread.update();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var keys, len, posts, quote, _i, _len, _ref;
|
var keys, len, posts, quote, _i, _len, _ref;
|
||||||
@ -6055,9 +6063,7 @@
|
|||||||
if (this.isClone || !QuoteThreading.enabled) {
|
if (this.isClone || !QuoteThreading.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Conf['Unread Count']) {
|
Unread.addPost(this);
|
||||||
Unread.addPost(this);
|
|
||||||
}
|
|
||||||
if (this.thread.OP === this || this.isHidden) {
|
if (this.thread.OP === this || this.isHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6087,7 +6093,7 @@
|
|||||||
if (!force) {
|
if (!force) {
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
_ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
_ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
||||||
if (!((Conf['Unread Count'] && posts[post.ID]) || ((bottom < height) && (top > 0)))) {
|
if (!(posts[post.ID] || ((bottom < height) && (top > 0)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6103,9 +6109,6 @@
|
|||||||
$.after(root, threadContainer);
|
$.after(root, threadContainer);
|
||||||
$.addClass(root, 'threadOP');
|
$.addClass(root, 'threadOP');
|
||||||
}
|
}
|
||||||
if (!Conf['Unread Count']) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (post = posts[post.ID]) {
|
if (post = posts[post.ID]) {
|
||||||
posts.after(post, posts[this.ID]);
|
posts.after(post, posts[this.ID]);
|
||||||
} else if (posts[this.ID]) {
|
} else if (posts[this.ID]) {
|
||||||
@ -8298,6 +8301,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Conf['Fullscreen Gallery']) {
|
||||||
|
$.one(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', function() {
|
||||||
|
return $.on(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', cb.close);
|
||||||
|
});
|
||||||
|
if (typeof doc.mozRequestFullScreen === "function") {
|
||||||
|
doc.mozRequestFullScreen();
|
||||||
|
}
|
||||||
|
if (typeof doc.webkitRequestFullScreen === "function") {
|
||||||
|
doc.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
$.addClass(doc, 'gallery-open');
|
$.addClass(doc, 'gallery-open');
|
||||||
$.add(d.body, dialog);
|
$.add(d.body, dialog);
|
||||||
nodes.thumbs.scrollTop = 0;
|
nodes.thumbs.scrollTop = 0;
|
||||||
@ -8457,7 +8471,7 @@
|
|||||||
}
|
}
|
||||||
cb = (function() {
|
cb = (function() {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'Esc':
|
case Conf['Close']:
|
||||||
case Conf['Open Gallery']:
|
case Conf['Open Gallery']:
|
||||||
return Gallery.cb.close;
|
return Gallery.cb.close;
|
||||||
case 'Right':
|
case 'Right':
|
||||||
@ -8467,9 +8481,9 @@
|
|||||||
case 'Left':
|
case 'Left':
|
||||||
case '':
|
case '':
|
||||||
return Gallery.cb.prev;
|
return Gallery.cb.prev;
|
||||||
case 'p':
|
case Conf['Pause']:
|
||||||
return Gallery.cb.pause;
|
return Gallery.cb.pause;
|
||||||
case 's':
|
case Conf['Slideshow']:
|
||||||
return Gallery.cb.toggleSlideshow;
|
return Gallery.cb.toggleSlideshow;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -8553,6 +8567,15 @@
|
|||||||
}
|
}
|
||||||
$.rm(Gallery.nodes.el);
|
$.rm(Gallery.nodes.el);
|
||||||
$.rmClass(doc, 'gallery-open');
|
$.rmClass(doc, 'gallery-open');
|
||||||
|
if (Conf['Fullscreen Gallery']) {
|
||||||
|
$.off(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', Gallery.cb.close);
|
||||||
|
if (typeof d.mozCancelFullScreen === "function") {
|
||||||
|
d.mozCancelFullScreen();
|
||||||
|
}
|
||||||
|
if (typeof d.webkitExitFullscreen === "function") {
|
||||||
|
d.webkitExitFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
delete Gallery.nodes;
|
delete Gallery.nodes;
|
||||||
delete Gallery.fullIDs;
|
delete Gallery.fullIDs;
|
||||||
doc.style.overflow = '';
|
doc.style.overflow = '';
|
||||||
@ -11786,7 +11809,7 @@
|
|||||||
|
|
||||||
Unread = {
|
Unread = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Unread Line'] && !Conf['Desktop Notifications'] && !(Conf['Thread Watcher'] && Conf['Show Unread Count'])) {
|
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Unread Line'] && !Conf['Scroll to Last Read Post'] && !Conf['Thread Watcher'] && !Conf['Desktop Notifications'] && !Conf['Quote Threading']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.db = new DataBoard('lastReadPosts', this.sync);
|
this.db = new DataBoard('lastReadPosts', this.sync);
|
||||||
@ -11809,7 +11832,7 @@
|
|||||||
threadID: this.ID,
|
threadID: this.ID,
|
||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
});
|
});
|
||||||
$.on(d, '4chanXInitFinished', Unread.ready);
|
$.one(d, '4chanXInitFinished', Unread.ready);
|
||||||
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
||||||
$.on(d, 'scroll visibilitychange', Unread.read);
|
$.on(d, 'scroll visibilitychange', Unread.read);
|
||||||
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
||||||
@ -11818,7 +11841,6 @@
|
|||||||
},
|
},
|
||||||
ready: function() {
|
ready: function() {
|
||||||
var posts;
|
var posts;
|
||||||
$.off(d, '4chanXInitFinished', Unread.ready);
|
|
||||||
if (!Conf['Quote Threading']) {
|
if (!Conf['Quote Threading']) {
|
||||||
posts = [];
|
posts = [];
|
||||||
Unread.thread.posts.forEach(function(post) {
|
Unread.thread.posts.forEach(function(post) {
|
||||||
@ -11836,31 +11858,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
scroll: function() {
|
scroll: function() {
|
||||||
var down, hash, keys, post, posts, root;
|
var ID, hash, posts, root, _i, _ref;
|
||||||
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
|
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (post = Unread.posts.first) {
|
posts = Unread.thread.posts;
|
||||||
while (root = $.x('preceding-sibling::div[contains(@class,"replyContainer")][1]', post.data.nodes.root)) {
|
_ref = posts.keys;
|
||||||
if (!(post = Get.postFromRoot(root)).isHidden) {
|
for (_i = _ref.length - 1; _i >= 0; _i += -1) {
|
||||||
break;
|
ID = _ref[_i];
|
||||||
}
|
if (!(+ID <= Unread.lastReadPost)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!root) {
|
root = posts[ID].nodes.root;
|
||||||
return;
|
if (root.getBoundingClientRect().height) {
|
||||||
|
Header.scrollToIfNeeded(root, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
down = true;
|
|
||||||
} else {
|
|
||||||
posts = Unread.thread.posts;
|
|
||||||
keys = posts.keys;
|
|
||||||
root = posts[keys[keys.length - 1]].nodes.root;
|
|
||||||
}
|
|
||||||
if (Header.getBottomOf(root) < 0) {
|
|
||||||
return Header.scrollTo(root, down);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sync: function() {
|
sync: function() {
|
||||||
var ID, lastReadPost, post;
|
var ID, lastReadPost, _i, _len, _ref;
|
||||||
if (Unread.lastReadPost == null) {
|
if (Unread.lastReadPost == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -11873,13 +11890,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.lastReadPost = lastReadPost;
|
Unread.lastReadPost = lastReadPost;
|
||||||
post = Unread.posts.first;
|
_ref = Unread.thread.posts.keys;
|
||||||
while (post) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
if (post.ID > Unread.lastReadPost) {
|
ID = _ref[_i];
|
||||||
|
if (+ID > Unread.lastReadPost) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ID = post.ID;
|
|
||||||
post = post.next;
|
|
||||||
Unread.posts.rm(ID);
|
Unread.posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
}
|
}
|
||||||
@ -11901,13 +11917,14 @@
|
|||||||
return Unread.addPostQuotingYou(post);
|
return Unread.addPostQuotingYou(post);
|
||||||
},
|
},
|
||||||
addPosts: function(posts) {
|
addPosts: function(posts) {
|
||||||
var post, _i, _len, _ref, _ref1;
|
var oldCount, post, _i, _len;
|
||||||
|
oldCount = Unread.posts.length;
|
||||||
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
||||||
post = posts[_i];
|
post = posts[_i];
|
||||||
Unread.addPost(post);
|
Unread.addPost(post);
|
||||||
}
|
}
|
||||||
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
if (Conf['Unread Line'] && !Conf['Quote Threading']) {
|
||||||
Unread.setLine((_ref = (_ref1 = Unread.posts.first) != null ? _ref1.data : void 0, __indexOf.call(posts, _ref) >= 0));
|
Unread.setLine(oldCount === 0 && Unread.posts.length !== 0);
|
||||||
}
|
}
|
||||||
Unread.read();
|
Unread.read();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
@ -11971,28 +11988,25 @@
|
|||||||
if (!posts[ID]) {
|
if (!posts[ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (post === posts.first && !(Conf['Quote Threading'] && Unread.posts.length)) {
|
|
||||||
Unread.lastReadPost = ID;
|
|
||||||
Unread.saveLastReadPost();
|
|
||||||
}
|
|
||||||
posts.rm(ID);
|
posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
|
Unread.saveLastReadPost();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
},
|
},
|
||||||
read: $.debounce(100, function(e) {
|
read: $.debounce(100, function(e) {
|
||||||
var ID, data, height, maxID, post, posts, _ref;
|
var ID, count, data, height, post, posts, _ref;
|
||||||
if (d.hidden || !Unread.posts.length) {
|
if (d.hidden || !Unread.posts.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
posts = Unread.posts;
|
posts = Unread.posts;
|
||||||
maxID = 0;
|
count = 0;
|
||||||
while (post = posts.first) {
|
while (post = posts.first) {
|
||||||
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) {
|
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ID = post.ID, data = post.data;
|
ID = post.ID, data = post.data;
|
||||||
maxID = Math.max(maxID, ID);
|
count++;
|
||||||
posts.rm(ID);
|
posts.rm(ID);
|
||||||
delete Unread.postsQuotingYou[ID];
|
delete Unread.postsQuotingYou[ID];
|
||||||
if (Conf['Mark Quotes of You'] && ((_ref = QR.db) != null ? _ref.get({
|
if (Conf['Mark Quotes of You'] && ((_ref = QR.db) != null ? _ref.get({
|
||||||
@ -12003,23 +12017,30 @@
|
|||||||
QuoteYou.lastRead = data.nodes.root;
|
QuoteYou.lastRead = data.nodes.root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!maxID) {
|
if (!count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(Conf['Quote Threading'] && posts.length)) {
|
Unread.saveLastReadPost();
|
||||||
if (Unread.lastReadPost < maxID || !Unread.lastReadPost) {
|
|
||||||
Unread.lastReadPost = maxID;
|
|
||||||
}
|
|
||||||
Unread.saveLastReadPost();
|
|
||||||
}
|
|
||||||
if (e) {
|
if (e) {
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
saveLastReadPost: $.debounce(2 * $.SECOND, function() {
|
saveLastReadPost: $.debounce(2 * $.SECOND, function() {
|
||||||
|
var ID, _i, _len, _ref;
|
||||||
|
_ref = Unread.thread.posts.keys;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
ID = _ref[_i];
|
||||||
|
if (Unread.posts[ID]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (+ID > Unread.lastReadPost) {
|
||||||
|
Unread.lastReadPost = +ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Unread.thread.isDead && !Unread.thread.isArchived) {
|
if (Unread.thread.isDead && !Unread.thread.isArchived) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Unread.db.forceSync();
|
||||||
return Unread.db.set({
|
return Unread.db.set({
|
||||||
boardID: Unread.thread.board.ID,
|
boardID: Unread.thread.board.ID,
|
||||||
threadID: Unread.thread.ID,
|
threadID: Unread.thread.ID,
|
||||||
@ -12027,15 +12048,20 @@
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
setLine: function(force) {
|
setLine: function(force) {
|
||||||
var post;
|
var ID, posts, _i, _ref;
|
||||||
if (!(d.hidden || force === true)) {
|
if (!(d.hidden || force === true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(post = Unread.posts.first)) {
|
if (!Unread.posts.length) {
|
||||||
return $.rm(Unread.hr);
|
return $.rm(Unread.hr);
|
||||||
}
|
}
|
||||||
if ($.x('preceding-sibling::div[contains(@class,"replyContainer")]', post.data.nodes.root)) {
|
posts = Unread.thread.posts;
|
||||||
return $.before(post.data.nodes.root, Unread.hr);
|
_ref = posts.keys;
|
||||||
|
for (_i = _ref.length - 1; _i >= 0; _i += -1) {
|
||||||
|
ID = _ref[_i];
|
||||||
|
if (+ID <= Unread.lastReadPost) {
|
||||||
|
return $.after(posts[ID].nodes.root, Unread.hr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
@ -13169,7 +13195,7 @@
|
|||||||
Gallery.cb.toggle();
|
Gallery.cb.toggle();
|
||||||
break;
|
break;
|
||||||
case Conf['fappeTyme']:
|
case Conf['fappeTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!Conf['Fappe Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
FappeTyme.cb.toggle.call({
|
||||||
@ -13177,7 +13203,7 @@
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case Conf['werkTyme']:
|
case Conf['werkTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!Conf['Werk Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
FappeTyme.cb.toggle.call({
|
||||||
@ -13833,7 +13859,7 @@
|
|||||||
className: 'dialog'
|
className: 'dialog'
|
||||||
});
|
});
|
||||||
$.extend(dialog, {
|
$.extend(dialog, {
|
||||||
innerHTML: "<nav><div class=sections-list></div><p class='imp-exp-result warning'></p><div class=credits><a class=export>Export</a> | <a class=import>Import</a> | <a class=reset>Reset Settings</a> | <input type=file hidden><a href='https://github.com/ccd0/4chan-x' target=_blank>4chan X</a> | <a href='https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md' target=_blank>1.9.12.5</a> | <a href='https://github.com/ccd0/4chan-x/issues' target=_blank>Issues</a> | <a href=javascript:; class='close fa fa-times' title=Close></a></div></nav><div class=section-container><section></section></div>"
|
innerHTML: "<nav><div class=sections-list></div><p class='imp-exp-result warning'></p><div class=credits><a class=export>Export</a> | <a class=import>Import</a> | <a class=reset>Reset Settings</a> | <input type=file hidden><a href='https://github.com/ccd0/4chan-x' target=_blank>4chan X</a> | <a href='https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md' target=_blank>1.9.13.0</a> | <a href='https://github.com/ccd0/4chan-x/issues' target=_blank>Issues</a> | <a href=javascript:; class='close fa fa-times' title=Close></a></div></nav><div class=section-container><section></section></div>"
|
||||||
});
|
});
|
||||||
$.on($('.export', Settings.dialog), 'click', Settings["export"]);
|
$.on($('.export', Settings.dialog), 'click', Settings["export"]);
|
||||||
$.on($('.import', Settings.dialog), 'click', Settings["import"]);
|
$.on($('.import', Settings.dialog), 'click', Settings["import"]);
|
||||||
|
|||||||
Binary file not shown.
@ -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://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.9.12.5' />
|
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.9.13.0' />
|
||||||
</app>
|
</app>
|
||||||
</gupdate>
|
</gupdate>
|
||||||
|
|
||||||
|
|||||||
@ -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://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.9.12.5' />
|
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.9.13.0' />
|
||||||
</app>
|
</app>
|
||||||
</gupdate>
|
</gupdate>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||||
"meta": {
|
"meta": {
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
"version": "1.9.12.5",
|
"version": "1.9.13.0",
|
||||||
"repo": "https://github.com/ccd0/4chan-x/",
|
"repo": "https://github.com/ccd0/4chan-x/",
|
||||||
"page": "https://github.com/ccd0/4chan-x",
|
"page": "https://github.com/ccd0/4chan-x",
|
||||||
"downloads": "https://ccd0.github.io/4chan-x/builds/",
|
"downloads": "https://ccd0.github.io/4chan-x/builds/",
|
||||||
@ -67,4 +67,4 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user