| 1 |
import {Lightbox} from "./Lightbox"; |
| 2 |
import * as Util from "../Util"; |
| 3 |
|
| 4 |
export class PhotonicFancybox4 extends Lightbox { |
| 5 |
constructor() { |
| 6 |
super(); |
| 7 |
} |
| 8 |
|
| 9 |
soloImages() { |
| 10 |
const solos = super.soloImages(); |
| 11 |
let idIndex = 1; |
| 12 |
solos.forEach(solo => { |
| 13 |
if (solo.getAttribute('id') == null) { |
| 14 |
solo.setAttribute('id', 'photonic-fancybox4-' + idIndex); |
| 15 |
idIndex++; |
| 16 |
} |
| 17 |
if (solo.getAttribute('data-fancybox') == null) { |
| 18 |
solo.setAttribute('data-fancybox', 'photonic-solo-gallery'); |
| 19 |
} |
| 20 |
}); |
| 21 |
}; |
| 22 |
|
| 23 |
hostedVideo(a) { |
| 24 |
const html5 = a.getAttribute('href').match(new RegExp(/(\.mp4|\.webm|\.ogg)/i)), |
| 25 |
css = a.classList.contains('photonic-lb'); |
| 26 |
|
| 27 |
if (html5 !== null && !css) { |
| 28 |
a.classList.add(Photonic_JS.lightbox_library + "-html5-video"); |
| 29 |
this.videoIndex++; |
| 30 |
} |
| 31 |
}; |
| 32 |
|
| 33 |
initialize(selector, group) { |
| 34 |
this.handleSolos(); |
| 35 |
const self = this; |
| 36 |
|
| 37 |
let selection; |
| 38 |
if (selector == null) { |
| 39 |
selection = document.querySelectorAll('.photonic-level-1-container'); |
| 40 |
} |
| 41 |
else if (selector instanceof NodeList) { |
| 42 |
selection = selector; |
| 43 |
} |
| 44 |
else if (selector instanceof Element) { |
| 45 |
selection = [selector]; |
| 46 |
} |
| 47 |
else { |
| 48 |
selection = document.querySelectorAll(selector); |
| 49 |
} |
| 50 |
|
| 51 |
selection.forEach((current) => { |
| 52 |
const galleryId = current.getAttribute('id'); |
| 53 |
Fancybox.bind('#' + galleryId + ' a.photonic-lb', { |
| 54 |
groupAll: true, |
| 55 |
}); |
| 56 |
}); |
| 57 |
}; |
| 58 |
|
| 59 |
initializeForNewContainer(containerId) { |
| 60 |
this.initialize(containerId); |
| 61 |
}; |
| 62 |
|
| 63 |
} |
| 64 |
|