mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
bbox: fix crash on swipe during close
This commit is contained in:
parent
d86653c763
commit
b580953dcd
|
@ -416,6 +416,9 @@ window.baguetteBox = (function () {
|
||||||
var nonPassiveEvent = passiveSupp ? { passive: true } : null;
|
var nonPassiveEvent = passiveSupp ? { passive: true } : null;
|
||||||
|
|
||||||
function bindEvents() {
|
function bindEvents() {
|
||||||
|
bind(document, 'keydown', keyDownHandler);
|
||||||
|
bind(document, 'keyup', keyUpHandler);
|
||||||
|
bind(document, 'fullscreenchange', onFSC);
|
||||||
bind(overlay, 'click', overlayClickHandler);
|
bind(overlay, 'click', overlayClickHandler);
|
||||||
bind(btnPrev, 'click', showPreviousImage);
|
bind(btnPrev, 'click', showPreviousImage);
|
||||||
bind(btnNext, 'click', showNextImage);
|
bind(btnNext, 'click', showNextImage);
|
||||||
|
@ -434,6 +437,9 @@ window.baguetteBox = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function unbindEvents() {
|
function unbindEvents() {
|
||||||
|
unbind(document, 'keydown', keyDownHandler);
|
||||||
|
unbind(document, 'keyup', keyUpHandler);
|
||||||
|
unbind(document, 'fullscreenchange', onFSC);
|
||||||
unbind(overlay, 'click', overlayClickHandler);
|
unbind(overlay, 'click', overlayClickHandler);
|
||||||
unbind(btnPrev, 'click', showPreviousImage);
|
unbind(btnPrev, 'click', showPreviousImage);
|
||||||
unbind(btnNext, 'click', showNextImage);
|
unbind(btnNext, 'click', showNextImage);
|
||||||
|
@ -508,9 +514,7 @@ window.baguetteBox = (function () {
|
||||||
if (overlay.style.display === 'block')
|
if (overlay.style.display === 'block')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bind(document, 'keydown', keyDownHandler);
|
bindEvents();
|
||||||
bind(document, 'keyup', keyUpHandler);
|
|
||||||
bind(document, 'fullscreenchange', onFSC);
|
|
||||||
currentIndex = chosenImageIndex;
|
currentIndex = chosenImageIndex;
|
||||||
touch = {
|
touch = {
|
||||||
count: 0,
|
count: 0,
|
||||||
|
@ -553,9 +557,7 @@ window.baguetteBox = (function () {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sethash('');
|
sethash('');
|
||||||
unbind(document, 'keydown', keyDownHandler);
|
unbindEvents();
|
||||||
unbind(document, 'keyup', keyUpHandler);
|
|
||||||
unbind(document, 'fullscreenchange', onFSC);
|
|
||||||
// Fade out and hide the overlay
|
// Fade out and hide the overlay
|
||||||
overlay.className = '';
|
overlay.className = '';
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -898,8 +900,7 @@ window.baguetteBox = (function () {
|
||||||
function destroyPlugin() {
|
function destroyPlugin() {
|
||||||
unbindEvents();
|
unbindEvents();
|
||||||
clearCachedData();
|
clearCachedData();
|
||||||
unbind(document, 'keydown', keyDownHandler);
|
unbindEvents();
|
||||||
unbind(document, 'keyup', keyUpHandler);
|
|
||||||
document.getElementsByTagName('body')[0].removeChild(ebi('bbox-overlay'));
|
document.getElementsByTagName('body')[0].removeChild(ebi('bbox-overlay'));
|
||||||
data = {};
|
data = {};
|
||||||
currentGallery = [];
|
currentGallery = [];
|
||||||
|
|
Loading…
Reference in a new issue