drag to right to collapse video
This commit is contained in:
parent
7ddaa54be5
commit
6b0b1fe144
@ -6,6 +6,7 @@ function setupVideo(thumb, url) {
|
|||||||
var loop = true;
|
var loop = true;
|
||||||
var loopControls = [document.createElement("span"), document.createElement("span")];
|
var loopControls = [document.createElement("span"), document.createElement("span")];
|
||||||
var fileInfo = thumb.parentNode.querySelector(".fileinfo");
|
var fileInfo = thumb.parentNode.querySelector(".fileinfo");
|
||||||
|
var mouseDown = false;
|
||||||
|
|
||||||
function unexpand() {
|
function unexpand() {
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
@ -54,6 +55,23 @@ function setupVideo(thumb, url) {
|
|||||||
videoContainer.addEventListener("click", function(e) {
|
videoContainer.addEventListener("click", function(e) {
|
||||||
if (e.target != video) unexpand();
|
if (e.target != video) unexpand();
|
||||||
} , false);
|
} , false);
|
||||||
|
|
||||||
|
// Dragging to the left collapses the video
|
||||||
|
video.addEventListener("mousedown", function(e) {
|
||||||
|
if (e.button == 0) mouseDown = true;
|
||||||
|
}, false);
|
||||||
|
video.addEventListener("mouseup", function(e) {
|
||||||
|
if (e.button == 0) mouseDown = false;
|
||||||
|
}, false);
|
||||||
|
video.addEventListener("mouseenter", function(e) {
|
||||||
|
mouseDown = false;
|
||||||
|
}, false);
|
||||||
|
video.addEventListener("mouseout", function(e) {
|
||||||
|
if (mouseDown && e.clientX - video.getBoundingClientRect().left <= 0) {
|
||||||
|
unexpand();
|
||||||
|
}
|
||||||
|
mouseDown = false;
|
||||||
|
}, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user