play clone if original is playing
This commit is contained in:
parent
fe1b68a635
commit
bf09a5d008
@ -7596,7 +7596,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var thumb, _ref, _ref1;
|
var clone, thumb, _ref, _ref1;
|
||||||
if (!(((_ref = this.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.file) != null ? _ref1.isVideo : void 0))) {
|
if (!(((_ref = this.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.file) != null ? _ref1.isVideo : void 0))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7606,7 +7606,13 @@
|
|||||||
ImageExpand.contract(this);
|
ImageExpand.contract(this);
|
||||||
return ImageExpand.expand(this);
|
return ImageExpand.expand(this);
|
||||||
} else if (this.isClone && this.file.isExpanded && this.file.isVideo) {
|
} else if (this.isClone && this.file.isExpanded && this.file.isVideo) {
|
||||||
return ImageExpand.setupVideoControls(this);
|
clone = this;
|
||||||
|
ImageExpand.setupVideoControls(clone);
|
||||||
|
if (!clone.origin.file.fullImage.paused) {
|
||||||
|
return $.queueTask(function() {
|
||||||
|
return ImageExpand.startVideo(clone);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler)) {
|
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler)) {
|
||||||
return ImageExpand.expand(this);
|
return ImageExpand.expand(this);
|
||||||
}
|
}
|
||||||
@ -7772,7 +7778,12 @@
|
|||||||
$.rmClass(post.file.thumb, 'expanding');
|
$.rmClass(post.file.thumb, 'expanding');
|
||||||
post.file.isExpanded = true;
|
post.file.isExpanded = true;
|
||||||
if (post.file.isVideo) {
|
if (post.file.isVideo) {
|
||||||
return ImageExpand.setupVideo(post);
|
ImageExpand.setupVideoControls(post);
|
||||||
|
post.file.fullImage.muted = !Conf['Allow Sound'];
|
||||||
|
post.file.fullImage.controls = Conf['Show Controls'];
|
||||||
|
if (Conf['Autoplay']) {
|
||||||
|
return ImageExpand.startVideo(post);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
videoCB: {
|
videoCB: {
|
||||||
@ -7829,25 +7840,21 @@
|
|||||||
}
|
}
|
||||||
return $.add(file.text, file.videoControls);
|
return $.add(file.text, file.videoControls);
|
||||||
},
|
},
|
||||||
setupVideo: function(post) {
|
startVideo: function(post) {
|
||||||
var file, video;
|
var controls, file, video;
|
||||||
ImageExpand.setupVideoControls(post);
|
|
||||||
file = post.file;
|
file = post.file;
|
||||||
video = file.fullImage;
|
video = file.fullImage;
|
||||||
video.muted = !Conf['Allow Sound'];
|
controls = video.controls;
|
||||||
video.controls = Conf['Show Controls'];
|
video.controls = false;
|
||||||
if (Conf['Autoplay']) {
|
video.play();
|
||||||
video.controls = false;
|
if (controls) {
|
||||||
video.play();
|
return $.asap((function() {
|
||||||
if (Conf['Show Controls']) {
|
return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded;
|
||||||
return $.asap((function() {
|
}), function() {
|
||||||
return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded;
|
if (file.isExpanded) {
|
||||||
}), function() {
|
return video.controls = true;
|
||||||
if (file.isExpanded) {
|
}
|
||||||
return video.controls = true;
|
}, 500);
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
|
|||||||
@ -7615,7 +7615,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var thumb, _ref, _ref1;
|
var clone, thumb, _ref, _ref1;
|
||||||
if (!(((_ref = this.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.file) != null ? _ref1.isVideo : void 0))) {
|
if (!(((_ref = this.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.file) != null ? _ref1.isVideo : void 0))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7625,7 +7625,13 @@
|
|||||||
ImageExpand.contract(this);
|
ImageExpand.contract(this);
|
||||||
return ImageExpand.expand(this);
|
return ImageExpand.expand(this);
|
||||||
} else if (this.isClone && this.file.isExpanded && this.file.isVideo) {
|
} else if (this.isClone && this.file.isExpanded && this.file.isVideo) {
|
||||||
return ImageExpand.setupVideoControls(this);
|
clone = this;
|
||||||
|
ImageExpand.setupVideoControls(clone);
|
||||||
|
if (!clone.origin.file.fullImage.paused) {
|
||||||
|
return $.queueTask(function() {
|
||||||
|
return ImageExpand.startVideo(clone);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler)) {
|
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler)) {
|
||||||
return ImageExpand.expand(this);
|
return ImageExpand.expand(this);
|
||||||
}
|
}
|
||||||
@ -7791,7 +7797,12 @@
|
|||||||
$.rmClass(post.file.thumb, 'expanding');
|
$.rmClass(post.file.thumb, 'expanding');
|
||||||
post.file.isExpanded = true;
|
post.file.isExpanded = true;
|
||||||
if (post.file.isVideo) {
|
if (post.file.isVideo) {
|
||||||
return ImageExpand.setupVideo(post);
|
ImageExpand.setupVideoControls(post);
|
||||||
|
post.file.fullImage.muted = !Conf['Allow Sound'];
|
||||||
|
post.file.fullImage.controls = Conf['Show Controls'];
|
||||||
|
if (Conf['Autoplay']) {
|
||||||
|
return ImageExpand.startVideo(post);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
videoCB: {
|
videoCB: {
|
||||||
@ -7848,25 +7859,21 @@
|
|||||||
}
|
}
|
||||||
return $.add(file.text, file.videoControls);
|
return $.add(file.text, file.videoControls);
|
||||||
},
|
},
|
||||||
setupVideo: function(post) {
|
startVideo: function(post) {
|
||||||
var file, video;
|
var controls, file, video;
|
||||||
ImageExpand.setupVideoControls(post);
|
|
||||||
file = post.file;
|
file = post.file;
|
||||||
video = file.fullImage;
|
video = file.fullImage;
|
||||||
video.muted = !Conf['Allow Sound'];
|
controls = video.controls;
|
||||||
video.controls = Conf['Show Controls'];
|
video.controls = false;
|
||||||
if (Conf['Autoplay']) {
|
video.play();
|
||||||
video.controls = false;
|
if (controls) {
|
||||||
video.play();
|
return $.asap((function() {
|
||||||
if (Conf['Show Controls']) {
|
return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded;
|
||||||
return $.asap((function() {
|
}), function() {
|
||||||
return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded;
|
if (file.isExpanded) {
|
||||||
}), function() {
|
return video.controls = true;
|
||||||
if (file.isExpanded) {
|
}
|
||||||
return video.controls = true;
|
}, 500);
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
|
|||||||
@ -23,7 +23,10 @@ ImageExpand =
|
|||||||
ImageExpand.contract @
|
ImageExpand.contract @
|
||||||
ImageExpand.expand @
|
ImageExpand.expand @
|
||||||
else if @isClone and @file.isExpanded and @file.isVideo
|
else if @isClone and @file.isExpanded and @file.isVideo
|
||||||
ImageExpand.setupVideoControls @
|
clone = @
|
||||||
|
ImageExpand.setupVideoControls clone
|
||||||
|
unless clone.origin.file.fullImage.paused
|
||||||
|
$.queueTask -> ImageExpand.startVideo clone
|
||||||
else if ImageExpand.on and !@isHidden and (Conf['Expand spoilers'] or !@file.isSpoiler)
|
else if ImageExpand.on and !@isHidden and (Conf['Expand spoilers'] or !@file.isSpoiler)
|
||||||
ImageExpand.expand @
|
ImageExpand.expand @
|
||||||
cb:
|
cb:
|
||||||
@ -143,7 +146,11 @@ ImageExpand =
|
|||||||
$.addClass post.nodes.root, 'expanded-image'
|
$.addClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
post.file.isExpanded = true
|
post.file.isExpanded = true
|
||||||
ImageExpand.setupVideo post if post.file.isVideo
|
if post.file.isVideo
|
||||||
|
ImageExpand.setupVideoControls post
|
||||||
|
post.file.fullImage.muted = !Conf['Allow Sound']
|
||||||
|
post.file.fullImage.controls = Conf['Show Controls']
|
||||||
|
ImageExpand.startVideo post if Conf['Autoplay']
|
||||||
|
|
||||||
videoCB:
|
videoCB:
|
||||||
click: (e) ->
|
click: (e) ->
|
||||||
@ -183,20 +190,17 @@ ImageExpand =
|
|||||||
$.add file.videoControls, [$.tn('\u00A0'), contract]
|
$.add file.videoControls, [$.tn('\u00A0'), contract]
|
||||||
$.add file.text, file.videoControls
|
$.add file.text, file.videoControls
|
||||||
|
|
||||||
setupVideo: (post) ->
|
startVideo: (post) ->
|
||||||
ImageExpand.setupVideoControls post
|
|
||||||
{file} = post
|
{file} = post
|
||||||
video = file.fullImage
|
video = file.fullImage
|
||||||
video.muted = !Conf['Allow Sound']
|
{controls} = video
|
||||||
video.controls = Conf['Show Controls']
|
video.controls = false
|
||||||
if Conf['Autoplay']
|
video.play()
|
||||||
video.controls = false
|
# Hacky workaround for Firefox forever-loading bug for very short videos
|
||||||
video.play()
|
if controls
|
||||||
# Hacky workaround for Firefox forever-loading bug for very short videos
|
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !file.isExpanded), ->
|
||||||
if Conf['Show Controls']
|
video.controls = true if file.isExpanded
|
||||||
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !file.isExpanded), ->
|
, 500
|
||||||
video.controls = true if file.isExpanded
|
|
||||||
, 500
|
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
post = Get.postFromNode @
|
post = Get.postFromNode @
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user