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
|
### v1.9.2.2
|
||||||
*2014-09-07*
|
*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.
|
* 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
|
// @name 4chan X
|
||||||
// @version 1.9.2.2
|
// @version 1.9.2.3
|
||||||
// @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.2.2
|
// @version 1.9.2.3
|
||||||
// @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.2.2
|
* 4chan X - Version 1.9.2.3
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -376,7 +376,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.9.2.2',
|
VERSION: '1.9.2.3',
|
||||||
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',
|
||||||
@ -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) {
|
$.event = function(event, detail, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = d;
|
root = d;
|
||||||
@ -2257,6 +2266,9 @@
|
|||||||
},
|
},
|
||||||
isNodeVisible: function(node) {
|
isNodeVisible: function(node) {
|
||||||
var height;
|
var height;
|
||||||
|
if (d.hidden || !doc.contains(node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
height = node.getBoundingClientRect().height;
|
height = node.getBoundingClientRect().height;
|
||||||
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
||||||
},
|
},
|
||||||
@ -8162,7 +8174,7 @@
|
|||||||
ImageExpand.setupVideoCB(this);
|
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);
|
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);
|
return ImageExpand.expand(this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8216,18 +8228,22 @@
|
|||||||
},
|
},
|
||||||
playVideos: function(e) {
|
playVideos: function(e) {
|
||||||
return g.posts.forEach(function(post) {
|
return g.posts.forEach(function(post) {
|
||||||
var video, visible;
|
var video, visible, _i, _len, _ref;
|
||||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
_ref = [post].concat(__slice.call(post.clones));
|
||||||
return;
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
}
|
post = _ref[_i];
|
||||||
video = post.file.fullImage;
|
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||||
visible = !d.hidden && Header.isNodeVisible(video);
|
continue;
|
||||||
if (visible && post.file.wasPlaying) {
|
}
|
||||||
delete post.file.wasPlaying;
|
video = post.file.fullImage;
|
||||||
video.play();
|
visible = Header.isNodeVisible(video);
|
||||||
} else if (!visible && !video.paused) {
|
if (visible && post.file.wasPlaying) {
|
||||||
post.file.wasPlaying = true;
|
delete post.file.wasPlaying;
|
||||||
video.pause();
|
video.play();
|
||||||
|
} else if (!visible && !video.paused) {
|
||||||
|
post.file.wasPlaying = true;
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -8634,14 +8650,18 @@
|
|||||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||||
$.on(d, 'scroll visibilitychange', function() {
|
$.on(d, 'scroll visibilitychange', function() {
|
||||||
return g.posts.forEach(function(post) {
|
return g.posts.forEach(function(post) {
|
||||||
var thumb, visible, _ref;
|
var thumb, _i, _len, _ref, _ref1;
|
||||||
if ((_ref = post.file) != null ? _ref.videoThumb : void 0) {
|
_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;
|
thumb = post.file.thumb;
|
||||||
visible = !d.hidden && Header.isNodeVisible(thumb);
|
if (Header.isNodeVisible(thumb)) {
|
||||||
if (visible) {
|
thumb.play();
|
||||||
return thumb.play();
|
|
||||||
} else {
|
} else {
|
||||||
return thumb.pause();
|
thumb.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -8661,7 +8681,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function(force) {
|
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) {
|
if (!this.file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8672,7 +8692,6 @@
|
|||||||
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
style = thumb.style;
|
|
||||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||||
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
||||||
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
||||||
@ -8682,78 +8701,93 @@
|
|||||||
el = $.el(isImage ? 'img' : 'video');
|
el = $.el(isImage ? 'img' : 'video');
|
||||||
if (replace) {
|
if (replace) {
|
||||||
if (this.file.isSpoiler) {
|
if (this.file.isSpoiler) {
|
||||||
style.maxHeight = style.maxWidth = this.isReply ? '125px' : '250px';
|
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
if (isImage) {
|
||||||
el.textContent = thumb.alt;
|
$.on(el, 'load', (function(_this) {
|
||||||
el.dataset.md5 = thumb.dataset.md5;
|
return function() {
|
||||||
el.style.height = style.height;
|
return ImageLoader.replaceImage(_this);
|
||||||
el.style.width = style.width;
|
};
|
||||||
el.style.maxHeight = style.maxHeight;
|
})(this));
|
||||||
el.style.maxWidth = style.maxWidth;
|
} else {
|
||||||
el.loop = true;
|
$.one(el, 'loadeddata', (function(_this) {
|
||||||
el.className = thumb.className;
|
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,
|
queueDownload: (function() {
|
||||||
queue: [],
|
var busy, items, load;
|
||||||
loadend: function() {
|
busy = false;
|
||||||
$.off(this, 'load loadeddata error', ImageLoader.loadend);
|
items = [];
|
||||||
ImageLoader.busy = false;
|
load = function(el, url) {
|
||||||
return ImageLoader.next();
|
$.one(el, 'load loadedmetadata error', function() {
|
||||||
},
|
var el2, item, url2;
|
||||||
next: function() {
|
busy = false;
|
||||||
var el, item, url;
|
if (item = items.shift()) {
|
||||||
if (ImageLoader.busy) {
|
el2 = item[0], url2 = item[1];
|
||||||
return;
|
return load(el2, url2);
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
el.src = url;
|
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) {
|
replaceVideo: function(post, video) {
|
||||||
var clone, file, isVideo, thumb, _i, _len, _ref;
|
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||||
file = post.file;
|
file = post.file;
|
||||||
isVideo = file.isVideo, thumb = file.thumb;
|
thumb = file.thumb;
|
||||||
|
style = thumb.style;
|
||||||
if (!post.isClone) {
|
if (!post.isClone) {
|
||||||
_ref = post.clones;
|
_ref = post.clones;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
clone = _ref[_i];
|
clone = _ref[_i];
|
||||||
if (!isVideo || !$.hasClass(clone.nodes.root.parentNode, 'dialog')) {
|
video2 = $.el('video');
|
||||||
ImageLoader.replace(clone, el.cloneNode(true));
|
$.one(video2, 'loadeddata', (function(_this) {
|
||||||
}
|
return function() {
|
||||||
|
return ImageLoader.replaceVideo(clone, video2);
|
||||||
|
};
|
||||||
|
})(this));
|
||||||
|
video2.src = video.src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
if (typeof chrome !== "undefined" && chrome !== null) {
|
||||||
if (Conf['Image Hover']) {
|
video.poster = thumb.src;
|
||||||
$.on(el, 'mouseover', ImageHover.mouseover);
|
}
|
||||||
}
|
video.loop = true;
|
||||||
$.replace(thumb, el);
|
video.textContent = thumb.alt;
|
||||||
file.videoThumb = true;
|
video.dataset.md5 = thumb.dataset.md5;
|
||||||
file.thumb = el;
|
video.style.height = style.height;
|
||||||
if (!post.isFetchedQuote) {
|
video.style.width = style.width;
|
||||||
return ImageLoader.play(el);
|
video.style.maxHeight = style.maxHeight;
|
||||||
}
|
video.style.maxWidth = style.maxWidth;
|
||||||
} else {
|
video.className = thumb.className;
|
||||||
return thumb.src = file.URL;
|
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) {
|
play: function(video) {
|
||||||
@ -8761,7 +8795,7 @@
|
|||||||
return $.asap((function() {
|
return $.asap((function() {
|
||||||
return doc.contains(video);
|
return doc.contains(video);
|
||||||
}), function() {
|
}), function() {
|
||||||
if (!d.hidden && Header.isNodeVisible(video)) {
|
if (Header.isNodeVisible(video)) {
|
||||||
return video.play();
|
return video.play();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -9301,7 +9335,7 @@
|
|||||||
case 'video/webm':
|
case 'video/webm':
|
||||||
case 'video/ogv':
|
case 'video/ogv':
|
||||||
$.extend(el, {
|
$.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'];
|
_ref1 = ['mp4', 'webm'];
|
||||||
_results = [];
|
_results = [];
|
||||||
@ -12888,7 +12922,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.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($('.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.2.2
|
// @version 1.9.2.3
|
||||||
// @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.2.2
|
* 4chan X - Version 1.9.2.3
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -375,7 +375,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.9.2.2',
|
VERSION: '1.9.2.3',
|
||||||
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',
|
||||||
@ -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) {
|
$.event = function(event, detail, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = d;
|
root = d;
|
||||||
@ -2256,6 +2265,9 @@
|
|||||||
},
|
},
|
||||||
isNodeVisible: function(node) {
|
isNodeVisible: function(node) {
|
||||||
var height;
|
var height;
|
||||||
|
if (d.hidden || !doc.contains(node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
height = node.getBoundingClientRect().height;
|
height = node.getBoundingClientRect().height;
|
||||||
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
||||||
},
|
},
|
||||||
@ -8161,7 +8173,7 @@
|
|||||||
ImageExpand.setupVideoCB(this);
|
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);
|
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);
|
return ImageExpand.expand(this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8215,18 +8227,22 @@
|
|||||||
},
|
},
|
||||||
playVideos: function(e) {
|
playVideos: function(e) {
|
||||||
return g.posts.forEach(function(post) {
|
return g.posts.forEach(function(post) {
|
||||||
var video, visible;
|
var video, visible, _i, _len, _ref;
|
||||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
_ref = [post].concat(__slice.call(post.clones));
|
||||||
return;
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
}
|
post = _ref[_i];
|
||||||
video = post.file.fullImage;
|
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||||
visible = !d.hidden && Header.isNodeVisible(video);
|
continue;
|
||||||
if (visible && post.file.wasPlaying) {
|
}
|
||||||
delete post.file.wasPlaying;
|
video = post.file.fullImage;
|
||||||
video.play();
|
visible = Header.isNodeVisible(video);
|
||||||
} else if (!visible && !video.paused) {
|
if (visible && post.file.wasPlaying) {
|
||||||
post.file.wasPlaying = true;
|
delete post.file.wasPlaying;
|
||||||
video.pause();
|
video.play();
|
||||||
|
} else if (!visible && !video.paused) {
|
||||||
|
post.file.wasPlaying = true;
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -8633,14 +8649,18 @@
|
|||||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||||
$.on(d, 'scroll visibilitychange', function() {
|
$.on(d, 'scroll visibilitychange', function() {
|
||||||
return g.posts.forEach(function(post) {
|
return g.posts.forEach(function(post) {
|
||||||
var thumb, visible, _ref;
|
var thumb, _i, _len, _ref, _ref1;
|
||||||
if ((_ref = post.file) != null ? _ref.videoThumb : void 0) {
|
_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;
|
thumb = post.file.thumb;
|
||||||
visible = !d.hidden && Header.isNodeVisible(thumb);
|
if (Header.isNodeVisible(thumb)) {
|
||||||
if (visible) {
|
thumb.play();
|
||||||
return thumb.play();
|
|
||||||
} else {
|
} else {
|
||||||
return thumb.pause();
|
thumb.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -8660,7 +8680,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function(force) {
|
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) {
|
if (!this.file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8671,7 +8691,6 @@
|
|||||||
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
style = thumb.style;
|
|
||||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||||
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
||||||
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
||||||
@ -8681,78 +8700,93 @@
|
|||||||
el = $.el(isImage ? 'img' : 'video');
|
el = $.el(isImage ? 'img' : 'video');
|
||||||
if (replace) {
|
if (replace) {
|
||||||
if (this.file.isSpoiler) {
|
if (this.file.isSpoiler) {
|
||||||
style.maxHeight = style.maxWidth = this.isReply ? '125px' : '250px';
|
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
if (isImage) {
|
||||||
el.textContent = thumb.alt;
|
$.on(el, 'load', (function(_this) {
|
||||||
el.dataset.md5 = thumb.dataset.md5;
|
return function() {
|
||||||
el.style.height = style.height;
|
return ImageLoader.replaceImage(_this);
|
||||||
el.style.width = style.width;
|
};
|
||||||
el.style.maxHeight = style.maxHeight;
|
})(this));
|
||||||
el.style.maxWidth = style.maxWidth;
|
} else {
|
||||||
el.loop = true;
|
$.one(el, 'loadeddata', (function(_this) {
|
||||||
el.className = thumb.className;
|
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,
|
queueDownload: (function() {
|
||||||
queue: [],
|
var busy, items, load;
|
||||||
loadend: function() {
|
busy = false;
|
||||||
$.off(this, 'load loadeddata error', ImageLoader.loadend);
|
items = [];
|
||||||
ImageLoader.busy = false;
|
load = function(el, url) {
|
||||||
return ImageLoader.next();
|
$.one(el, 'load loadedmetadata error', function() {
|
||||||
},
|
var el2, item, url2;
|
||||||
next: function() {
|
busy = false;
|
||||||
var el, item, url;
|
if (item = items.shift()) {
|
||||||
if (ImageLoader.busy) {
|
el2 = item[0], url2 = item[1];
|
||||||
return;
|
return load(el2, url2);
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
el.src = url;
|
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) {
|
replaceVideo: function(post, video) {
|
||||||
var clone, file, isVideo, thumb, _i, _len, _ref;
|
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||||
file = post.file;
|
file = post.file;
|
||||||
isVideo = file.isVideo, thumb = file.thumb;
|
thumb = file.thumb;
|
||||||
|
style = thumb.style;
|
||||||
if (!post.isClone) {
|
if (!post.isClone) {
|
||||||
_ref = post.clones;
|
_ref = post.clones;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
clone = _ref[_i];
|
clone = _ref[_i];
|
||||||
if (!isVideo || !$.hasClass(clone.nodes.root.parentNode, 'dialog')) {
|
video2 = $.el('video');
|
||||||
ImageLoader.replace(clone, el.cloneNode(true));
|
$.one(video2, 'loadeddata', (function(_this) {
|
||||||
}
|
return function() {
|
||||||
|
return ImageLoader.replaceVideo(clone, video2);
|
||||||
|
};
|
||||||
|
})(this));
|
||||||
|
video2.src = video.src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
if (typeof chrome !== "undefined" && chrome !== null) {
|
||||||
if (Conf['Image Hover']) {
|
video.poster = thumb.src;
|
||||||
$.on(el, 'mouseover', ImageHover.mouseover);
|
}
|
||||||
}
|
video.loop = true;
|
||||||
$.replace(thumb, el);
|
video.textContent = thumb.alt;
|
||||||
file.videoThumb = true;
|
video.dataset.md5 = thumb.dataset.md5;
|
||||||
file.thumb = el;
|
video.style.height = style.height;
|
||||||
if (!post.isFetchedQuote) {
|
video.style.width = style.width;
|
||||||
return ImageLoader.play(el);
|
video.style.maxHeight = style.maxHeight;
|
||||||
}
|
video.style.maxWidth = style.maxWidth;
|
||||||
} else {
|
video.className = thumb.className;
|
||||||
return thumb.src = file.URL;
|
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) {
|
play: function(video) {
|
||||||
@ -8760,7 +8794,7 @@
|
|||||||
return $.asap((function() {
|
return $.asap((function() {
|
||||||
return doc.contains(video);
|
return doc.contains(video);
|
||||||
}), function() {
|
}), function() {
|
||||||
if (!d.hidden && Header.isNodeVisible(video)) {
|
if (Header.isNodeVisible(video)) {
|
||||||
return video.play();
|
return video.play();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -9300,7 +9334,7 @@
|
|||||||
case 'video/webm':
|
case 'video/webm':
|
||||||
case 'video/ogv':
|
case 'video/ogv':
|
||||||
$.extend(el, {
|
$.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'];
|
_ref1 = ['mp4', 'webm'];
|
||||||
_results = [];
|
_results = [];
|
||||||
@ -12887,7 +12921,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.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($('.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.2.2
|
// @version 1.9.2.3
|
||||||
// @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.2.2
|
// @version 1.9.2.3
|
||||||
// @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.2.2
|
* 4chan X - Version 1.9.2.3
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -376,7 +376,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.9.2.2',
|
VERSION: '1.9.2.3',
|
||||||
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',
|
||||||
@ -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) {
|
$.event = function(event, detail, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = d;
|
root = d;
|
||||||
@ -2257,6 +2266,9 @@
|
|||||||
},
|
},
|
||||||
isNodeVisible: function(node) {
|
isNodeVisible: function(node) {
|
||||||
var height;
|
var height;
|
||||||
|
if (d.hidden || !doc.contains(node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
height = node.getBoundingClientRect().height;
|
height = node.getBoundingClientRect().height;
|
||||||
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
return Header.getTopOf(node) + height >= 0 && Header.getBottomOf(node) + height >= 0;
|
||||||
},
|
},
|
||||||
@ -8162,7 +8174,7 @@
|
|||||||
ImageExpand.setupVideoCB(this);
|
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);
|
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);
|
return ImageExpand.expand(this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8216,18 +8228,22 @@
|
|||||||
},
|
},
|
||||||
playVideos: function(e) {
|
playVideos: function(e) {
|
||||||
return g.posts.forEach(function(post) {
|
return g.posts.forEach(function(post) {
|
||||||
var video, visible;
|
var video, visible, _i, _len, _ref;
|
||||||
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
_ref = [post].concat(__slice.call(post.clones));
|
||||||
return;
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
}
|
post = _ref[_i];
|
||||||
video = post.file.fullImage;
|
if (!(post.file && post.file.isVideo && post.file.isExpanded)) {
|
||||||
visible = !d.hidden && Header.isNodeVisible(video);
|
continue;
|
||||||
if (visible && post.file.wasPlaying) {
|
}
|
||||||
delete post.file.wasPlaying;
|
video = post.file.fullImage;
|
||||||
video.play();
|
visible = Header.isNodeVisible(video);
|
||||||
} else if (!visible && !video.paused) {
|
if (visible && post.file.wasPlaying) {
|
||||||
post.file.wasPlaying = true;
|
delete post.file.wasPlaying;
|
||||||
video.pause();
|
video.play();
|
||||||
|
} else if (!visible && !video.paused) {
|
||||||
|
post.file.wasPlaying = true;
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -8634,14 +8650,18 @@
|
|||||||
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
if (Conf['Replace WEBM'] && Conf['Autoplay']) {
|
||||||
$.on(d, 'scroll visibilitychange', function() {
|
$.on(d, 'scroll visibilitychange', function() {
|
||||||
return g.posts.forEach(function(post) {
|
return g.posts.forEach(function(post) {
|
||||||
var thumb, visible, _ref;
|
var thumb, _i, _len, _ref, _ref1;
|
||||||
if ((_ref = post.file) != null ? _ref.videoThumb : void 0) {
|
_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;
|
thumb = post.file.thumb;
|
||||||
visible = !d.hidden && Header.isNodeVisible(thumb);
|
if (Header.isNodeVisible(thumb)) {
|
||||||
if (visible) {
|
thumb.play();
|
||||||
return thumb.play();
|
|
||||||
} else {
|
} else {
|
||||||
return thumb.pause();
|
thumb.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -8661,7 +8681,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function(force) {
|
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) {
|
if (!this.file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8672,7 +8692,6 @@
|
|||||||
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
if (this.isClone || this.isHidden || this.thread.isHidden || !(isImage || isVideo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
style = thumb.style;
|
|
||||||
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
type = (match = URL.match(/\.([^.]+)$/)[1].toUpperCase()) === 'JPEG' ? 'JPG' : match;
|
||||||
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
replace = Conf["Replace " + type] && !/spoiler/.test(thumb.src);
|
||||||
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
prefetch = (Conf['prefetch'] && g.VIEW === 'thread') || force;
|
||||||
@ -8682,78 +8701,93 @@
|
|||||||
el = $.el(isImage ? 'img' : 'video');
|
el = $.el(isImage ? 'img' : 'video');
|
||||||
if (replace) {
|
if (replace) {
|
||||||
if (this.file.isSpoiler) {
|
if (this.file.isSpoiler) {
|
||||||
style.maxHeight = style.maxWidth = this.isReply ? '125px' : '250px';
|
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
if (isImage) {
|
||||||
el.textContent = thumb.alt;
|
$.on(el, 'load', (function(_this) {
|
||||||
el.dataset.md5 = thumb.dataset.md5;
|
return function() {
|
||||||
el.style.height = style.height;
|
return ImageLoader.replaceImage(_this);
|
||||||
el.style.width = style.width;
|
};
|
||||||
el.style.maxHeight = style.maxHeight;
|
})(this));
|
||||||
el.style.maxWidth = style.maxWidth;
|
} else {
|
||||||
el.loop = true;
|
$.one(el, 'loadeddata', (function(_this) {
|
||||||
el.className = thumb.className;
|
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,
|
queueDownload: (function() {
|
||||||
queue: [],
|
var busy, items, load;
|
||||||
loadend: function() {
|
busy = false;
|
||||||
$.off(this, 'load loadeddata error', ImageLoader.loadend);
|
items = [];
|
||||||
ImageLoader.busy = false;
|
load = function(el, url) {
|
||||||
return ImageLoader.next();
|
$.one(el, 'load loadedmetadata error', function() {
|
||||||
},
|
var el2, item, url2;
|
||||||
next: function() {
|
busy = false;
|
||||||
var el, item, url;
|
if (item = items.shift()) {
|
||||||
if (ImageLoader.busy) {
|
el2 = item[0], url2 = item[1];
|
||||||
return;
|
return load(el2, url2);
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
el.src = url;
|
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) {
|
replaceVideo: function(post, video) {
|
||||||
var clone, file, isVideo, thumb, _i, _len, _ref;
|
var clone, file, style, thumb, video2, _i, _len, _ref;
|
||||||
file = post.file;
|
file = post.file;
|
||||||
isVideo = file.isVideo, thumb = file.thumb;
|
thumb = file.thumb;
|
||||||
|
style = thumb.style;
|
||||||
if (!post.isClone) {
|
if (!post.isClone) {
|
||||||
_ref = post.clones;
|
_ref = post.clones;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
clone = _ref[_i];
|
clone = _ref[_i];
|
||||||
if (!isVideo || !$.hasClass(clone.nodes.root.parentNode, 'dialog')) {
|
video2 = $.el('video');
|
||||||
ImageLoader.replace(clone, el.cloneNode(true));
|
$.one(video2, 'loadeddata', (function(_this) {
|
||||||
}
|
return function() {
|
||||||
|
return ImageLoader.replaceVideo(clone, video2);
|
||||||
|
};
|
||||||
|
})(this));
|
||||||
|
video2.src = video.src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
if (typeof chrome !== "undefined" && chrome !== null) {
|
||||||
if (Conf['Image Hover']) {
|
video.poster = thumb.src;
|
||||||
$.on(el, 'mouseover', ImageHover.mouseover);
|
}
|
||||||
}
|
video.loop = true;
|
||||||
$.replace(thumb, el);
|
video.textContent = thumb.alt;
|
||||||
file.videoThumb = true;
|
video.dataset.md5 = thumb.dataset.md5;
|
||||||
file.thumb = el;
|
video.style.height = style.height;
|
||||||
if (!post.isFetchedQuote) {
|
video.style.width = style.width;
|
||||||
return ImageLoader.play(el);
|
video.style.maxHeight = style.maxHeight;
|
||||||
}
|
video.style.maxWidth = style.maxWidth;
|
||||||
} else {
|
video.className = thumb.className;
|
||||||
return thumb.src = file.URL;
|
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) {
|
play: function(video) {
|
||||||
@ -8761,7 +8795,7 @@
|
|||||||
return $.asap((function() {
|
return $.asap((function() {
|
||||||
return doc.contains(video);
|
return doc.contains(video);
|
||||||
}), function() {
|
}), function() {
|
||||||
if (!d.hidden && Header.isNodeVisible(video)) {
|
if (Header.isNodeVisible(video)) {
|
||||||
return video.play();
|
return video.play();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -9301,7 +9335,7 @@
|
|||||||
case 'video/webm':
|
case 'video/webm':
|
||||||
case 'video/ogv':
|
case 'video/ogv':
|
||||||
$.extend(el, {
|
$.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'];
|
_ref1 = ['mp4', 'webm'];
|
||||||
_results = [];
|
_results = [];
|
||||||
@ -12888,7 +12922,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.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($('.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.2.2' />
|
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.9.2.3' />
|
||||||
</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.2.2' />
|
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.9.2.3' />
|
||||||
</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.2.2",
|
"version": "1.9.2.3",
|
||||||
"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/",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user