From 014e51640cd1cefefe719c58fc351d69cc2804b6 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Wed, 19 Aug 2020 11:56:38 +0200 Subject: [PATCH] fix: add gallery exists check --- assets/development/scripts/organization.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/assets/development/scripts/organization.js b/assets/development/scripts/organization.js index 71c43e8..5ba95f8 100644 --- a/assets/development/scripts/organization.js +++ b/assets/development/scripts/organization.js @@ -164,16 +164,18 @@ let closeModal = () => { } } -navLeft.onclick = () => { - if (mediaData.indexOf(currentMedia) === 0) { return; } - currentMedia = mediaData[mediaData.indexOf(currentMedia) - 1] - fillModal() -} +if (document.querySelector('.media-mosaic') != null) { + navLeft.onclick = () => { + if (mediaData.indexOf(currentMedia) === 0) { return; } + currentMedia = mediaData[mediaData.indexOf(currentMedia) - 1] + fillModal() + } -navRight.onclick = () => { - if (mediaData.indexOf(currentMedia) + 1 === mediaData.length) { return; } - currentMedia = mediaData[mediaData.indexOf(currentMedia) + 1] - fillModal() + navRight.onclick = () => { + if (mediaData.indexOf(currentMedia) + 1 === mediaData.length) { return; } + currentMedia = mediaData[mediaData.indexOf(currentMedia) + 1] + fillModal() + } } /**