work around FF forever-loading bug, other tweaks
Conflicts: CHANGELOG.md builds/4chan-X.user.js builds/crx/script.js
This commit is contained in:
parent
49d76b4177
commit
81f1dbf0fb
@ -1,3 +1,10 @@
|
|||||||
|
**Zixaphir**
|
||||||
|
- Reload captcha if there are posts in the queue.
|
||||||
|
|
||||||
|
**ccd0**
|
||||||
|
- In v1.5.1, image/video hover was changed to hide and re-use the images/videos to avoid crashes.
|
||||||
|
Fixing bugs caused by this change.
|
||||||
|
|
||||||
### v1.5.2
|
### v1.5.2
|
||||||
*2014-04-04*
|
*2014-04-04*
|
||||||
|
|
||||||
|
|||||||
@ -7713,10 +7713,7 @@
|
|||||||
$.on(el, 'error', ImageExpand.error);
|
$.on(el, 'error', ImageExpand.error);
|
||||||
el.src = src || post.file.URL;
|
el.src = src || post.file.URL;
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
position = isVideo && Conf['Show Controls'] ? thumb.parentNode : thumb;
|
||||||
el.controls = Conf['Show Controls'];
|
|
||||||
}
|
|
||||||
position = el.controls ? thumb.parentNode : thumb;
|
|
||||||
if (el !== position.nextSibling) {
|
if (el !== position.nextSibling) {
|
||||||
$.after(position, el);
|
$.after(position, el);
|
||||||
}
|
}
|
||||||
@ -7777,7 +7774,8 @@
|
|||||||
video = file.fullImage;
|
video = file.fullImage;
|
||||||
file.videoControls = [];
|
file.videoControls = [];
|
||||||
video.muted = !Conf['Allow Sound'];
|
video.muted = !Conf['Allow Sound'];
|
||||||
if (video.controls) {
|
video.controls = Conf['Show Controls'];
|
||||||
|
if (Conf['Show Controls']) {
|
||||||
contract = $.el('a', {
|
contract = $.el('a', {
|
||||||
textContent: 'contract',
|
textContent: 'contract',
|
||||||
href: 'javascript:;',
|
href: 'javascript:;',
|
||||||
@ -7795,8 +7793,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Conf['Autoplay']) {
|
if (Conf['Autoplay']) {
|
||||||
|
video.controls = false;
|
||||||
video.play();
|
video.play();
|
||||||
} else if (!video.controls) {
|
if (Conf['Show Controls']) {
|
||||||
|
$.asap((function() {
|
||||||
|
return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded;
|
||||||
|
}), function() {
|
||||||
|
if (file.isExpanded) {
|
||||||
|
return video.controls = true;
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
} else if (!Conf['Show Controls']) {
|
||||||
play = $.el('a', {
|
play = $.el('a', {
|
||||||
textContent: 'play',
|
textContent: 'play',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
@ -7918,7 +7926,7 @@
|
|||||||
return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover);
|
return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover);
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var el, isVideo, naturalHeight, position, post, thumb;
|
var el, isVideo, position, post, thumb;
|
||||||
post = Get.postFromNode(this);
|
post = Get.postFromNode(this);
|
||||||
isVideo = post.file.isVideo;
|
isVideo = post.file.isVideo;
|
||||||
if (post.file.fullImage) {
|
if (post.file.fullImage) {
|
||||||
@ -7952,14 +7960,13 @@
|
|||||||
el.play();
|
el.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
naturalHeight = post.file.isVideo ? 'videoHeight' : 'naturalHeight';
|
|
||||||
UI.hover({
|
UI.hover({
|
||||||
root: this,
|
root: this,
|
||||||
el: el,
|
el: el,
|
||||||
latestEvent: e,
|
latestEvent: e,
|
||||||
endEvents: 'mouseout click',
|
endEvents: 'mouseout click',
|
||||||
asapTest: function() {
|
asapTest: function() {
|
||||||
return el[naturalHeight];
|
return isVideo || el.naturalHeight;
|
||||||
},
|
},
|
||||||
noRemove: true,
|
noRemove: true,
|
||||||
cb: function() {
|
cb: function() {
|
||||||
|
|||||||
@ -7732,10 +7732,7 @@
|
|||||||
$.on(el, 'error', ImageExpand.error);
|
$.on(el, 'error', ImageExpand.error);
|
||||||
el.src = src || post.file.URL;
|
el.src = src || post.file.URL;
|
||||||
}
|
}
|
||||||
if (isVideo) {
|
position = isVideo && Conf['Show Controls'] ? thumb.parentNode : thumb;
|
||||||
el.controls = Conf['Show Controls'];
|
|
||||||
}
|
|
||||||
position = el.controls ? thumb.parentNode : thumb;
|
|
||||||
if (el !== position.nextSibling) {
|
if (el !== position.nextSibling) {
|
||||||
$.after(position, el);
|
$.after(position, el);
|
||||||
}
|
}
|
||||||
@ -7796,7 +7793,8 @@
|
|||||||
video = file.fullImage;
|
video = file.fullImage;
|
||||||
file.videoControls = [];
|
file.videoControls = [];
|
||||||
video.muted = !Conf['Allow Sound'];
|
video.muted = !Conf['Allow Sound'];
|
||||||
if (video.controls) {
|
video.controls = Conf['Show Controls'];
|
||||||
|
if (Conf['Show Controls']) {
|
||||||
contract = $.el('a', {
|
contract = $.el('a', {
|
||||||
textContent: 'contract',
|
textContent: 'contract',
|
||||||
href: 'javascript:;',
|
href: 'javascript:;',
|
||||||
@ -7814,8 +7812,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Conf['Autoplay']) {
|
if (Conf['Autoplay']) {
|
||||||
|
video.controls = false;
|
||||||
video.play();
|
video.play();
|
||||||
} else if (!video.controls) {
|
if (Conf['Show Controls']) {
|
||||||
|
$.asap((function() {
|
||||||
|
return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded;
|
||||||
|
}), function() {
|
||||||
|
if (file.isExpanded) {
|
||||||
|
return video.controls = true;
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
} else if (!Conf['Show Controls']) {
|
||||||
play = $.el('a', {
|
play = $.el('a', {
|
||||||
textContent: 'play',
|
textContent: 'play',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
@ -7926,7 +7934,7 @@
|
|||||||
return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover);
|
return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover);
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var el, isVideo, naturalHeight, position, post, thumb;
|
var el, isVideo, position, post, thumb;
|
||||||
post = Get.postFromNode(this);
|
post = Get.postFromNode(this);
|
||||||
isVideo = post.file.isVideo;
|
isVideo = post.file.isVideo;
|
||||||
if (post.file.fullImage) {
|
if (post.file.fullImage) {
|
||||||
@ -7960,14 +7968,13 @@
|
|||||||
el.play();
|
el.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
naturalHeight = post.file.isVideo ? 'videoHeight' : 'naturalHeight';
|
|
||||||
UI.hover({
|
UI.hover({
|
||||||
root: this,
|
root: this,
|
||||||
el: el,
|
el: el,
|
||||||
latestEvent: e,
|
latestEvent: e,
|
||||||
endEvents: 'mouseout click',
|
endEvents: 'mouseout click',
|
||||||
asapTest: function() {
|
asapTest: function() {
|
||||||
return el[naturalHeight];
|
return isVideo || el.naturalHeight;
|
||||||
},
|
},
|
||||||
noRemove: true,
|
noRemove: true,
|
||||||
cb: function() {
|
cb: function() {
|
||||||
|
|||||||
@ -115,8 +115,7 @@ ImageExpand =
|
|||||||
el.loop = true if isVideo
|
el.loop = true if isVideo
|
||||||
$.on el, 'error', ImageExpand.error
|
$.on el, 'error', ImageExpand.error
|
||||||
el.src = src or post.file.URL
|
el.src = src or post.file.URL
|
||||||
el.controls = Conf['Show Controls'] if isVideo
|
position = if isVideo and Conf['Show Controls'] then thumb.parentNode else thumb
|
||||||
position = if el.controls then thumb.parentNode else thumb
|
|
||||||
$.after position, el unless el is position.nextSibling
|
$.after position, el unless el is position.nextSibling
|
||||||
$.asap (-> isVideo or el.naturalHeight), ->
|
$.asap (-> isVideo or el.naturalHeight), ->
|
||||||
ImageExpand.completeExpand post
|
ImageExpand.completeExpand post
|
||||||
@ -151,8 +150,9 @@ ImageExpand =
|
|||||||
{file} = post
|
{file} = post
|
||||||
video = file.fullImage
|
video = file.fullImage
|
||||||
file.videoControls = []
|
file.videoControls = []
|
||||||
video.muted = not Conf['Allow Sound']
|
video.muted = !Conf['Allow Sound']
|
||||||
if video.controls
|
video.controls = Conf['Show Controls']
|
||||||
|
if Conf['Show Controls']
|
||||||
# contract link in file info
|
# contract link in file info
|
||||||
contract = $.el 'a',
|
contract = $.el 'a',
|
||||||
textContent: 'contract'
|
textContent: 'contract'
|
||||||
@ -165,8 +165,14 @@ ImageExpand =
|
|||||||
for eventName, cb of ImageExpand.videoCB
|
for eventName, cb of ImageExpand.videoCB
|
||||||
$.on video, eventName, cb
|
$.on video, eventName, cb
|
||||||
if Conf['Autoplay']
|
if Conf['Autoplay']
|
||||||
|
video.controls = false
|
||||||
video.play()
|
video.play()
|
||||||
else unless video.controls
|
# Hacky workaround for Firefox forever-loading bug
|
||||||
|
if Conf['Show Controls']
|
||||||
|
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !file.isExpanded), ->
|
||||||
|
video.controls = true if file.isExpanded
|
||||||
|
, 500
|
||||||
|
else unless Conf['Show Controls']
|
||||||
play = $.el 'a',
|
play = $.el 'a',
|
||||||
textContent: 'play'
|
textContent: 'play'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
|
|||||||
@ -32,13 +32,12 @@ ImageHover =
|
|||||||
el.controls = false
|
el.controls = false
|
||||||
el.muted = not Conf['Allow Sound']
|
el.muted = not Conf['Allow Sound']
|
||||||
el.play() if Conf['Autoplay']
|
el.play() if Conf['Autoplay']
|
||||||
naturalHeight = if post.file.isVideo then 'videoHeight' else 'naturalHeight'
|
|
||||||
UI.hover
|
UI.hover
|
||||||
root: @
|
root: @
|
||||||
el: el
|
el: el
|
||||||
latestEvent: e
|
latestEvent: e
|
||||||
endEvents: 'mouseout click'
|
endEvents: 'mouseout click'
|
||||||
asapTest: -> el[naturalHeight]
|
asapTest: -> (isVideo or el.naturalHeight)
|
||||||
noRemove: true
|
noRemove: true
|
||||||
cb: ->
|
cb: ->
|
||||||
if isVideo
|
if isVideo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user