mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
gallery: dispose videos to stop buffering
This commit is contained in:
parent
0f5026cd20
commit
6a559bc28a
|
@ -470,13 +470,23 @@ window.baguetteBox = (function () {
|
|||
return;
|
||||
}
|
||||
|
||||
// maybe unloaded video
|
||||
while (imageContainer.firstChild)
|
||||
imageContainer.removeChild(imageContainer.firstChild);
|
||||
|
||||
var imageElement = galleryItem.imageElement,
|
||||
imageSrc = imageElement.href,
|
||||
is_vid = re_v.test(imageSrc),
|
||||
thumbnailElement = imageElement.querySelector('img, video'),
|
||||
imageCaption = typeof options.captions === 'function' ?
|
||||
options.captions.call(currentGallery, imageElement) :
|
||||
imageElement.getAttribute('data-caption') || imageElement.title;
|
||||
|
||||
imageSrc += imageSrc.indexOf('?') < 0 ? '?cache' : '&cache';
|
||||
|
||||
if (is_vid && index != currentIndex)
|
||||
return; // no preload
|
||||
|
||||
var figure = mknod('figure');
|
||||
figure.id = 'bbox-figure-' + index;
|
||||
figure.innerHTML = '<div class="bbox-spinner">' +
|
||||
|
@ -492,9 +502,7 @@ window.baguetteBox = (function () {
|
|||
}
|
||||
imageContainer.appendChild(figure);
|
||||
|
||||
var is_vid = re_v.test(imageSrc),
|
||||
image = mknod(is_vid ? 'video' : 'img');
|
||||
|
||||
var image = mknod(is_vid ? 'video' : 'img');
|
||||
clmod(imageContainer, 'vid', is_vid);
|
||||
|
||||
image.addEventListener(is_vid ? 'loadedmetadata' : 'load', function () {
|
||||
|
@ -569,7 +577,13 @@ window.baguetteBox = (function () {
|
|||
return false;
|
||||
}
|
||||
|
||||
playvid(false);
|
||||
var v = vid();
|
||||
if (v) {
|
||||
v.src = '';
|
||||
v.load();
|
||||
v.parentNode.removeChild(v);
|
||||
}
|
||||
|
||||
currentIndex = index;
|
||||
loadImage(currentIndex, function () {
|
||||
preloadNext(currentIndex);
|
||||
|
|
|
@ -1756,7 +1756,7 @@ document.onkeydown = function (e) {
|
|||
if (e.ctrlKey || e.altKey || e.metaKey || e.isComposing)
|
||||
return;
|
||||
|
||||
if (QS('#baguetteBox-overlay.visible'))
|
||||
if (QS('#bbox-overlay.visible'))
|
||||
return;
|
||||
|
||||
var k = e.code + '', pos = -1, n;
|
||||
|
|
|
@ -525,11 +525,11 @@ var tt = (function () {
|
|||
|
||||
r.tt.innerHTML = msg.replace(/\$N/g, "<br />");
|
||||
clmod(r.tt, 'show', 1);
|
||||
}
|
||||
};
|
||||
|
||||
r.hide = function () {
|
||||
clmod(r.tt, 'show');
|
||||
}
|
||||
};
|
||||
|
||||
r.init = function () {
|
||||
var ttb = ebi('tooltips');
|
||||
|
|
Loading…
Reference in a new issue