PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.37
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.37
3.37 3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 All 142 releases
photonic / include / js / front-end / src / Lightboxes / VenoBox.js

VenoBox.js in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.37, at include/js/front-end/src/Lightboxes/VenoBox.js

118 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {Core} from "../Core";
2 import {Lightbox} from "./Lightbox";
3
4 export class PhotonicVenoBox 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-venobox-' + idIndex);
15 idIndex++;
16 }
17 if (solo.getAttribute('data-gall') == null) {
18 solo.setAttribute('data-gall', 'photonic-solo-gallery');
19 }
20 });
21 };
22
23 hostedVideo(a) {
24 const self = this;
25 const html5 = a.getAttribute('href').match(new RegExp(/(\.mp4|\.webm|\.ogg)/i)),
26 css = a.classList.contains('photonic-lb');
27
28 if (html5 !== null && !css) {
29 a.classList.add(Photonic_JS.lightbox_library + "-html5-video");
30 self.modifyAdditionalVideoProperties(a);
31 }
32 };
33
34 changeVideoURL(element, regular, embed) {
35 element.setAttribute('href', embed); // Don't need this for Venobox, but embeds are the only type that support "start" or "t" parameters
36 };
37
38 modifyAdditionalVideoProperties(anchor) {
39 if (anchor != null && anchor instanceof Element && anchor.tagName === 'A') {
40 anchor.setAttribute('data-vbtype', 'video');
41 if (anchor.getAttribute('id') == null) {
42 anchor.setAttribute('id', 'photonic-venobox-video-' + this.videoIndex);
43 this.videoIndex++;
44 }
45 }
46 }
47
48 initialize(selector, destroy) {
49 this.handleSolos();
50 const self = this;
51
52 let selection;
53 if (selector == null) {
54 selection = document.querySelectorAll('.photonic-level-1-container');
55 }
56 else if (selector instanceof NodeList) {
57 selection = selector;
58 }
59 else if (selector instanceof Element) {
60 selection = [selector];
61 }
62 else {
63 selection = document.querySelectorAll(selector);
64 }
65
66 selection.forEach(function (current) {
67 const galleryId = current.getAttribute('id');
68
69 if (destroy) {
70 }
71
72 const lightbox = new VenoBox({
73 selector: '#' + galleryId + ' a.photonic-lb',
74 titleattr: 'data-title',
75 numeration: true,
76 share: Photonic_JS.social_media,
77 infinigall: Photonic_JS.lightbox_loop,
78 customClass: Photonic_JS.vb_disable_vertical_scroll ? 'no-scroll' : '',
79 titlePosition: Photonic_JS.vb_title_position,
80 titleStyle: Photonic_JS.vb_title_style,
81 onPreOpen: (a) => {
82 self.setHash(a);
83 },
84 onNavComplete: (obj, idx, theNext, thePrev) => {
85 self.setHash(obj);
86 },
87 onPreClose: () => {
88 self.unsetHash();
89 },
90 });
91
92 let thumbs;
93 thumbs = current.querySelectorAll('a.photonic-lb');
94 let rel = '';
95 if (thumbs.length > 0) {
96 rel = thumbs[0].getAttribute('data-gall');
97 Core.addToLightboxList(rel, lightbox);
98 }
99 });
100
101 if (document.querySelector('.photonic-venobox-solo, .venobox-video, .venobox-html5-video') && !destroy) {
102 new VenoBox({
103 selector: '.photonic-venobox-solo, .venobox-video, .venobox-html5-video',
104 numeration: true,
105 share: Photonic_JS.social_media,
106 infinigall: Photonic_JS.lightbox_loop,
107 customClass: Photonic_JS.vb_disable_vertical_scroll ? 'no-scroll' : '',
108 titlePosition: Photonic_JS.vb_title_position,
109 titleStyle: Photonic_JS.vb_title_style,
110 });
111 }
112 };
113
114 initializeForNewContainer(containerId) {
115 this.initialize(containerId);
116 }
117 }
118