PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
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 2.0.1 All 84 releases
← All changes | assets/js/single-trip-sidebar.js +15 -2 3.0.9 → 3.0.16 View file →
@@ -1,4 +1,17 @@
1 +// Parse a numeric min/max attribute while preserving a legitimate 0.
2 +// `parseInt(el.getAttribute('max')) || 99` treated max="0" — what a sold-out
3 +// departure renders — as "unset" and fell back to the placeholder ceiling, so
4 +// the guest selector stayed usable and ignored the departure's real capacity.
5 +// Only an absent or non-numeric value may fall back. Installed once and shared
6 +// by every frontend script, so load order does not matter.
7 +if (typeof window.yatraNumOr !== 'function') {
8 + window.yatraNumOr = function (raw, fallback) {
9 + var parsed = parseInt(raw, 10);
10 + return isNaN(parsed) ? fallback : parsed;
11 + };
12 +}
13 +
1 14 function yatraScrollToBooking() {
2 15 const bookingForm = document.querySelector('.yatra-booking-form');
3 16 if (bookingForm) {
4 17 bookingForm.scrollIntoView({ behavior: 'smooth', block: 'center' });
@@ -62,9 +75,9 @@
62 75 const targetId = this.getAttribute('data-target');
63 76 const input = document.getElementById(targetId);
64 77 if (input) {
65 78 const current = parseInt(input.value) || 1;
66 - const min = parseInt(input.getAttribute('min')) || 1;
79 + const min = window.yatraNumOr(input.getAttribute('min'), 1);
67 80 if (current > min) {
68 81 input.value = current - 1;
69 82 updateMobileTotal();
70 83 }
@@ -77,9 +90,9 @@
77 90 const targetId = this.getAttribute('data-target');
78 91 const input = document.getElementById(targetId);
79 92 if (input) {
80 93 const current = parseInt(input.value) || 1;
81 - const max = parseInt(input.getAttribute('max')) || 20;
94 + const max = window.yatraNumOr(input.getAttribute('max'), 20);
82 95 if (current < max) {
83 96 input.value = current + 1;
84 97 updateMobileTotal();
85 98 }