PageSourceSearch

https://snow-lemur-379076.hostingersite.com/wp-content/plugins/eca…/frontend/mptbm_script.js?ver=1791003302

js snow-lemur-379076.hostingersite.com collected 2026-10-03 04:56:05 UTC 4,216 bytes, 96 lines download raw bytes

1(function ($) {
2  "use strict";
3
4  $(document).ready(function () {
5    $(document).on(
6      "change",
7      "#mptbm_shopping_number, #mptbm_passenger_number",
8      function () {
9        // 0 (nothing selected) means "no filter" for that dropdown. Anything
10        // else is a *minimum*: "3 passengers" asks for a vehicle that can
11        // CARRY 3, so a 4- or 8-seater still qualifies. Matching the capacity
12        // exactly instead hid every larger vehicle and routinely emptied the
13        // whole result list - a 2-passenger search on a fleet of 4/6/8-seaters
14        // matched nothing at all.
15        let shoppingNumber = parseInt($("#mptbm_shopping_number").val()) || 0;
16        let passengerNumber = parseInt($("#mptbm_passenger_number").val()) || 0;
17
18        let elements = document.querySelectorAll("[data-mptbm-passanger]");
19
20        elements.forEach(function (element) {
21          let passengerCapacity = parseInt(element.getAttribute("data-mptbm-passanger"), 10) || 0;
22          let bagCapacity = parseInt(element.getAttribute("data-mptbm-beg-count"), 10) || 0;
23
24          let passengerMatches = passengerNumber === 0 || passengerCapacity >= passengerNumber;
25          let bagMatches = shoppingNumber === 0 || bagCapacity >= shoppingNumber;
26
27          // NOT $(element).hide()/.show() - .mptbm_transport_search_area
28          // .mptbm_booking_item has "display: flex !important" (mptbm_style.css),
29          // which beats the inline display:none jQuery's hide()/show() would set,
30          // so the card never actually disappeared. mptbm_booking_item_hidden is
31          // the class this codebase's CSS already wires up for exactly this (see
32          // the !important override two rules below it, and the .mptbm-vehicle-
33          // wrapper:has() rule that collapses the wrapper box too).
34          //
35          // display can't be transitioned though, so jumping straight to
36          // mptbm_booking_item_hidden (display:none) is instant/jarring -
37          // mptbm_booking_item_fading (opacity/transform, see CSS) plays the
38          // actual animation, then hidden is added .22s later once it's done,
39          // matching the CSS transition duration.
40          let shouldHide = !(passengerMatches && bagMatches);
41          if (shouldHide) {
42            element.classList.add("mptbm_booking_item_fading");
43            window.setTimeout(function () {
44              element.classList.add("mptbm_booking_item_hidden");
45            }, 220);
46          } else {
47            element.classList.remove("mptbm_booking_item_hidden");
48            // Force a style recalc so the browser registers the still-faded
49            // starting point before fading-in is removed below - dropping
50            // both classes in the same frame would jump straight to the end
51            // state instead of animating (nothing to transition from).
52            void element.offsetWidth;
53            element.classList.remove("mptbm_booking_item_fading");
54          }
55        });
56      }
57    );
58
59    
60
61    var mptbmTemplateExists = $(".mptbm-show-search-result").length;
62    
63    if (mptbmTemplateExists) {
64      
65      $(".mptbm_order_summary").css("display", "none");
66      function getCookiesWithPrefix(prefix) {
67        const cookies = document.cookie.split(";");
68        const filteredCookies = cookies.filter((cookie) =>
69          cookie.trim().startsWith(prefix)
70        );
71        return filteredCookies.map((cookie) => cookie.trim().split("=")[0]);
72      }
73      const cookieIds = getCookiesWithPrefix(".mptbm_booking_item_");
74
75      function addClassFromElements() {
76        $(".mptbm_booking_item").each(function () {
77          const $this = $(this);
78          let hasCookieId = false;
79          for (let i = 0; i < cookieIds.length; i++) {
80            document.cookie = `${cookieIds[i]}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
81            if ($this.hasClass(cookieIds[i].substring(1))) {
82              hasCookieId = true;
83              break;
84            }
85          }
86          if (!hasCookieId) {
87            $this.addClass("mptbm_booking_item_hidden");
88          }
89        });
90      }
91
92      // Call the function to add the class
93      addClassFromElements();
94    }
95  });
96})(jQuery);

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.