app/js/gallery.js in servel-0.26.0 vs app/js/gallery.js in servel-0.27.0
- old
+ new
@@ -18,13 +18,13 @@
http.send();
}
function clearContent() {
$gallery.classList.remove("image", "video", "audio", "text");
- $("#image").src = "about:none";
- $("#video").src = "about:none";
- $("#audio").src = "about:none";
+ $("#image").removeAttribute('src');
+ $("#video").removeAttribute('src');
+ $("#audio").removeAttribute('src');
$("#text-content").innerHTML = "";
}
function render() {
clearContent();
@@ -95,10 +95,16 @@
function switchLayoutMode() {
layoutModeIndex++;
if(layoutModeIndex >= LAYOUT_MODES.length) layoutModeIndex = 0;
}
+ function playPauseVideo() {
+ var $video = $("#video");
+ if ($video.paused || $video.ended) $video.play();
+ else $video.pause();
+ }
+
function initEvents() {
document.body.addEventListener("click", function(e) {
if(!e.target) return;
if(e.target.matches("#page-back")) {
@@ -116,16 +122,20 @@
else if(e.target.matches("#page-next-10")) {
e.stopPropagation();
fastForward();
}
else if(e.target.matches("#page-jump-listing")) {
- e.preventDefault();
+ e.stopPropagation();
Index.jumpListing();
}
else if(e.target.closest("#layout-mode")) {
e.stopPropagation();
switchLayoutMode();
layout();
+ }
+ else if(e.target.matches("#video")) {
+ e.stopPropagation();
+ playPauseVideo();
}
});
window.addEventListener("keydown", function(e) {
if(e.target == $("#search")) return;
\ No newline at end of file