Release 4chan X v1.9.2.8.
This commit is contained in:
parent
ccf898c72d
commit
0c59246f39
@ -1,3 +1,9 @@
|
||||
### v1.9.2.8
|
||||
*2014-09-11*
|
||||
|
||||
**ccd0**
|
||||
- Simplify and improve thumbnail replacement / preloading. Remove the download queue (didn't work well). Drop support for non-autoplaying replaced WebM thumbnails.
|
||||
|
||||
### v1.9.2.7
|
||||
*2014-09-10*
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.7
|
||||
* 4chan X - Version 1.9.2.8
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.7
|
||||
// @version 1.9.2.8
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.7
|
||||
// @version 1.9.2.8
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.7
|
||||
* 4chan X - Version 1.9.2.8
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -376,7 +376,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.9.2.7',
|
||||
VERSION: '1.9.2.8',
|
||||
NAMESPACE: '4chan X.',
|
||||
NAME: '4chan X',
|
||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||
@ -692,15 +692,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.one = function(el, events, handler) {
|
||||
var handler2;
|
||||
handler2 = function(e) {
|
||||
$.off(el, events, handler2);
|
||||
return handler.call(this, e);
|
||||
};
|
||||
return $.on(el, events, handler2);
|
||||
};
|
||||
|
||||
$.event = function(event, detail, root) {
|
||||
if (root == null) {
|
||||
root = d;
|
||||
@ -8658,25 +8649,30 @@
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
if (!(Conf["Image Prefetching"] || Conf["Replace JPG"] || Conf["Replace PNG"] || Conf["Replace GIF"] || Conf["Replace WEBM"])) {
|
||||
if (!(Conf['Image Prefetching'] || Conf['Replace JPG'] || Conf['Replace PNG'] || Conf['Replace GIF'] || Conf['Replace WEBM'])) {
|
||||
return;
|
||||
}
|
||||
Post.callbacks.push({
|
||||
name: 'Image Replace',
|
||||
cb: this.node
|
||||
});
|
||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||
$.on(d, 'scroll visibilitychange', function() {
|
||||
$.on(d, 'PostsInserted', function() {
|
||||
return g.posts.forEach(ImageLoader.prefetch);
|
||||
});
|
||||
if (Conf['Replace WEBM']) {
|
||||
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', function() {
|
||||
var qpClone, _ref;
|
||||
qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0;
|
||||
return g.posts.forEach(function(post) {
|
||||
var thumb, _i, _len, _ref, _ref1;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
if (!((_ref1 = post.file) != null ? _ref1.videoThumb : void 0)) {
|
||||
var thumb, _i, _len, _ref1, _ref2;
|
||||
_ref1 = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
post = _ref1[_i];
|
||||
if (!((_ref2 = post.file) != null ? _ref2.videoThumb : void 0)) {
|
||||
continue;
|
||||
}
|
||||
thumb = post.file.thumb;
|
||||
if (Header.isNodeVisible(thumb)) {
|
||||
if (Header.isNodeVisible(thumb) || post.nodes.root === qpClone) {
|
||||
thumb.play();
|
||||
} else {
|
||||
thumb.pause();
|
||||
@ -8685,16 +8681,6 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
$.on(d, 'PostsInserted', function() {
|
||||
var thumb, thumbsToPlay, _i, _len;
|
||||
thumbsToPlay = ImageLoader.thumbsToPlay;
|
||||
ImageLoader.thumbsToPlay = [];
|
||||
for (_i = 0, _len = thumbsToPlay.length; _i < _len; _i++) {
|
||||
thumb = thumbsToPlay[_i];
|
||||
ImageLoader.play(thumb);
|
||||
}
|
||||
return g.posts.forEach(ImageLoader.prefetch);
|
||||
});
|
||||
if (!Conf['Image Prefetching']) {
|
||||
return;
|
||||
}
|
||||
@ -8713,23 +8699,47 @@
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var _ref;
|
||||
if (this.isClone) {
|
||||
if ((_ref = this.file) != null ? _ref.videoThumb : void 0) {
|
||||
return ImageLoader.play(this.file.thumb);
|
||||
}
|
||||
} else {
|
||||
return ImageLoader.prefetch(this);
|
||||
if (this.isClone || !this.file) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Replace WEBM'] && this.file.isVideo) {
|
||||
ImageLoader.replaceVideo(this);
|
||||
}
|
||||
return ImageLoader.prefetch(this);
|
||||
},
|
||||
replaceVideo: function(post) {
|
||||
var attr, file, thumb, video, _i, _len, _ref;
|
||||
file = post.file;
|
||||
thumb = file.thumb;
|
||||
video = $.el('video', {
|
||||
preload: 'none',
|
||||
loop: true,
|
||||
poster: thumb.src,
|
||||
textContent: thumb.alt,
|
||||
className: thumb.className
|
||||
});
|
||||
video.dataset.md5 = thumb.dataset.md5;
|
||||
_ref = ['height', 'width', 'maxHeight', 'maxWidth'];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
attr = _ref[_i];
|
||||
video.style[attr] = thumb.style[attr];
|
||||
}
|
||||
video.src = file.URL;
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(video, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, video);
|
||||
file.thumb = video;
|
||||
return file.videoThumb = true;
|
||||
},
|
||||
prefetch: function(post) {
|
||||
var URL, el, file, isImage, isVideo, match, replace, thumb, type;
|
||||
var URL, clone, el, file, isImage, isVideo, match, replace, thumb, type, _i, _len, _ref;
|
||||
file = post.file;
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
isImage = file.isImage, isVideo = file.isVideo, thumb = file.thumb, URL = file.URL;
|
||||
if (!(isImage || isVideo) || post.isHidden || post.thread.isHidden || file.isPrefetched) {
|
||||
if (file.isPrefetched || !(isImage || isVideo) || post.isHidden || post.thread.isHidden) {
|
||||
return;
|
||||
}
|
||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||
@ -8743,108 +8753,33 @@
|
||||
return;
|
||||
}
|
||||
file.isPrefetched = true;
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace) {
|
||||
if (isImage) {
|
||||
$.on(el, 'load', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceImage(post);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
$.one(el, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(post, el);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
}
|
||||
return ImageLoader.queueDownload(el, URL);
|
||||
},
|
||||
queueDownload: (function() {
|
||||
var busy, items, load;
|
||||
busy = false;
|
||||
items = [];
|
||||
load = function(el, url) {
|
||||
$.one(el, 'load loadedmetadata error', function() {
|
||||
var el2, item, url2;
|
||||
busy = false;
|
||||
if (item = items.shift()) {
|
||||
el2 = item[0], url2 = item[1];
|
||||
return load(el2, url2);
|
||||
}
|
||||
});
|
||||
el.src = url;
|
||||
return busy = true;
|
||||
};
|
||||
return function(el, url) {
|
||||
if (busy) {
|
||||
return items.push([el, url]);
|
||||
} else {
|
||||
return load(el, url);
|
||||
}
|
||||
};
|
||||
})(),
|
||||
replaceImage: function(post) {
|
||||
var _i, _len, _ref;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
post.file.thumb.src = post.file.URL;
|
||||
}
|
||||
},
|
||||
replaceVideo: function(post, video) {
|
||||
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||
file = post.file;
|
||||
thumb = file.thumb;
|
||||
style = thumb.style;
|
||||
if (!post.isClone) {
|
||||
if (file.videoThumb) {
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
video2 = $.el('video');
|
||||
$.one(video2, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(clone, video2);
|
||||
};
|
||||
})(this));
|
||||
video2.src = video.src;
|
||||
clone.file.thumb.preload = 'auto';
|
||||
}
|
||||
thumb.preload = 'auto';
|
||||
if (typeof chrome === "undefined" || chrome === null) {
|
||||
$.on(thumb, 'loadeddata', function() {
|
||||
return this.removeAttribute('poster');
|
||||
});
|
||||
}
|
||||
}
|
||||
if (typeof chrome !== "undefined" && chrome !== null) {
|
||||
video.poster = thumb.src;
|
||||
}
|
||||
video.loop = true;
|
||||
video.textContent = thumb.alt;
|
||||
video.dataset.md5 = thumb.dataset.md5;
|
||||
video.style.height = style.height;
|
||||
video.style.width = style.width;
|
||||
video.style.maxHeight = style.maxHeight;
|
||||
video.style.maxWidth = style.maxWidth;
|
||||
video.className = thumb.className;
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(video, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, video);
|
||||
file.thumb = video;
|
||||
file.videoThumb = true;
|
||||
if (doc.contains(video) || post.isClone) {
|
||||
return ImageLoader.play(video);
|
||||
}
|
||||
},
|
||||
thumbsToPlay: [],
|
||||
play: function(thumb) {
|
||||
var _ref;
|
||||
if (!Conf['Autoplay']) {
|
||||
return;
|
||||
}
|
||||
if (doc.contains(thumb)) {
|
||||
if (Header.isNodeVisible(thumb) || ((_ref = $.id('qp')) != null ? _ref.contains(thumb) : void 0)) {
|
||||
return thumb.play();
|
||||
}
|
||||
} else {
|
||||
return ImageLoader.thumbsToPlay.push(thumb);
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace && isImage) {
|
||||
$.on(el, 'load', function() {
|
||||
var _j, _len1, _ref1;
|
||||
_ref1 = post.clones;
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
clone = _ref1[_j];
|
||||
clone.file.thumb.src = URL;
|
||||
}
|
||||
return thumb.src = URL;
|
||||
});
|
||||
}
|
||||
return el.src = URL;
|
||||
}
|
||||
};
|
||||
|
||||
@ -12961,7 +12896,7 @@
|
||||
className: '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.2.7</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.2.8</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($('.import', Settings.dialog), 'click', Settings["import"]);
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.7
|
||||
// @version 1.9.2.8
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -23,7 +23,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.7
|
||||
* 4chan X - Version 1.9.2.8
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -375,7 +375,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.9.2.7',
|
||||
VERSION: '1.9.2.8',
|
||||
NAMESPACE: '4chan X.',
|
||||
NAME: '4chan X',
|
||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||
@ -691,15 +691,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.one = function(el, events, handler) {
|
||||
var handler2;
|
||||
handler2 = function(e) {
|
||||
$.off(el, events, handler2);
|
||||
return handler.call(this, e);
|
||||
};
|
||||
return $.on(el, events, handler2);
|
||||
};
|
||||
|
||||
$.event = function(event, detail, root) {
|
||||
if (root == null) {
|
||||
root = d;
|
||||
@ -8657,25 +8648,30 @@
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
if (!(Conf["Image Prefetching"] || Conf["Replace JPG"] || Conf["Replace PNG"] || Conf["Replace GIF"] || Conf["Replace WEBM"])) {
|
||||
if (!(Conf['Image Prefetching'] || Conf['Replace JPG'] || Conf['Replace PNG'] || Conf['Replace GIF'] || Conf['Replace WEBM'])) {
|
||||
return;
|
||||
}
|
||||
Post.callbacks.push({
|
||||
name: 'Image Replace',
|
||||
cb: this.node
|
||||
});
|
||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||
$.on(d, 'scroll visibilitychange', function() {
|
||||
$.on(d, 'PostsInserted', function() {
|
||||
return g.posts.forEach(ImageLoader.prefetch);
|
||||
});
|
||||
if (Conf['Replace WEBM']) {
|
||||
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', function() {
|
||||
var qpClone, _ref;
|
||||
qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0;
|
||||
return g.posts.forEach(function(post) {
|
||||
var thumb, _i, _len, _ref, _ref1;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
if (!((_ref1 = post.file) != null ? _ref1.videoThumb : void 0)) {
|
||||
var thumb, _i, _len, _ref1, _ref2;
|
||||
_ref1 = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
post = _ref1[_i];
|
||||
if (!((_ref2 = post.file) != null ? _ref2.videoThumb : void 0)) {
|
||||
continue;
|
||||
}
|
||||
thumb = post.file.thumb;
|
||||
if (Header.isNodeVisible(thumb)) {
|
||||
if (Header.isNodeVisible(thumb) || post.nodes.root === qpClone) {
|
||||
thumb.play();
|
||||
} else {
|
||||
thumb.pause();
|
||||
@ -8684,16 +8680,6 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
$.on(d, 'PostsInserted', function() {
|
||||
var thumb, thumbsToPlay, _i, _len;
|
||||
thumbsToPlay = ImageLoader.thumbsToPlay;
|
||||
ImageLoader.thumbsToPlay = [];
|
||||
for (_i = 0, _len = thumbsToPlay.length; _i < _len; _i++) {
|
||||
thumb = thumbsToPlay[_i];
|
||||
ImageLoader.play(thumb);
|
||||
}
|
||||
return g.posts.forEach(ImageLoader.prefetch);
|
||||
});
|
||||
if (!Conf['Image Prefetching']) {
|
||||
return;
|
||||
}
|
||||
@ -8712,23 +8698,47 @@
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var _ref;
|
||||
if (this.isClone) {
|
||||
if ((_ref = this.file) != null ? _ref.videoThumb : void 0) {
|
||||
return ImageLoader.play(this.file.thumb);
|
||||
}
|
||||
} else {
|
||||
return ImageLoader.prefetch(this);
|
||||
if (this.isClone || !this.file) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Replace WEBM'] && this.file.isVideo) {
|
||||
ImageLoader.replaceVideo(this);
|
||||
}
|
||||
return ImageLoader.prefetch(this);
|
||||
},
|
||||
replaceVideo: function(post) {
|
||||
var attr, file, thumb, video, _i, _len, _ref;
|
||||
file = post.file;
|
||||
thumb = file.thumb;
|
||||
video = $.el('video', {
|
||||
preload: 'none',
|
||||
loop: true,
|
||||
poster: thumb.src,
|
||||
textContent: thumb.alt,
|
||||
className: thumb.className
|
||||
});
|
||||
video.dataset.md5 = thumb.dataset.md5;
|
||||
_ref = ['height', 'width', 'maxHeight', 'maxWidth'];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
attr = _ref[_i];
|
||||
video.style[attr] = thumb.style[attr];
|
||||
}
|
||||
video.src = file.URL;
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(video, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, video);
|
||||
file.thumb = video;
|
||||
return file.videoThumb = true;
|
||||
},
|
||||
prefetch: function(post) {
|
||||
var URL, el, file, isImage, isVideo, match, replace, thumb, type;
|
||||
var URL, clone, el, file, isImage, isVideo, match, replace, thumb, type, _i, _len, _ref;
|
||||
file = post.file;
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
isImage = file.isImage, isVideo = file.isVideo, thumb = file.thumb, URL = file.URL;
|
||||
if (!(isImage || isVideo) || post.isHidden || post.thread.isHidden || file.isPrefetched) {
|
||||
if (file.isPrefetched || !(isImage || isVideo) || post.isHidden || post.thread.isHidden) {
|
||||
return;
|
||||
}
|
||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||
@ -8742,108 +8752,33 @@
|
||||
return;
|
||||
}
|
||||
file.isPrefetched = true;
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace) {
|
||||
if (isImage) {
|
||||
$.on(el, 'load', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceImage(post);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
$.one(el, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(post, el);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
}
|
||||
return ImageLoader.queueDownload(el, URL);
|
||||
},
|
||||
queueDownload: (function() {
|
||||
var busy, items, load;
|
||||
busy = false;
|
||||
items = [];
|
||||
load = function(el, url) {
|
||||
$.one(el, 'load loadedmetadata error', function() {
|
||||
var el2, item, url2;
|
||||
busy = false;
|
||||
if (item = items.shift()) {
|
||||
el2 = item[0], url2 = item[1];
|
||||
return load(el2, url2);
|
||||
}
|
||||
});
|
||||
el.src = url;
|
||||
return busy = true;
|
||||
};
|
||||
return function(el, url) {
|
||||
if (busy) {
|
||||
return items.push([el, url]);
|
||||
} else {
|
||||
return load(el, url);
|
||||
}
|
||||
};
|
||||
})(),
|
||||
replaceImage: function(post) {
|
||||
var _i, _len, _ref;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
post.file.thumb.src = post.file.URL;
|
||||
}
|
||||
},
|
||||
replaceVideo: function(post, video) {
|
||||
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||
file = post.file;
|
||||
thumb = file.thumb;
|
||||
style = thumb.style;
|
||||
if (!post.isClone) {
|
||||
if (file.videoThumb) {
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
video2 = $.el('video');
|
||||
$.one(video2, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(clone, video2);
|
||||
};
|
||||
})(this));
|
||||
video2.src = video.src;
|
||||
clone.file.thumb.preload = 'auto';
|
||||
}
|
||||
thumb.preload = 'auto';
|
||||
if (typeof chrome === "undefined" || chrome === null) {
|
||||
$.on(thumb, 'loadeddata', function() {
|
||||
return this.removeAttribute('poster');
|
||||
});
|
||||
}
|
||||
}
|
||||
if (typeof chrome !== "undefined" && chrome !== null) {
|
||||
video.poster = thumb.src;
|
||||
}
|
||||
video.loop = true;
|
||||
video.textContent = thumb.alt;
|
||||
video.dataset.md5 = thumb.dataset.md5;
|
||||
video.style.height = style.height;
|
||||
video.style.width = style.width;
|
||||
video.style.maxHeight = style.maxHeight;
|
||||
video.style.maxWidth = style.maxWidth;
|
||||
video.className = thumb.className;
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(video, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, video);
|
||||
file.thumb = video;
|
||||
file.videoThumb = true;
|
||||
if (doc.contains(video) || post.isClone) {
|
||||
return ImageLoader.play(video);
|
||||
}
|
||||
},
|
||||
thumbsToPlay: [],
|
||||
play: function(thumb) {
|
||||
var _ref;
|
||||
if (!Conf['Autoplay']) {
|
||||
return;
|
||||
}
|
||||
if (doc.contains(thumb)) {
|
||||
if (Header.isNodeVisible(thumb) || ((_ref = $.id('qp')) != null ? _ref.contains(thumb) : void 0)) {
|
||||
return thumb.play();
|
||||
}
|
||||
} else {
|
||||
return ImageLoader.thumbsToPlay.push(thumb);
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace && isImage) {
|
||||
$.on(el, 'load', function() {
|
||||
var _j, _len1, _ref1;
|
||||
_ref1 = post.clones;
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
clone = _ref1[_j];
|
||||
clone.file.thumb.src = URL;
|
||||
}
|
||||
return thumb.src = URL;
|
||||
});
|
||||
}
|
||||
return el.src = URL;
|
||||
}
|
||||
};
|
||||
|
||||
@ -12960,7 +12895,7 @@
|
||||
className: '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.2.7</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.2.8</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($('.import', Settings.dialog), 'click', Settings["import"]);
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.7
|
||||
// @version 1.9.2.8
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.7
|
||||
// @version 1.9.2.8
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.7
|
||||
* 4chan X - Version 1.9.2.8
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -376,7 +376,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.9.2.7',
|
||||
VERSION: '1.9.2.8',
|
||||
NAMESPACE: '4chan X.',
|
||||
NAME: '4chan X',
|
||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||
@ -692,15 +692,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.one = function(el, events, handler) {
|
||||
var handler2;
|
||||
handler2 = function(e) {
|
||||
$.off(el, events, handler2);
|
||||
return handler.call(this, e);
|
||||
};
|
||||
return $.on(el, events, handler2);
|
||||
};
|
||||
|
||||
$.event = function(event, detail, root) {
|
||||
if (root == null) {
|
||||
root = d;
|
||||
@ -8658,25 +8649,30 @@
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
if (!(Conf["Image Prefetching"] || Conf["Replace JPG"] || Conf["Replace PNG"] || Conf["Replace GIF"] || Conf["Replace WEBM"])) {
|
||||
if (!(Conf['Image Prefetching'] || Conf['Replace JPG'] || Conf['Replace PNG'] || Conf['Replace GIF'] || Conf['Replace WEBM'])) {
|
||||
return;
|
||||
}
|
||||
Post.callbacks.push({
|
||||
name: 'Image Replace',
|
||||
cb: this.node
|
||||
});
|
||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||
$.on(d, 'scroll visibilitychange', function() {
|
||||
$.on(d, 'PostsInserted', function() {
|
||||
return g.posts.forEach(ImageLoader.prefetch);
|
||||
});
|
||||
if (Conf['Replace WEBM']) {
|
||||
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', function() {
|
||||
var qpClone, _ref;
|
||||
qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0;
|
||||
return g.posts.forEach(function(post) {
|
||||
var thumb, _i, _len, _ref, _ref1;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
if (!((_ref1 = post.file) != null ? _ref1.videoThumb : void 0)) {
|
||||
var thumb, _i, _len, _ref1, _ref2;
|
||||
_ref1 = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
post = _ref1[_i];
|
||||
if (!((_ref2 = post.file) != null ? _ref2.videoThumb : void 0)) {
|
||||
continue;
|
||||
}
|
||||
thumb = post.file.thumb;
|
||||
if (Header.isNodeVisible(thumb)) {
|
||||
if (Header.isNodeVisible(thumb) || post.nodes.root === qpClone) {
|
||||
thumb.play();
|
||||
} else {
|
||||
thumb.pause();
|
||||
@ -8685,16 +8681,6 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
$.on(d, 'PostsInserted', function() {
|
||||
var thumb, thumbsToPlay, _i, _len;
|
||||
thumbsToPlay = ImageLoader.thumbsToPlay;
|
||||
ImageLoader.thumbsToPlay = [];
|
||||
for (_i = 0, _len = thumbsToPlay.length; _i < _len; _i++) {
|
||||
thumb = thumbsToPlay[_i];
|
||||
ImageLoader.play(thumb);
|
||||
}
|
||||
return g.posts.forEach(ImageLoader.prefetch);
|
||||
});
|
||||
if (!Conf['Image Prefetching']) {
|
||||
return;
|
||||
}
|
||||
@ -8713,23 +8699,47 @@
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var _ref;
|
||||
if (this.isClone) {
|
||||
if ((_ref = this.file) != null ? _ref.videoThumb : void 0) {
|
||||
return ImageLoader.play(this.file.thumb);
|
||||
}
|
||||
} else {
|
||||
return ImageLoader.prefetch(this);
|
||||
if (this.isClone || !this.file) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Replace WEBM'] && this.file.isVideo) {
|
||||
ImageLoader.replaceVideo(this);
|
||||
}
|
||||
return ImageLoader.prefetch(this);
|
||||
},
|
||||
replaceVideo: function(post) {
|
||||
var attr, file, thumb, video, _i, _len, _ref;
|
||||
file = post.file;
|
||||
thumb = file.thumb;
|
||||
video = $.el('video', {
|
||||
preload: 'none',
|
||||
loop: true,
|
||||
poster: thumb.src,
|
||||
textContent: thumb.alt,
|
||||
className: thumb.className
|
||||
});
|
||||
video.dataset.md5 = thumb.dataset.md5;
|
||||
_ref = ['height', 'width', 'maxHeight', 'maxWidth'];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
attr = _ref[_i];
|
||||
video.style[attr] = thumb.style[attr];
|
||||
}
|
||||
video.src = file.URL;
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(video, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, video);
|
||||
file.thumb = video;
|
||||
return file.videoThumb = true;
|
||||
},
|
||||
prefetch: function(post) {
|
||||
var URL, el, file, isImage, isVideo, match, replace, thumb, type;
|
||||
var URL, clone, el, file, isImage, isVideo, match, replace, thumb, type, _i, _len, _ref;
|
||||
file = post.file;
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
isImage = file.isImage, isVideo = file.isVideo, thumb = file.thumb, URL = file.URL;
|
||||
if (!(isImage || isVideo) || post.isHidden || post.thread.isHidden || file.isPrefetched) {
|
||||
if (file.isPrefetched || !(isImage || isVideo) || post.isHidden || post.thread.isHidden) {
|
||||
return;
|
||||
}
|
||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||
@ -8743,108 +8753,33 @@
|
||||
return;
|
||||
}
|
||||
file.isPrefetched = true;
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace) {
|
||||
if (isImage) {
|
||||
$.on(el, 'load', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceImage(post);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
$.one(el, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(post, el);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
}
|
||||
return ImageLoader.queueDownload(el, URL);
|
||||
},
|
||||
queueDownload: (function() {
|
||||
var busy, items, load;
|
||||
busy = false;
|
||||
items = [];
|
||||
load = function(el, url) {
|
||||
$.one(el, 'load loadedmetadata error', function() {
|
||||
var el2, item, url2;
|
||||
busy = false;
|
||||
if (item = items.shift()) {
|
||||
el2 = item[0], url2 = item[1];
|
||||
return load(el2, url2);
|
||||
}
|
||||
});
|
||||
el.src = url;
|
||||
return busy = true;
|
||||
};
|
||||
return function(el, url) {
|
||||
if (busy) {
|
||||
return items.push([el, url]);
|
||||
} else {
|
||||
return load(el, url);
|
||||
}
|
||||
};
|
||||
})(),
|
||||
replaceImage: function(post) {
|
||||
var _i, _len, _ref;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
post.file.thumb.src = post.file.URL;
|
||||
}
|
||||
},
|
||||
replaceVideo: function(post, video) {
|
||||
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||
file = post.file;
|
||||
thumb = file.thumb;
|
||||
style = thumb.style;
|
||||
if (!post.isClone) {
|
||||
if (file.videoThumb) {
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
video2 = $.el('video');
|
||||
$.one(video2, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(clone, video2);
|
||||
};
|
||||
})(this));
|
||||
video2.src = video.src;
|
||||
clone.file.thumb.preload = 'auto';
|
||||
}
|
||||
thumb.preload = 'auto';
|
||||
if (typeof chrome === "undefined" || chrome === null) {
|
||||
$.on(thumb, 'loadeddata', function() {
|
||||
return this.removeAttribute('poster');
|
||||
});
|
||||
}
|
||||
}
|
||||
if (typeof chrome !== "undefined" && chrome !== null) {
|
||||
video.poster = thumb.src;
|
||||
}
|
||||
video.loop = true;
|
||||
video.textContent = thumb.alt;
|
||||
video.dataset.md5 = thumb.dataset.md5;
|
||||
video.style.height = style.height;
|
||||
video.style.width = style.width;
|
||||
video.style.maxHeight = style.maxHeight;
|
||||
video.style.maxWidth = style.maxWidth;
|
||||
video.className = thumb.className;
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(video, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, video);
|
||||
file.thumb = video;
|
||||
file.videoThumb = true;
|
||||
if (doc.contains(video) || post.isClone) {
|
||||
return ImageLoader.play(video);
|
||||
}
|
||||
},
|
||||
thumbsToPlay: [],
|
||||
play: function(thumb) {
|
||||
var _ref;
|
||||
if (!Conf['Autoplay']) {
|
||||
return;
|
||||
}
|
||||
if (doc.contains(thumb)) {
|
||||
if (Header.isNodeVisible(thumb) || ((_ref = $.id('qp')) != null ? _ref.contains(thumb) : void 0)) {
|
||||
return thumb.play();
|
||||
}
|
||||
} else {
|
||||
return ImageLoader.thumbsToPlay.push(thumb);
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace && isImage) {
|
||||
$.on(el, 'load', function() {
|
||||
var _j, _len1, _ref1;
|
||||
_ref1 = post.clones;
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
clone = _ref1[_j];
|
||||
clone.file.thumb.src = URL;
|
||||
}
|
||||
return thumb.src = URL;
|
||||
});
|
||||
}
|
||||
return el.src = URL;
|
||||
}
|
||||
};
|
||||
|
||||
@ -12961,7 +12896,7 @@
|
||||
className: '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.2.7</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.2.8</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($('.import', Settings.dialog), 'click', Settings["import"]);
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.9.2.7' />
|
||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.9.2.8' />
|
||||
</app>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.9.2.7' />
|
||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.9.2.8' />
|
||||
</app>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||
"meta": {
|
||||
"name": "4chan X",
|
||||
"version": "1.9.2.7",
|
||||
"version": "1.9.2.8",
|
||||
"repo": "https://github.com/ccd0/4chan-x/",
|
||||
"page": "https://github.com/ccd0/4chan-x",
|
||||
"downloads": "https://ccd0.github.io/4chan-x/builds/",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user