PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.17 3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 All 85 releases
← All changes | assets/js/tour-viewer.js +22 -0 3.0.13 → 3.0.16 View file →
@@ -30,8 +30,23 @@
30 30 this.init();
31 31 }
32 32
33 33 init() {
34 + // Nothing is built here on purpose. The modal markup (and its
35 + // empty <h3 class="yatra-tour-viewer-title">) used to be injected
36 + // into <body> as soon as this script loaded — on every page,
37 + // including ones with no 360° tour. It is now created on the
38 + // first view() call, so pages that never open a tour never get
39 + // the extra DOM.
40 + }
41 +
42 + /**
43 + * Build the modal once, on first use.
44 + */
45 + ensureModal() {
46 + if (this.modal) {
47 + return;
48 + }
34 49 this.createModal();
35 50 this.attachEventListeners();
36 51 }
37 52
@@ -127,8 +142,9 @@
127 142 return;
128 143 }
129 144
130 145 this.currentTour = tour;
146 + this.ensureModal();
131 147
132 148 // Set title
133 149 const titleElement = this.modal.querySelector('.yatra-tour-viewer-title');
134 150 if (titleElement) {
@@ -147,8 +163,11 @@
147 163 document.body.style.overflow = 'hidden';
148 164 }
149 165
150 166 close() {
167 + if (!this.modal) {
168 + return; // never opened on this page
169 + }
151 170 this.modal.style.display = 'none';
152 171 document.body.style.overflow = '';
153 172
154 173 // Stop tour by clearing iframe src
@@ -161,8 +180,11 @@
161 180 }
162 181 }
163 182
164 183 toggleFullscreen() {
184 + if (!this.modal) {
185 + return;
186 + }
165 187 const wrapper = this.modal.querySelector('.yatra-tour-viewer-wrapper');
166 188
167 189 if (!document.fullscreenElement) {
168 190 if (wrapper.requestFullscreen) {