1
0
Fork 0
photos/web/shared/js/view.js

26 lines
643 B
JavaScript

import Gallery from './gallery.js';
import Enlarge from './enlarge.js';
// Bind elements
const galleryEle = document.querySelector('main.gallery');
const gallery = new Gallery(galleryEle);
const enlargeEles = document.querySelectorAll('[data-enlarge]');
const enlarge = new Enlarge(document.body);
for (const ele of enlargeEles) {
enlarge.register(ele.dataset.enlarge, ele);
}
const enlargePreloadEles = document.querySelectorAll('[data-enlarge-preload-for]');
for (const ele of enlargePreloadEles) {
enlarge.registerPreload(ele.dataset.enlargePreloadFor, ele);
}
enlarge.watchHash();
// Debug
window.g = gallery;
window.e = enlarge;