disable autoplay when expanding all images
This commit is contained in:
parent
bf09a5d008
commit
f64fa9e08a
@ -7647,7 +7647,9 @@
|
||||
if (ImageExpand.on = $.hasClass(ImageExpand.EAI, 'expand-all-shortcut')) {
|
||||
ImageExpand.EAI.className = 'contract-all-shortcut fa fa-compress';
|
||||
ImageExpand.EAI.title = 'Contract All Images';
|
||||
func = ImageExpand.expand;
|
||||
func = function(post) {
|
||||
return ImageExpand.expand(post, null, true);
|
||||
};
|
||||
} else {
|
||||
ImageExpand.EAI.className = 'expand-all-shortcut fa fa-expand';
|
||||
ImageExpand.EAI.title = 'Expand All Images';
|
||||
@ -7720,7 +7722,7 @@
|
||||
$.rmClass(post.file.thumb, 'expanding');
|
||||
return post.file.isExpanded = false;
|
||||
},
|
||||
expand: function(post, src) {
|
||||
expand: function(post, src, disableAutoplay) {
|
||||
var el, isVideo, thumb, _ref;
|
||||
_ref = post.file, thumb = _ref.thumb, isVideo = _ref.isVideo;
|
||||
if (post.isHidden || post.file.isExpanded || $.hasClass(thumb, 'expanding')) {
|
||||
@ -7749,10 +7751,10 @@
|
||||
return el.naturalHeight;
|
||||
}
|
||||
}), function() {
|
||||
return ImageExpand.completeExpand(post);
|
||||
return ImageExpand.completeExpand(post, disableAutoplay);
|
||||
});
|
||||
},
|
||||
completeExpand: function(post) {
|
||||
completeExpand: function(post, disableAutoplay) {
|
||||
var bottom, thumb;
|
||||
thumb = post.file.thumb;
|
||||
if (!$.hasClass(thumb, 'expanding')) {
|
||||
@ -7764,14 +7766,14 @@
|
||||
}
|
||||
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
||||
return $.queueTask(function() {
|
||||
ImageExpand.completeExpand2(post);
|
||||
ImageExpand.completeExpand2(post, disableAutoplay);
|
||||
if (!(bottom <= 0)) {
|
||||
return;
|
||||
}
|
||||
return window.scrollBy(0, post.nodes.root.getBoundingClientRect().bottom - bottom);
|
||||
});
|
||||
},
|
||||
completeExpand2: function(post) {
|
||||
completeExpand2: function(post, disableAutoplay) {
|
||||
var thumb;
|
||||
thumb = post.file.thumb;
|
||||
$.addClass(post.nodes.root, 'expanded-image');
|
||||
@ -7781,7 +7783,7 @@
|
||||
ImageExpand.setupVideoControls(post);
|
||||
post.file.fullImage.muted = !Conf['Allow Sound'];
|
||||
post.file.fullImage.controls = Conf['Show Controls'];
|
||||
if (Conf['Autoplay']) {
|
||||
if (Conf['Autoplay'] && !disableAutoplay) {
|
||||
return ImageExpand.startVideo(post);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7666,7 +7666,9 @@
|
||||
if (ImageExpand.on = $.hasClass(ImageExpand.EAI, 'expand-all-shortcut')) {
|
||||
ImageExpand.EAI.className = 'contract-all-shortcut fa fa-compress';
|
||||
ImageExpand.EAI.title = 'Contract All Images';
|
||||
func = ImageExpand.expand;
|
||||
func = function(post) {
|
||||
return ImageExpand.expand(post, null, true);
|
||||
};
|
||||
} else {
|
||||
ImageExpand.EAI.className = 'expand-all-shortcut fa fa-expand';
|
||||
ImageExpand.EAI.title = 'Expand All Images';
|
||||
@ -7739,7 +7741,7 @@
|
||||
$.rmClass(post.file.thumb, 'expanding');
|
||||
return post.file.isExpanded = false;
|
||||
},
|
||||
expand: function(post, src) {
|
||||
expand: function(post, src, disableAutoplay) {
|
||||
var el, isVideo, thumb, _ref;
|
||||
_ref = post.file, thumb = _ref.thumb, isVideo = _ref.isVideo;
|
||||
if (post.isHidden || post.file.isExpanded || $.hasClass(thumb, 'expanding')) {
|
||||
@ -7768,10 +7770,10 @@
|
||||
return el.naturalHeight;
|
||||
}
|
||||
}), function() {
|
||||
return ImageExpand.completeExpand(post);
|
||||
return ImageExpand.completeExpand(post, disableAutoplay);
|
||||
});
|
||||
},
|
||||
completeExpand: function(post) {
|
||||
completeExpand: function(post, disableAutoplay) {
|
||||
var bottom, thumb;
|
||||
thumb = post.file.thumb;
|
||||
if (!$.hasClass(thumb, 'expanding')) {
|
||||
@ -7783,14 +7785,14 @@
|
||||
}
|
||||
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
||||
return $.queueTask(function() {
|
||||
ImageExpand.completeExpand2(post);
|
||||
ImageExpand.completeExpand2(post, disableAutoplay);
|
||||
if (!(bottom <= 0)) {
|
||||
return;
|
||||
}
|
||||
return window.scrollBy(0, post.nodes.root.getBoundingClientRect().bottom - bottom);
|
||||
});
|
||||
},
|
||||
completeExpand2: function(post) {
|
||||
completeExpand2: function(post, disableAutoplay) {
|
||||
var thumb;
|
||||
thumb = post.file.thumb;
|
||||
$.addClass(post.nodes.root, 'expanded-image');
|
||||
@ -7800,7 +7802,7 @@
|
||||
ImageExpand.setupVideoControls(post);
|
||||
post.file.fullImage.muted = !Conf['Allow Sound'];
|
||||
post.file.fullImage.controls = Conf['Show Controls'];
|
||||
if (Conf['Autoplay']) {
|
||||
if (Conf['Autoplay'] && !disableAutoplay) {
|
||||
return ImageExpand.startVideo(post);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ ImageExpand =
|
||||
if ImageExpand.on = $.hasClass ImageExpand.EAI, 'expand-all-shortcut'
|
||||
ImageExpand.EAI.className = 'contract-all-shortcut fa fa-compress'
|
||||
ImageExpand.EAI.title = 'Contract All Images'
|
||||
func = ImageExpand.expand
|
||||
func = (post) -> ImageExpand.expand post, null, true
|
||||
else
|
||||
ImageExpand.EAI.className = 'expand-all-shortcut fa fa-expand'
|
||||
ImageExpand.EAI.title = 'Expand All Images'
|
||||
@ -109,7 +109,7 @@ ImageExpand =
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
post.file.isExpanded = false
|
||||
|
||||
expand: (post, src) ->
|
||||
expand: (post, src, disableAutoplay) ->
|
||||
# Do not expand images of hidden/filtered replies, or already expanded pictures.
|
||||
{thumb, isVideo} = post.file
|
||||
return if post.isHidden or post.file.isExpanded or $.hasClass thumb, 'expanding'
|
||||
@ -125,9 +125,9 @@ ImageExpand =
|
||||
el.src = src or post.file.URL
|
||||
$.after thumb, el unless el is thumb.nextSibling
|
||||
$.asap (-> if isVideo then el.videoHeight else el.naturalHeight), ->
|
||||
ImageExpand.completeExpand post
|
||||
ImageExpand.completeExpand post, disableAutoplay
|
||||
|
||||
completeExpand: (post) ->
|
||||
completeExpand: (post, disableAutoplay) ->
|
||||
{thumb} = post.file
|
||||
return unless $.hasClass thumb, 'expanding' # contracted before the image loaded
|
||||
unless post.nodes.root.parentNode
|
||||
@ -137,11 +137,11 @@ ImageExpand =
|
||||
return
|
||||
{bottom} = post.nodes.root.getBoundingClientRect()
|
||||
$.queueTask ->
|
||||
ImageExpand.completeExpand2 post
|
||||
ImageExpand.completeExpand2 post, disableAutoplay
|
||||
return unless bottom <= 0
|
||||
window.scrollBy 0, post.nodes.root.getBoundingClientRect().bottom - bottom
|
||||
|
||||
completeExpand2: (post) ->
|
||||
completeExpand2: (post, disableAutoplay) ->
|
||||
{thumb} = post.file
|
||||
$.addClass post.nodes.root, 'expanded-image'
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
@ -150,7 +150,7 @@ ImageExpand =
|
||||
ImageExpand.setupVideoControls post
|
||||
post.file.fullImage.muted = !Conf['Allow Sound']
|
||||
post.file.fullImage.controls = Conf['Show Controls']
|
||||
ImageExpand.startVideo post if Conf['Autoplay']
|
||||
ImageExpand.startVideo post if Conf['Autoplay'] and not disableAutoplay
|
||||
|
||||
videoCB:
|
||||
click: (e) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user