Release 4chan X v1.9.2.3.
This commit is contained in:
parent
ad2619b1bc
commit
2735976fd2
@ -1,3 +1,10 @@
|
||||
### v1.9.2.3
|
||||
*2014-09-07*
|
||||
|
||||
**ccd0**
|
||||
- Thumbnail replacement / preloading / WebM bugfixes.
|
||||
- Embedded videos from mediacru.sh are no longer autoplayed and have controls.
|
||||
|
||||
### v1.9.2.2
|
||||
*2014-09-07*
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.2
|
||||
* 4chan X - Version 1.9.2.3
|
||||
*
|
||||
* 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.2
|
||||
// @version 1.9.2.3
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.2
|
||||
// @version 1.9.2.3
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.2
|
||||
* 4chan X - Version 1.9.2.3
|
||||
*
|
||||
* 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.2',
|
||||
VERSION: '1.9.2.3',
|
||||
NAMESPACE: '4chan X.',
|
||||
NAME: '4chan X',
|
||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||
@ -691,6 +691,15 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.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;
|
||||
@ -2257,6 +2266,9 @@
|
||||
},
|
||||
isNodeVisible: function(node) {
|
||||
var height;
|
||||
if (d.hidden || !doc.contains(node)) {
|
||||
return false;
|
||||
}
|
||||
height = node.getBoundingClientRect().height;
|
||||
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
||||
},
|
||||
@ -8162,7 +8174,7 @@
|
||||
ImageExpand.setupVideoCB(this);
|
||||
return ImageExpand.setupVideo(this, !((_ref = this.origin.file.fullImage) != null ? _ref.paused : void 0) || this.origin.file.wasPlaying, this.file.fullImage.controls);
|
||||
}
|
||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
} else if (ImageExpand.on && !this.isHidden && !this.isFetchedQuote && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
return ImageExpand.expand(this);
|
||||
}
|
||||
},
|
||||
@ -8216,18 +8228,22 @@
|
||||
},
|
||||
playVideos: function(e) {
|
||||
return g.posts.forEach(function(post) {
|
||||
var video, visible;
|
||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||
return;
|
||||
}
|
||||
video = post.file.fullImage;
|
||||
visible = !d.hidden && Header.isNodeVisible(video);
|
||||
if (visible && post.file.wasPlaying) {
|
||||
delete post.file.wasPlaying;
|
||||
video.play();
|
||||
} else if (!visible && !video.paused) {
|
||||
post.file.wasPlaying = true;
|
||||
video.pause();
|
||||
var video, visible, _i, _len, _ref;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||
continue;
|
||||
}
|
||||
video = post.file.fullImage;
|
||||
visible = Header.isNodeVisible(video);
|
||||
if (visible && post.file.wasPlaying) {
|
||||
delete post.file.wasPlaying;
|
||||
video.play();
|
||||
} else if (!visible && !video.paused) {
|
||||
post.file.wasPlaying = true;
|
||||
video.pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -8634,14 +8650,18 @@
|
||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||
$.on(d, 'scroll visibilitychange', function() {
|
||||
return g.posts.forEach(function(post) {
|
||||
var thumb, visible, _ref;
|
||||
if ((_ref = post.file) != null ? _ref.videoThumb : void 0) {
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
thumb = post.file.thumb;
|
||||
visible = !d.hidden && Header.isNodeVisible(thumb);
|
||||
if (visible) {
|
||||
return thumb.play();
|
||||
if (Header.isNodeVisible(thumb)) {
|
||||
thumb.play();
|
||||
} else {
|
||||
return thumb.pause();
|
||||
thumb.pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -8661,7 +8681,7 @@
|
||||
});
|
||||
},
|
||||
node: function(force) {
|
||||
var URL, cb, el, isImage, isVideo, match, prefetch, replace, style, thumb, type, _ref;
|
||||
var URL, el, isImage, isVideo, match, prefetch, replace, thumb, type, _ref;
|
||||
if (!this.file) {
|
||||
return;
|
||||
}
|
||||
@ -8672,7 +8692,6 @@
|
||||
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
||||
return;
|
||||
}
|
||||
style = thumb.style;
|
||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
||||
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
||||
@ -8682,78 +8701,93 @@
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace) {
|
||||
if (this.file.isSpoiler) {
|
||||
style.maxHeight = style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
}
|
||||
if (isVideo) {
|
||||
el.textContent = thumb.alt;
|
||||
el.dataset.md5 = thumb.dataset.md5;
|
||||
el.style.height = style.height;
|
||||
el.style.width = style.width;
|
||||
el.style.maxHeight = style.maxHeight;
|
||||
el.style.maxWidth = style.maxWidth;
|
||||
el.loop = true;
|
||||
el.className = thumb.className;
|
||||
if (isImage) {
|
||||
$.on(el, 'load', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceImage(_this);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
$.one(el, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(_this, el);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
cb = (function(_this) {
|
||||
return function() {
|
||||
$.off(el, 'load loadeddata', cb);
|
||||
return ImageLoader.replace(_this, el);
|
||||
};
|
||||
})(this);
|
||||
$.on(el, 'load loadeddata', cb);
|
||||
}
|
||||
ImageLoader.queue.push([el, URL]);
|
||||
if (!ImageLoader.busy) {
|
||||
return ImageLoader.next();
|
||||
}
|
||||
return ImageLoader.queueDownload(el, URL);
|
||||
},
|
||||
busy: false,
|
||||
queue: [],
|
||||
loadend: function() {
|
||||
$.off(this, 'load loadeddata error', ImageLoader.loadend);
|
||||
ImageLoader.busy = false;
|
||||
return ImageLoader.next();
|
||||
},
|
||||
next: function() {
|
||||
var el, item, url;
|
||||
if (ImageLoader.busy) {
|
||||
return;
|
||||
}
|
||||
if (item = ImageLoader.queue.shift()) {
|
||||
el = item[0], url = item[1];
|
||||
$.on(el, 'load loadeddata error', ImageLoader.loadend);
|
||||
setTimeout((function() {
|
||||
return ImageLoader.loadend.call(el);
|
||||
}), $.SECOND);
|
||||
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 ImageLoader.busy = true;
|
||||
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;
|
||||
}
|
||||
},
|
||||
replace: function(post, el) {
|
||||
var clone, file, isVideo, thumb, _i, _len, _ref;
|
||||
replaceVideo: function(post, video) {
|
||||
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||
file = post.file;
|
||||
isVideo = file.isVideo, thumb = file.thumb;
|
||||
thumb = file.thumb;
|
||||
style = thumb.style;
|
||||
if (!post.isClone) {
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
if (!isVideo || !$.hasClass(clone.nodes.root.parentNode, 'dialog')) {
|
||||
ImageLoader.replace(clone, el.cloneNode(true));
|
||||
}
|
||||
video2 = $.el('video');
|
||||
$.one(video2, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(clone, video2);
|
||||
};
|
||||
})(this));
|
||||
video2.src = video.src;
|
||||
}
|
||||
}
|
||||
if (isVideo) {
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(el, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, el);
|
||||
file.videoThumb = true;
|
||||
file.thumb = el;
|
||||
if (!post.isFetchedQuote) {
|
||||
return ImageLoader.play(el);
|
||||
}
|
||||
} else {
|
||||
return thumb.src = file.URL;
|
||||
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 (!post.isFetchedQuote) {
|
||||
return ImageLoader.play(video);
|
||||
}
|
||||
},
|
||||
play: function(video) {
|
||||
@ -8761,7 +8795,7 @@
|
||||
return $.asap((function() {
|
||||
return doc.contains(video);
|
||||
}), function() {
|
||||
if (!d.hidden && Header.isNodeVisible(video)) {
|
||||
if (Header.isNodeVisible(video)) {
|
||||
return video.play();
|
||||
}
|
||||
});
|
||||
@ -9301,7 +9335,7 @@
|
||||
case 'video/webm':
|
||||
case 'video/ogv':
|
||||
$.extend(el, {
|
||||
innerHTML: "<video autoplay loop><source type=\"video/mp4\"><source type=\"video/webm\"></video>"
|
||||
innerHTML: "<video controls loop><source type=\"video/mp4\"><source type=\"video/webm\"></video>"
|
||||
});
|
||||
_ref1 = ['mp4', 'webm'];
|
||||
_results = [];
|
||||
@ -12888,7 +12922,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.2</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.3</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.2
|
||||
// @version 1.9.2.3
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -23,7 +23,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.2
|
||||
* 4chan X - Version 1.9.2.3
|
||||
*
|
||||
* 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.2',
|
||||
VERSION: '1.9.2.3',
|
||||
NAMESPACE: '4chan X.',
|
||||
NAME: '4chan X',
|
||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||
@ -690,6 +690,15 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.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;
|
||||
@ -2256,6 +2265,9 @@
|
||||
},
|
||||
isNodeVisible: function(node) {
|
||||
var height;
|
||||
if (d.hidden || !doc.contains(node)) {
|
||||
return false;
|
||||
}
|
||||
height = node.getBoundingClientRect().height;
|
||||
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
||||
},
|
||||
@ -8161,7 +8173,7 @@
|
||||
ImageExpand.setupVideoCB(this);
|
||||
return ImageExpand.setupVideo(this, !((_ref = this.origin.file.fullImage) != null ? _ref.paused : void 0) || this.origin.file.wasPlaying, this.file.fullImage.controls);
|
||||
}
|
||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
} else if (ImageExpand.on && !this.isHidden && !this.isFetchedQuote && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
return ImageExpand.expand(this);
|
||||
}
|
||||
},
|
||||
@ -8215,18 +8227,22 @@
|
||||
},
|
||||
playVideos: function(e) {
|
||||
return g.posts.forEach(function(post) {
|
||||
var video, visible;
|
||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||
return;
|
||||
}
|
||||
video = post.file.fullImage;
|
||||
visible = !d.hidden && Header.isNodeVisible(video);
|
||||
if (visible && post.file.wasPlaying) {
|
||||
delete post.file.wasPlaying;
|
||||
video.play();
|
||||
} else if (!visible && !video.paused) {
|
||||
post.file.wasPlaying = true;
|
||||
video.pause();
|
||||
var video, visible, _i, _len, _ref;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||
continue;
|
||||
}
|
||||
video = post.file.fullImage;
|
||||
visible = Header.isNodeVisible(video);
|
||||
if (visible && post.file.wasPlaying) {
|
||||
delete post.file.wasPlaying;
|
||||
video.play();
|
||||
} else if (!visible && !video.paused) {
|
||||
post.file.wasPlaying = true;
|
||||
video.pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -8633,14 +8649,18 @@
|
||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||
$.on(d, 'scroll visibilitychange', function() {
|
||||
return g.posts.forEach(function(post) {
|
||||
var thumb, visible, _ref;
|
||||
if ((_ref = post.file) != null ? _ref.videoThumb : void 0) {
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
thumb = post.file.thumb;
|
||||
visible = !d.hidden && Header.isNodeVisible(thumb);
|
||||
if (visible) {
|
||||
return thumb.play();
|
||||
if (Header.isNodeVisible(thumb)) {
|
||||
thumb.play();
|
||||
} else {
|
||||
return thumb.pause();
|
||||
thumb.pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -8660,7 +8680,7 @@
|
||||
});
|
||||
},
|
||||
node: function(force) {
|
||||
var URL, cb, el, isImage, isVideo, match, prefetch, replace, style, thumb, type, _ref;
|
||||
var URL, el, isImage, isVideo, match, prefetch, replace, thumb, type, _ref;
|
||||
if (!this.file) {
|
||||
return;
|
||||
}
|
||||
@ -8671,7 +8691,6 @@
|
||||
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
||||
return;
|
||||
}
|
||||
style = thumb.style;
|
||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
||||
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
||||
@ -8681,78 +8700,93 @@
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace) {
|
||||
if (this.file.isSpoiler) {
|
||||
style.maxHeight = style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
}
|
||||
if (isVideo) {
|
||||
el.textContent = thumb.alt;
|
||||
el.dataset.md5 = thumb.dataset.md5;
|
||||
el.style.height = style.height;
|
||||
el.style.width = style.width;
|
||||
el.style.maxHeight = style.maxHeight;
|
||||
el.style.maxWidth = style.maxWidth;
|
||||
el.loop = true;
|
||||
el.className = thumb.className;
|
||||
if (isImage) {
|
||||
$.on(el, 'load', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceImage(_this);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
$.one(el, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(_this, el);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
cb = (function(_this) {
|
||||
return function() {
|
||||
$.off(el, 'load loadeddata', cb);
|
||||
return ImageLoader.replace(_this, el);
|
||||
};
|
||||
})(this);
|
||||
$.on(el, 'load loadeddata', cb);
|
||||
}
|
||||
ImageLoader.queue.push([el, URL]);
|
||||
if (!ImageLoader.busy) {
|
||||
return ImageLoader.next();
|
||||
}
|
||||
return ImageLoader.queueDownload(el, URL);
|
||||
},
|
||||
busy: false,
|
||||
queue: [],
|
||||
loadend: function() {
|
||||
$.off(this, 'load loadeddata error', ImageLoader.loadend);
|
||||
ImageLoader.busy = false;
|
||||
return ImageLoader.next();
|
||||
},
|
||||
next: function() {
|
||||
var el, item, url;
|
||||
if (ImageLoader.busy) {
|
||||
return;
|
||||
}
|
||||
if (item = ImageLoader.queue.shift()) {
|
||||
el = item[0], url = item[1];
|
||||
$.on(el, 'load loadeddata error', ImageLoader.loadend);
|
||||
setTimeout((function() {
|
||||
return ImageLoader.loadend.call(el);
|
||||
}), $.SECOND);
|
||||
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 ImageLoader.busy = true;
|
||||
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;
|
||||
}
|
||||
},
|
||||
replace: function(post, el) {
|
||||
var clone, file, isVideo, thumb, _i, _len, _ref;
|
||||
replaceVideo: function(post, video) {
|
||||
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||
file = post.file;
|
||||
isVideo = file.isVideo, thumb = file.thumb;
|
||||
thumb = file.thumb;
|
||||
style = thumb.style;
|
||||
if (!post.isClone) {
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
if (!isVideo || !$.hasClass(clone.nodes.root.parentNode, 'dialog')) {
|
||||
ImageLoader.replace(clone, el.cloneNode(true));
|
||||
}
|
||||
video2 = $.el('video');
|
||||
$.one(video2, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(clone, video2);
|
||||
};
|
||||
})(this));
|
||||
video2.src = video.src;
|
||||
}
|
||||
}
|
||||
if (isVideo) {
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(el, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, el);
|
||||
file.videoThumb = true;
|
||||
file.thumb = el;
|
||||
if (!post.isFetchedQuote) {
|
||||
return ImageLoader.play(el);
|
||||
}
|
||||
} else {
|
||||
return thumb.src = file.URL;
|
||||
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 (!post.isFetchedQuote) {
|
||||
return ImageLoader.play(video);
|
||||
}
|
||||
},
|
||||
play: function(video) {
|
||||
@ -8760,7 +8794,7 @@
|
||||
return $.asap((function() {
|
||||
return doc.contains(video);
|
||||
}), function() {
|
||||
if (!d.hidden && Header.isNodeVisible(video)) {
|
||||
if (Header.isNodeVisible(video)) {
|
||||
return video.play();
|
||||
}
|
||||
});
|
||||
@ -9300,7 +9334,7 @@
|
||||
case 'video/webm':
|
||||
case 'video/ogv':
|
||||
$.extend(el, {
|
||||
innerHTML: "<video autoplay loop><source type=\"video/mp4\"><source type=\"video/webm\"></video>"
|
||||
innerHTML: "<video controls loop><source type=\"video/mp4\"><source type=\"video/webm\"></video>"
|
||||
});
|
||||
_ref1 = ['mp4', 'webm'];
|
||||
_results = [];
|
||||
@ -12887,7 +12921,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.2</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.3</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.2
|
||||
// @version 1.9.2.3
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.9.2.2
|
||||
// @version 1.9.2.3
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.9.2.2
|
||||
* 4chan X - Version 1.9.2.3
|
||||
*
|
||||
* 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.2',
|
||||
VERSION: '1.9.2.3',
|
||||
NAMESPACE: '4chan X.',
|
||||
NAME: '4chan X',
|
||||
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
|
||||
@ -691,6 +691,15 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.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;
|
||||
@ -2257,6 +2266,9 @@
|
||||
},
|
||||
isNodeVisible: function(node) {
|
||||
var height;
|
||||
if (d.hidden || !doc.contains(node)) {
|
||||
return false;
|
||||
}
|
||||
height = node.getBoundingClientRect().height;
|
||||
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
||||
},
|
||||
@ -8162,7 +8174,7 @@
|
||||
ImageExpand.setupVideoCB(this);
|
||||
return ImageExpand.setupVideo(this, !((_ref = this.origin.file.fullImage) != null ? _ref.paused : void 0) || this.origin.file.wasPlaying, this.file.fullImage.controls);
|
||||
}
|
||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
} else if (ImageExpand.on && !this.isHidden && !this.isFetchedQuote && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
return ImageExpand.expand(this);
|
||||
}
|
||||
},
|
||||
@ -8216,18 +8228,22 @@
|
||||
},
|
||||
playVideos: function(e) {
|
||||
return g.posts.forEach(function(post) {
|
||||
var video, visible;
|
||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||
return;
|
||||
}
|
||||
video = post.file.fullImage;
|
||||
visible = !d.hidden && Header.isNodeVisible(video);
|
||||
if (visible && post.file.wasPlaying) {
|
||||
delete post.file.wasPlaying;
|
||||
video.play();
|
||||
} else if (!visible && !video.paused) {
|
||||
post.file.wasPlaying = true;
|
||||
video.pause();
|
||||
var video, visible, _i, _len, _ref;
|
||||
_ref = [post].concat(__slice.call(post.clones));
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
post = _ref[_i];
|
||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||
continue;
|
||||
}
|
||||
video = post.file.fullImage;
|
||||
visible = Header.isNodeVisible(video);
|
||||
if (visible && post.file.wasPlaying) {
|
||||
delete post.file.wasPlaying;
|
||||
video.play();
|
||||
} else if (!visible && !video.paused) {
|
||||
post.file.wasPlaying = true;
|
||||
video.pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -8634,14 +8650,18 @@
|
||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||
$.on(d, 'scroll visibilitychange', function() {
|
||||
return g.posts.forEach(function(post) {
|
||||
var thumb, visible, _ref;
|
||||
if ((_ref = post.file) != null ? _ref.videoThumb : void 0) {
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
thumb = post.file.thumb;
|
||||
visible = !d.hidden && Header.isNodeVisible(thumb);
|
||||
if (visible) {
|
||||
return thumb.play();
|
||||
if (Header.isNodeVisible(thumb)) {
|
||||
thumb.play();
|
||||
} else {
|
||||
return thumb.pause();
|
||||
thumb.pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -8661,7 +8681,7 @@
|
||||
});
|
||||
},
|
||||
node: function(force) {
|
||||
var URL, cb, el, isImage, isVideo, match, prefetch, replace, style, thumb, type, _ref;
|
||||
var URL, el, isImage, isVideo, match, prefetch, replace, thumb, type, _ref;
|
||||
if (!this.file) {
|
||||
return;
|
||||
}
|
||||
@ -8672,7 +8692,6 @@
|
||||
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
||||
return;
|
||||
}
|
||||
style = thumb.style;
|
||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
||||
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
||||
@ -8682,78 +8701,93 @@
|
||||
el = $.el(isImage ? 'img' : 'video');
|
||||
if (replace) {
|
||||
if (this.file.isSpoiler) {
|
||||
style.maxHeight = style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
}
|
||||
if (isVideo) {
|
||||
el.textContent = thumb.alt;
|
||||
el.dataset.md5 = thumb.dataset.md5;
|
||||
el.style.height = style.height;
|
||||
el.style.width = style.width;
|
||||
el.style.maxHeight = style.maxHeight;
|
||||
el.style.maxWidth = style.maxWidth;
|
||||
el.loop = true;
|
||||
el.className = thumb.className;
|
||||
if (isImage) {
|
||||
$.on(el, 'load', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceImage(_this);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
$.one(el, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(_this, el);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
cb = (function(_this) {
|
||||
return function() {
|
||||
$.off(el, 'load loadeddata', cb);
|
||||
return ImageLoader.replace(_this, el);
|
||||
};
|
||||
})(this);
|
||||
$.on(el, 'load loadeddata', cb);
|
||||
}
|
||||
ImageLoader.queue.push([el, URL]);
|
||||
if (!ImageLoader.busy) {
|
||||
return ImageLoader.next();
|
||||
}
|
||||
return ImageLoader.queueDownload(el, URL);
|
||||
},
|
||||
busy: false,
|
||||
queue: [],
|
||||
loadend: function() {
|
||||
$.off(this, 'load loadeddata error', ImageLoader.loadend);
|
||||
ImageLoader.busy = false;
|
||||
return ImageLoader.next();
|
||||
},
|
||||
next: function() {
|
||||
var el, item, url;
|
||||
if (ImageLoader.busy) {
|
||||
return;
|
||||
}
|
||||
if (item = ImageLoader.queue.shift()) {
|
||||
el = item[0], url = item[1];
|
||||
$.on(el, 'load loadeddata error', ImageLoader.loadend);
|
||||
setTimeout((function() {
|
||||
return ImageLoader.loadend.call(el);
|
||||
}), $.SECOND);
|
||||
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 ImageLoader.busy = true;
|
||||
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;
|
||||
}
|
||||
},
|
||||
replace: function(post, el) {
|
||||
var clone, file, isVideo, thumb, _i, _len, _ref;
|
||||
replaceVideo: function(post, video) {
|
||||
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||
file = post.file;
|
||||
isVideo = file.isVideo, thumb = file.thumb;
|
||||
thumb = file.thumb;
|
||||
style = thumb.style;
|
||||
if (!post.isClone) {
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
if (!isVideo || !$.hasClass(clone.nodes.root.parentNode, 'dialog')) {
|
||||
ImageLoader.replace(clone, el.cloneNode(true));
|
||||
}
|
||||
video2 = $.el('video');
|
||||
$.one(video2, 'loadeddata', (function(_this) {
|
||||
return function() {
|
||||
return ImageLoader.replaceVideo(clone, video2);
|
||||
};
|
||||
})(this));
|
||||
video2.src = video.src;
|
||||
}
|
||||
}
|
||||
if (isVideo) {
|
||||
if (Conf['Image Hover']) {
|
||||
$.on(el, 'mouseover', ImageHover.mouseover);
|
||||
}
|
||||
$.replace(thumb, el);
|
||||
file.videoThumb = true;
|
||||
file.thumb = el;
|
||||
if (!post.isFetchedQuote) {
|
||||
return ImageLoader.play(el);
|
||||
}
|
||||
} else {
|
||||
return thumb.src = file.URL;
|
||||
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 (!post.isFetchedQuote) {
|
||||
return ImageLoader.play(video);
|
||||
}
|
||||
},
|
||||
play: function(video) {
|
||||
@ -8761,7 +8795,7 @@
|
||||
return $.asap((function() {
|
||||
return doc.contains(video);
|
||||
}), function() {
|
||||
if (!d.hidden && Header.isNodeVisible(video)) {
|
||||
if (Header.isNodeVisible(video)) {
|
||||
return video.play();
|
||||
}
|
||||
});
|
||||
@ -9301,7 +9335,7 @@
|
||||
case 'video/webm':
|
||||
case 'video/ogv':
|
||||
$.extend(el, {
|
||||
innerHTML: "<video autoplay loop><source type=\"video/mp4\"><source type=\"video/webm\"></video>"
|
||||
innerHTML: "<video controls loop><source type=\"video/mp4\"><source type=\"video/webm\"></video>"
|
||||
});
|
||||
_ref1 = ['mp4', 'webm'];
|
||||
_results = [];
|
||||
@ -12888,7 +12922,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.2</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.3</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.2' />
|
||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.9.2.3' />
|
||||
</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.2' />
|
||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.9.2.3' />
|
||||
</app>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||
"meta": {
|
||||
"name": "4chan X",
|
||||
"version": "1.9.2.2",
|
||||
"version": "1.9.2.3",
|
||||
"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