nitpicking
This commit is contained in:
parent
bc9ce0a434
commit
7658f575f3
@ -7952,16 +7952,18 @@
|
||||
}
|
||||
thumb = this.file.thumb;
|
||||
$.on(thumb.parentNode, 'click', ImageExpand.cb.toggle);
|
||||
if (this.isClone && $.hasClass(thumb, 'expanding')) {
|
||||
ImageExpand.contract(this);
|
||||
return ImageExpand.expand(this);
|
||||
} else if (this.isClone && this.file.isExpanded && this.file.isVideo) {
|
||||
clone = this;
|
||||
ImageExpand.setupVideoControls(clone);
|
||||
if (!clone.origin.file.fullImage.paused) {
|
||||
return $.queueTask(function() {
|
||||
return ImageExpand.startVideo(clone);
|
||||
});
|
||||
if (this.isClone) {
|
||||
if ($.hasClass(thumb, 'expanding')) {
|
||||
ImageExpand.contract(this);
|
||||
ImageExpand.expand(this);
|
||||
} else if (this.file.isExpanded && this.file.isVideo) {
|
||||
clone = this;
|
||||
ImageExpand.setupVideoControls(clone);
|
||||
if (!clone.origin.file.fullImage.paused) {
|
||||
$.queueTask(function() {
|
||||
return ImageExpand.startVideo(clone);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
return ImageExpand.expand(this, null, true);
|
||||
@ -8104,9 +8106,8 @@
|
||||
});
|
||||
},
|
||||
completeExpand: function(post, disableAutoplay) {
|
||||
var bottom, thumb;
|
||||
thumb = post.file.thumb;
|
||||
if (!$.hasClass(thumb, 'expanding')) {
|
||||
var bottom;
|
||||
if (!$.hasClass(post.file.thumb, 'expanding')) {
|
||||
return;
|
||||
}
|
||||
if (!post.nodes.root.parentNode) {
|
||||
@ -8123,8 +8124,6 @@
|
||||
});
|
||||
},
|
||||
completeExpand2: function(post, disableAutoplay) {
|
||||
var thumb;
|
||||
thumb = post.file.thumb;
|
||||
$.addClass(post.nodes.root, 'expanded-image');
|
||||
$.rmClass(post.file.thumb, 'expanding');
|
||||
post.file.isExpanded = true;
|
||||
@ -8137,32 +8136,36 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
videoCB: {
|
||||
click: function(e) {
|
||||
if (this.paused && !this.controls) {
|
||||
this.play();
|
||||
return e.stopPropagation();
|
||||
videoCB: (function() {
|
||||
var mousedown;
|
||||
mousedown = false;
|
||||
return {
|
||||
mouseover: function() {
|
||||
return mousedown = false;
|
||||
},
|
||||
mousedown: function(e) {
|
||||
if (e.button === 0) {
|
||||
return mousedown = true;
|
||||
}
|
||||
},
|
||||
mouseup: function(e) {
|
||||
if (e.button === 0) {
|
||||
return mousedown = false;
|
||||
}
|
||||
},
|
||||
mouseout: function(e) {
|
||||
if (mousedown && e.clientX <= this.getBoundingClientRect().left) {
|
||||
return ImageExpand.contract(Get.postFromNode(this));
|
||||
}
|
||||
},
|
||||
click: function(e) {
|
||||
if (this.paused && !this.controls) {
|
||||
e.stopPropagation();
|
||||
return this.play();
|
||||
}
|
||||
}
|
||||
},
|
||||
mousedown: function(e) {
|
||||
if (e.button === 0) {
|
||||
return this.dataset.mousedown = 'true';
|
||||
}
|
||||
},
|
||||
mouseup: function(e) {
|
||||
if (e.button === 0) {
|
||||
return this.dataset.mousedown = 'false';
|
||||
}
|
||||
},
|
||||
mouseover: function(e) {
|
||||
return this.dataset.mousedown = 'false';
|
||||
},
|
||||
mouseout: function(e) {
|
||||
if (this.dataset.mousedown === 'true' && e.clientX <= this.getBoundingClientRect().left) {
|
||||
return ImageExpand.contract(Get.postFromNode(this));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
})(),
|
||||
setupVideoControls: function(post) {
|
||||
var cb, contract, eventName, file, video, _ref;
|
||||
file = post.file;
|
||||
|
||||
@ -7991,16 +7991,18 @@
|
||||
}
|
||||
thumb = this.file.thumb;
|
||||
$.on(thumb.parentNode, 'click', ImageExpand.cb.toggle);
|
||||
if (this.isClone && $.hasClass(thumb, 'expanding')) {
|
||||
ImageExpand.contract(this);
|
||||
return ImageExpand.expand(this);
|
||||
} else if (this.isClone && this.file.isExpanded && this.file.isVideo) {
|
||||
clone = this;
|
||||
ImageExpand.setupVideoControls(clone);
|
||||
if (!clone.origin.file.fullImage.paused) {
|
||||
return $.queueTask(function() {
|
||||
return ImageExpand.startVideo(clone);
|
||||
});
|
||||
if (this.isClone) {
|
||||
if ($.hasClass(thumb, 'expanding')) {
|
||||
ImageExpand.contract(this);
|
||||
ImageExpand.expand(this);
|
||||
} else if (this.file.isExpanded && this.file.isVideo) {
|
||||
clone = this;
|
||||
ImageExpand.setupVideoControls(clone);
|
||||
if (!clone.origin.file.fullImage.paused) {
|
||||
$.queueTask(function() {
|
||||
return ImageExpand.startVideo(clone);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
|
||||
return ImageExpand.expand(this, null, true);
|
||||
@ -8143,9 +8145,8 @@
|
||||
});
|
||||
},
|
||||
completeExpand: function(post, disableAutoplay) {
|
||||
var bottom, thumb;
|
||||
thumb = post.file.thumb;
|
||||
if (!$.hasClass(thumb, 'expanding')) {
|
||||
var bottom;
|
||||
if (!$.hasClass(post.file.thumb, 'expanding')) {
|
||||
return;
|
||||
}
|
||||
if (!post.nodes.root.parentNode) {
|
||||
@ -8162,8 +8163,6 @@
|
||||
});
|
||||
},
|
||||
completeExpand2: function(post, disableAutoplay) {
|
||||
var thumb;
|
||||
thumb = post.file.thumb;
|
||||
$.addClass(post.nodes.root, 'expanded-image');
|
||||
$.rmClass(post.file.thumb, 'expanding');
|
||||
post.file.isExpanded = true;
|
||||
@ -8176,32 +8175,36 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
videoCB: {
|
||||
click: function(e) {
|
||||
if (this.paused && !this.controls) {
|
||||
this.play();
|
||||
return e.stopPropagation();
|
||||
videoCB: (function() {
|
||||
var mousedown;
|
||||
mousedown = false;
|
||||
return {
|
||||
mouseover: function() {
|
||||
return mousedown = false;
|
||||
},
|
||||
mousedown: function(e) {
|
||||
if (e.button === 0) {
|
||||
return mousedown = true;
|
||||
}
|
||||
},
|
||||
mouseup: function(e) {
|
||||
if (e.button === 0) {
|
||||
return mousedown = false;
|
||||
}
|
||||
},
|
||||
mouseout: function(e) {
|
||||
if (mousedown && e.clientX <= this.getBoundingClientRect().left) {
|
||||
return ImageExpand.contract(Get.postFromNode(this));
|
||||
}
|
||||
},
|
||||
click: function(e) {
|
||||
if (this.paused && !this.controls) {
|
||||
e.stopPropagation();
|
||||
return this.play();
|
||||
}
|
||||
}
|
||||
},
|
||||
mousedown: function(e) {
|
||||
if (e.button === 0) {
|
||||
return this.dataset.mousedown = 'true';
|
||||
}
|
||||
},
|
||||
mouseup: function(e) {
|
||||
if (e.button === 0) {
|
||||
return this.dataset.mousedown = 'false';
|
||||
}
|
||||
},
|
||||
mouseover: function(e) {
|
||||
return this.dataset.mousedown = 'false';
|
||||
},
|
||||
mouseout: function(e) {
|
||||
if (this.dataset.mousedown === 'true' && e.clientX <= this.getBoundingClientRect().left) {
|
||||
return ImageExpand.contract(Get.postFromNode(this));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
})(),
|
||||
setupVideoControls: function(post) {
|
||||
var cb, contract, eventName, file, video, _ref;
|
||||
file = post.file;
|
||||
|
||||
@ -17,16 +17,20 @@ ImageExpand =
|
||||
return unless @file?.isImage or @file?.isVideo
|
||||
{thumb} = @file
|
||||
$.on thumb.parentNode, 'click', ImageExpand.cb.toggle
|
||||
if @isClone and $.hasClass thumb, 'expanding'
|
||||
# If we clone a post where the image is still loading,
|
||||
# make it loading in the clone too.
|
||||
ImageExpand.contract @
|
||||
ImageExpand.expand @
|
||||
else if @isClone and @file.isExpanded and @file.isVideo
|
||||
clone = @
|
||||
ImageExpand.setupVideoControls clone
|
||||
unless clone.origin.file.fullImage.paused
|
||||
$.queueTask -> ImageExpand.startVideo clone
|
||||
if @isClone
|
||||
if $.hasClass thumb, 'expanding'
|
||||
# If we clone a post where the image is still loading,
|
||||
# make it loading in the clone too.
|
||||
ImageExpand.contract @
|
||||
ImageExpand.expand @
|
||||
|
||||
else if @file.isExpanded and @file.isVideo
|
||||
clone = @
|
||||
ImageExpand.setupVideoControls clone
|
||||
unless clone.origin.file.fullImage.paused
|
||||
$.queueTask -> ImageExpand.startVideo clone
|
||||
|
||||
return
|
||||
else if ImageExpand.on and !@isHidden and
|
||||
(Conf['Expand spoilers'] or !@file.isSpoiler) and
|
||||
(Conf['Expand videos'] or !@file.isVideo)
|
||||
@ -130,8 +134,7 @@ ImageExpand =
|
||||
ImageExpand.completeExpand post, disableAutoplay
|
||||
|
||||
completeExpand: (post, disableAutoplay) ->
|
||||
{thumb} = post.file
|
||||
return unless $.hasClass thumb, 'expanding' # contracted before the image loaded
|
||||
return unless $.hasClass post.file.thumb, 'expanding' # contracted before the image loaded
|
||||
unless post.nodes.root.parentNode
|
||||
# Image might start/finish loading before the post is inserted.
|
||||
# Don't scroll when it's expanded in a QP for example.
|
||||
@ -144,29 +147,26 @@ ImageExpand =
|
||||
window.scrollBy 0, post.nodes.root.getBoundingClientRect().bottom - bottom
|
||||
|
||||
completeExpand2: (post, disableAutoplay) ->
|
||||
{thumb} = post.file
|
||||
$.addClass post.nodes.root, 'expanded-image'
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
post.file.isExpanded = true
|
||||
if post.file.isVideo
|
||||
ImageExpand.setupVideoControls post
|
||||
post.file.fullImage.muted = !Conf['Allow Sound']
|
||||
post.file.fullImage.muted = !Conf['Allow Sound']
|
||||
post.file.fullImage.controls = Conf['Show Controls']
|
||||
ImageExpand.startVideo post if Conf['Autoplay'] and not disableAutoplay
|
||||
|
||||
videoCB:
|
||||
click: (e) ->
|
||||
if @paused and not @controls
|
||||
@play()
|
||||
e.stopPropagation()
|
||||
|
||||
videoCB: do ->
|
||||
# dragging to the left contracts the video
|
||||
mousedown: (e) -> @dataset.mousedown = 'true' if e.button is 0
|
||||
mouseup: (e) -> @dataset.mousedown = 'false' if e.button is 0
|
||||
mouseover: (e) -> @dataset.mousedown = 'false'
|
||||
mouseout: (e) ->
|
||||
if @dataset.mousedown is 'true' and e.clientX <= @getBoundingClientRect().left
|
||||
ImageExpand.contract (Get.postFromNode @)
|
||||
mousedown = false
|
||||
mouseover: -> mousedown = false
|
||||
mousedown: (e) -> mousedown = true if e.button is 0
|
||||
mouseup: (e) -> mousedown = false if e.button is 0
|
||||
mouseout: (e) -> ImageExpand.contract (Get.postFromNode @) if mousedown and e.clientX <= @getBoundingClientRect().left
|
||||
click: (e) ->
|
||||
if @paused and not @controls
|
||||
e.stopPropagation()
|
||||
@play()
|
||||
|
||||
setupVideoControls: (post) ->
|
||||
{file} = post
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user