PageSourceSearch

https://buenosairescitybus.com/resources/js/global.js?v=2.1.11

js buenosairescitybus.com collected 2026-10-07 02:01:14 UTC 18,119 bytes, 451 lines download raw bytes

1(function ($) {
2    "use strict"; // Start of use strict
3
4    // Smooth scrolling using jQuery easing
5    $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function () {
6        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
7            var target = $(this.hash);
8            target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
9            if (target.length) {
10                $('html, body').animate({
11                    scrollTop: (target.offset().top - 56)
12                }, 1000, "easeInOutExpo");
13                return false;
14            }
15        }
16    });
17
18    // Closes responsive menu when a scroll trigger link is clicked
19    $('.js-scroll-trigger').click(function () {
20        $('.navbar-collapse').collapse('hide');
21    });
22
23    // Activate scrollspy to add active class to navbar items on scroll
24    if ($.fn.scrollspy) {
25        $('body').scrollspy({
26            target: '#mainNav',
27            offset: 56
28        });
29    }
30
31})(jQuery); // End of use strict
32
33
34if (sessionStorage.getItem('noticed') != null) {
35    var notice = sessionStorage.getItem('noticed');
36}
37else {
38    var noticed = false;
39}
40
41// Service notices (route cuts, reduced service) are now rendered server-side by
42// app/template/alert.php together with the date alerts, in a single toast.
43// Calling notification() here showed the same route cut twice.
44// $(document).ready(function () {
45//     notification();
46// });
47
48function notification() {
49    var config = new Object;
50    var data = new Object;
51    var lang = sessionStorage.getItem('lang');
52
53    $.ajax({
54        url: "resources/json/notification.json",
55        type: "GET",
56        dataType: "JSON",
57        success: function (response) {
58            config = response;
59
60            //if(localStorage.getItem('lastNotificationType') != config.type || localStorage.getItem('random') != config.random)
61            //{
62            $.ajax({
63                url: "resources/json/buenosairescitybus.json",
64                type: "GET",
65                dataType: "JSON",
66                success: function (response) {
67                    data = response;
68
69                    var notification = new Notification(config, data, lang);
70                    notification.notificate();
71                },
72                error: function (jqXHR, textStatus, errorThrown) {
73                    Swal.fire({
74                        icon: traslation.swal.error.icon,
75                        title: traslation.swal.error.title,
76                        text: traslation.swal.error.text,
77                    });
78                }
79            });
80            //}
81        },
82        error: function (jqXHR, textStatus, errorThrown) {
83            Swal.fire({
84                icon: traslation.swal.error.icon,
85                title: traslation.swal.error.title,
86                text: traslation.swal.error.text,
87            });
88        }
89    });
90}
91
92function loading(attr, value) {
93    var spinner = '';
94
95    switch (attr) {
96        case 'name':
97            var container = $('[name="' + value + '"]');
98            break;
99        case 'class':
100            var container = $('.' + value);
101            break;
102        case 'id':
103            var container = $('#' + value);
104            break;
105    }
106
107    container.html('');
108    container.addClass('justify-content-center align-items-center loading');
109
110    // Bus Loader HTML (Same as loader_new.php)
111    var busLoaderHtml = `
112<div class="loaderWrap" style="margin: 0 auto;">
113    <div class="cloud"></div>
114    <div class="cloud c2"></div>
115    <div class="cloud c3"></div>
116    <div class="wind"><i></i><i></i><i></i></div>
117    <div class="road"></div>
118    <svg xmlns="http://www.w3.org/2000/svg" class="busSvg" viewBox="0 0 540.21 173.55">
119      <g id="bus" class="bus-body">
120        <polygon points="166.57 12.35 166.8 47.27 295.17 47.44 294.73 12.35 166.57 12.35" fill="none"/>
121        <polygon points="93.71 47.36 163.86 47.44 163.86 12.51 98.23 12.35 93.71 47.36" fill="none"/>
122        <path d="M106.12,69.18c-4,1.18-5.72,1.53-8.49,6C95,79.46,89,90.58,89,90.58L84.3,101.76l40.56.09,10.55-34.94S109.1,68.51,106.12,69.18Z" transform="translate(-40.28 -54.4)" fill="none"/>
123        <path d="M552.27,67.17l-83-.42v34.64s59.57.37,69.19.51c10.13,0,8.51-2,10.27-4.75,1.54-2.53,7.07-19.66,7.93-23C558.42,67.53,552.27,67.17,552.27,67.17Z" transform="translate(-40.28 -54.4)" fill="none"/>
124        <polygon points="298.3 12.35 297.89 47.36 425.85 47.44 425.52 12.35 298.3 12.35" fill="none"/>
125        <path d="M579.13,192.87l.2-91.31s-2.67-33.48-5.17-36.68l2.35-7.08-35.64-3.4v9.12l-402.13,0v-9s-36.63,2.62-43.75,5c-3.44,1.53-7.5,4.82-11.69,9.89l5,.78a4.15,4.15,0,0,0-1.1,3.18C86.3,75,74.44,98.14,71.83,109.76c-1.65.71-8.74,2.29-8.74,2.29A213.3,213.3,0,0,1,72,87.59a146.35,146.35,0,0,0-8.95,24.34c-13.38,4.52-19.8,6.14-21.16,9.51s-2.4,20.08-.87,21.37c1.76,1.39,3.89.07,4.6-3.64S47.34,128,47.34,128s-1-6,14.76-10.15a123.67,123.67,0,0,0-2.78,13l6.48-1.31s2.7.28,1.12,5.39c-1.83,8.22-2.5,35.81-2.5,35.81a3.81,3.81,0,0,1-2.32,2.76c-1.59.58-6.25,2-6.27,2.06-.16-1.41-.1-9.17.22-17.86-.8,10.16-1,20-.25,26.75l-1.46,3.83.4,7.27.19,1.47-1,3.79s-1.27,12.52,1.88,15.12c5.88,0,76.46-.23,76.46-.23l.2-6.53s.63-6.72,1.68-9.31c.08-.22.18-.44.28-.67A23.18,23.18,0,0,1,180,204.87v0c.48,3,.68,6.1,1,10.51l5.18.51,211.41-.22.29-10.07a18.54,18.54,0,0,1,.68-3.31c.31-.87.75-2,1.32-3.27a23,23,0,0,1,14.28-15.59,17.62,17.62,0,0,1,2.95-.85,22.94,22.94,0,0,1,26.53,14.91,24.28,24.28,0,0,1,2.24,8.24l.47,10.49,72.7-.43,57-5.26,4.33-13.79Zm-512-7.24a13,13,0,0,0-5.76,6.62,10.52,10.52,0,0,1-2.53,3.67l-3-1C59.07,182,67.46,180,67.69,180a3.3,3.3,0,0,1,1-.09C69.38,182.23,68.2,184.2,67.17,185.63ZM89,90.1S95,79,97.63,74.75c2.77-4.51,4.48-4.87,8.49-6,3-.67,29.29-2.27,29.29-2.27l-10.55,34.94-40.56-.08Zm20.48,81.64H81.93c-4.4,0-3.89-1.85-4-5.34-.23-3.83,1.86-29.13,1.86-29.13.61-2.32,5.13-2.21,5.13-2.21s17.36.06,22.66-.06c7.21-.5,6.25,4.08,6.25,4.08v27.26C114.15,172.46,109.5,171.74,109.5,171.74Zm66.89,0H120.6a3.68,3.68,0,0,1-3.74-2.58V137.36s53.39-2,58.24-1.64,4.18,3.1,4.18,3.1.08,25,.33,28.64A4.25,4.25,0,0,1,176.39,171.74ZM134,101.29l4.52-35,65.63.15v34.94Zm107.26,70.44s-49.15.09-53.75,0c-4.4.51-5.15-2.67-5.15-2.67l.05-31c.4-2.55,4.56-2.44,4.56-2.44s50.91-.75,54.29-.7c3.58.34,3.38,4.67,3.38,4.67s.07,23.94,0,27.45A3.94,3.94,0,0,1,241.25,171.73Zm65.11,0h-52.6c-5.23.29-5.75-2.92-5.75-2.92l0-30.69c.54-3.26,4.89-3.14,4.89-3.14h53.18c2.94-.58,4.07,2.47,4.07,2.47s.21,24.61.21,29.4S306.36,171.73,306.36,171.73ZM207.08,101.2l-.23-34.92H335l.44,35.09Zm131.09.09.41-35H465.8l.33,35.09Zm218.44
125-27.6c-.86,3.32-6.39,20.45-7.93,23-1.76,2.78-.14,4.79-10.27,4.75-9.62-.14-69.19-.52-69.19-.52V66.28l83,.41S558.42,67.06,556.61,73.69Z" transform="translate(-40.28 -54.4)" fill="#df2228"/>
126      </g>
127      <g class="wheel wheel--front" data-name="wheel wheel--front">
128        <circle cx="116.85" cy="152.36" r="19.34" fill="#514b4a" stroke="#df2228" stroke-miterlimit="10" stroke-width="3"/>
129        <circle cx="116.85" cy="152.36" r="11.94" fill="#fff"/>
130        <circle cx="116.85" cy="152.36" r="5.1" fill="#df2228"/>
131      </g>
132      <g class="wheel wheel--rear" data-name="wheel wheel--rear">
133        <circle cx="382.21" cy="152.71" r="19.34" fill="#514b4a" stroke="#df2228" stroke-miterlimit="10" stroke-width="3"/>
134        <circle cx="382.21" cy="152.71" r="11.94" fill="#fff"/>
135        <circle cx="382.21" cy="152.71" r="5.1" fill="#df2228"/>
136      </g>
137    </svg>
138</div>`;
139
140    container.html(busLoaderHtml);
141}
142
143function toggle(attrContainer, valueContainer, attrButton = '', valueButton = '', position = '') {
144    switch (attrContainer) {
145        case 'name':
146            var container = $('[name="' + valueContainer + '"]');
147            break;
148        case 'class':
149            var container = $('.' + valueContainer);
150            break;
151        case 'id':
152            var container = $('#' + valueContainer);
153            break;
154    }
155
156    switch (attrButton) {
157        case 'name':
158            var button = $('[name="' + valueButton + '"]');
159            break;
160        case 'class':
161            var button = $('.' + valueButton);
162            break;
163        case 'id':
164            var button = $('#' + valueButton);
165            break;
166    }
167
168    container.toggle('fast');
169
170    if (button.hasClass('hide')) {
171        button.removeClass('hide');
172        button.addClass('show');
173        button.children().removeClass('fa-eye');
174        button.children().addClass('fa-eye-slash');
175        button.attr('title', traslation.checkout.cart.hideButtonTitle);
176
177        if (position != '') {
178            $('#title' + position).hide('fast');
179            $('#date' + position).hide('fast');
180            $('#price' + position).hide('fast');
181        }
182    }
183    else {
184        button.removeClass('show');
185        button.addClass('hide');
186        button.children().removeClass('fa-eye-slash');
187        button.children().addClass('fa-eye');
188        button.attr('title', traslation.checkout.cart.showButtonTitle);
189
190        if (position != '') {
191            $('#title' + position).show('fast');
192            $('#date' + position).show('fast');
193            $('#price' + position).show('fast');
194        }
195    }
196}
197
198function myTickets() {
199    Swal.fire({
200        title: traslation.tickets.dniRequest,
201        input: 'text',
202        inputAttributes: {
203            autocapitalize: 'off'
204        },
205        showCancelButton: true,
206        confirmButtonText: traslation.tickets.confirmButton,
207        cancelButtonText: traslation.tickets.cancelButton,
208        showLoaderOnConfirm: true,
209        icon: 'info',
210        preConfirm: (dni) => {
211            if (dni == '') {
212                Swal.showValidationMessage(traslation.tickets.validations.emptyFields)
213            }
214            else {
215                return fetch(`?controller=index&action=tickets&dni=${dni}`)
216                    .then(response => {
217                        if (!response.ok) {
218                            throw new Error(response.statusText);
219                        }
220
221                        return response.json()
222                    })
223                    .catch(error => {
224                        Swal.showValidationMessage(
225                            `Request failed: ${error}`
226                        )
227                    });
228            }
229        },
230        allowOutsideClick: () => !Swal.isLoading()
231    }).then((result) => {
232        if (result.value) {
233            Swal.fire({
234                title: `${result.value.swal.text}`,
235                icon: `${result.value.swal.icon}`
236            });
237        }
238    });
239}
240
241function codeRedeemer(navbar = false, optional = false) {
242    Swal.fire({
243        title: traslation.hotels.codeRequest,
244        input: 'text',
245        inputAttributes: {
246            autocapitalize: 'off'
247        },
248        showCancelButton: true,
249        confirmButtonText: traslation.hotels.confirmButton,
250        cancelButtonText: traslation.hotels.cancelButton,
251        showLoaderOnConfirm: true,
252        allowEscapeKey: false,
253        showCloseButton: true,
254        preConfirm: (code) => {
255            if (code == '') {
256                Swal.showValidationMessage(traslation.hotels.validations.emptyFields)
257            }
258            else {
259                return fetch(`?controller=client&action=redeemCode&username=${code}`)
260                    .then(response => {
261                        if (!response.ok) {
262                            throw new Error(response.statusText);
263                        }
264
265                        return response.json()
266                    })
267                    .catch(error => {
268                        Swal.showValidationMessage(
269                            `Request failed: ${error}`
270                        )
271                    });
272            }
273        },
274        allowOutsideClick: () => !Swal.isLoading()
275    }).then((result) => {
276        if (result.value) {
277            if (navbar) {
278                /*           if(!optional)
279                          {
280                            Swal.fire({
281                                title: `${result.value.swal.text}`,
282                                icon: `${result.value.swal.icon}`
283                            });
284                            location.reload();
285                          }
286                          else
287                          {
288                            Swal.fire({
289                                title: `${result.value.swal.text}`,
290                                icon: `${result.value.swal.icon}`
291                            });
292                            window.location.href = "?controller=optionals";
293                          } */
294                Swal.fire({
295                    title: `${result.value.swal.text}`,
296                    icon: `${result.value.swal.icon}`
297                });
298                location.reload();
299            }
300        }
301        else if (result.dismiss === Swal.DismissReason.cancel || result.dismiss === Swal.DismissReason.backdrop || result.dismiss === Swal.DismissReason.close || result.dismiss === Swal.DismissReason.esc) {
302            return fetch(`?controller=client&action=logout`)
303                .then(response => {
304                    if (!response.ok) {
305                        throw new Error(response.statusText);
306                    }
307
308                    return response.json()
309                })
310                .catch(error => {
311                    Swal.showValidationMessage(
312                        `Request failed: ${error}`
313                    )
314                });
315        }
316    });
317}
318
319function formSend(form = '#optionalSetForm', data) {
320    var nationality = data.nationality;
321    var date = data.date;
322    var type = data.type;
323
324    var form = $(form);
325
326    resetErrors(form);
327
328    $.ajax({
329        url: "?controller=optional&action=validateSet",
330        type: "POST",
331        data: {
332            nationality: nationality,
333            date: date,
334            type: type
335        },
336        dataType: "JSON",
337        success: function (response) {
338            if (response.status) {
339                $.ajax({
340                    type: "POST",
341                    url: `?controller=index&action=setNationality&nationality=${nationality}`,
342                    data: $(this).serialize(),
343                    success: function (response) {
344                        var response = JSON.parse(response);
345
346                        if (response.status) {
347                            setLang();
348
349                            $.each(response.session, function (key, value) {
350                                sessionStorage.setItem(key, value);
351                            });
352                            window.location.href = "?controller=optionals&action=show&nationality=" + response.session.nationality + "&date=" + date + "&type=" + type;
353                        }
354                    }
355                })
356            }
357            else {
358                if (response.method == 'formValidation') {
359                    showErrors(form, response.validation);
360                }
361            }
362        },
363        error: function (jqXHR, textStatus, errorThrown) {
364            Swal.fire({
365                icon: traslation.swal.error.icon,
366                title: traslation.swal.error.title,
367                text: traslation.swal.error.text,
368            });
369        }
370    });
371}
372
373if (sessionStorage.getItem('page') == 'optional') {
374    loading('id', 'cityPacksContainer');
375    loading('id', 'ticketsContainer');
376    loading('id', 'transfersContainer');
377    loading('id', 'TangoContainer');
378    loading('id', 'GastronomiaContainer');
379    loading('id', 'NavegacionContainer');
380    loading('id', 'optionalsContainer');
381
382    var optional = new Object;
383
384    var rateType;
385    var packageType;
386    var packagePickups;
387    var shortDescription;
388    var longDescription;
389    var shortHighlights = new Array;
390    var longHighlights = new Array;
391    var packageSeasons;
392}
393
394if (sessionStorage.getItem('page') == 'index') {
395    var optional = new Object;
396}
397
398if (sessionStorage.getItem('page') == 'booking') {
399    loading('id', 'booking');
400}
401
402(async () => {
403    try {
404        $(document).ready(function () {
405            $("#optionalSetForm").submit(function () {
406                var data = {
407                    nationality: this['nationality'].value,
408                    date: this['date'].value,
409                    type: this['type'].value,
410                }
411
412                formSend('#optionalSetForm', data)
413            })
414
415            $("#optionalSetFormCityPack").submit(function () {
416                var data = {
417                    nationality: this['nationality'].value,
418                    date: this['date'].value,
419                    type: this['type'].value,
420                }
421
422                formSend('#optionalSetFormCityPack', data)
423            })
424
425
426            if (sessionStorage.getItem('page') == 'index' && typeof Optional !== 'undefined') {
427                optional = new Optional('optional');
428            }
429
430            // optional page init moved to optional.js to avoid DOMContentLoaded timing issues
431
432            if (sessionStorage.getItem('page') == 'booking' && typeof Booking !== 'undefined') {
433                $(document).ready(function () {
434                    (async () => {
435                        try {
436                            var booking = new Booking('booking');
437
438                            await booking.get();
439                        }
440                        catch (error) {
441                            console.log(error);
442                        }
443                    })();
444                });
445            }
446        });
447    }
448    catch (error) {
449        console.log(error);
450    }
451})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.