PageSourceSearch

https://visitcroatia.net/wp-content/themes/visitcroatia/assets/js/main.js?ver=1790328652

js visitcroatia.net collected 2026-09-25 09:47:37 UTC 6,297 bytes, 237 lines download raw bytes

1AOS.init({
2  once: true,
3});
4
5$(document).ready(function () {
6  $(".sidenav").sidenav();
7  $(".modal").modal();
8  $(".collapsible").collapsible();
9  $(".datepicker").datepicker();
10  $(".match-it").matchHeight();
11  $(".collapsible").collapsible();
12  $(".dropdown-trigger").dropdown({
13    coverTrigger: false,
14    inDuration: 250,
15    hover: true,
16  });
17
18  $(".slider").slider({
19    height: 600,
20  });
21
22  if ($(window).width() < 992) {
23    $(".slider").slider({
24      height: 450,
25    });
26  }
27
28  if ($(window).width() < 600) {
29    $(".slider").slider({
30      height: 300,
31    });
32
33    $(".sibebar-collapse").addClass("collapsible");
34  }
35
36  if ($(window).width() > 600) {
37    $(".sibebar-collapse").removeClass("collapsible");
38    $(".sibebar-collapse .collapsible-body").css({
39      display: "block",
40      "padding-top": "0",
41    });
42  }
43
44  $('input[name="idf"]').on("change", function () {
45    if ($(this).is(":checked")) {
46      $("#arrivalDate, #departureDate").val("");
47      $('input[name="arrival"], input[name="departure"]').val("");
48    }
49  });
50
51  /***** Format form dates to booking.com format *****/
52  var date = new Date();
53  var datepickerOptions = {
54    yearRange: [date.getFullYear(), date.getFullYear()],
55    defaultDate: date,
56    firstDay: 1,
57    format: "dd.mm.yyyy.",
58    container: "body",
59    i18n: {
60      cancel: visitcroatia_vars.cancel,
61      clear: visitcroatia_vars.clear,
62      done: visitcroatia_vars.done,
63      months: visitcroatia_vars.months,
64      monthsShort: visitcroatia_vars.monthsShort,
65      weekdays: visitcroatia_vars.weekdays,
66      weekdaysShort: visitcroatia_vars.weekdaysShort,
67      weekdaysAbbrev: visitcroatia_vars.weekdaysAbbrev,
68    },
69  };
70
71  if ($("form.booking").length) {
72    // * adriagate.com
73    /*
74		queries: 	Arrival = dd/mm/yyyy
75					Departure = dd/mm/yyyy
76	*/
77
78    var arrival = $('form.booking input[name="arrival"]');
79    var departure = $('form.booking input[name="departure"]');
80
81    datepickerOptions.onClose = function () {
82      var arrivalDate = $("#arrivalDate").val();
83      var departureDate = $("#departureDate").val();
84
85      if (arrivalDate) {
86        arrival.val(arrivalDate);
87      }
88
89      if (departureDate) {
90        departure.val(departureDate);
91      }
92    };
93
94    $('form.booking button[type="submit"]').on("click", function (e) {
95      console.log("Booking test");
96      const idfChecked = $('input[name="idf"]').is(":checked");
97      const arrivalVal = arrival.val();
98      const departureVal = departure.val();
99
100      const form = $("form.booking");
101
102      console.log("arrival:", form.find('input[name="arrival"]').val());
103      console.log("departure:", form.find('input[name="departure"]').val());
104      console.log(
105        "idf:",
106        form.find('input[name="idf"]').is(":checked") ? "on" : "off"
107      );
108
109      if (!idfChecked && (!arrivalVal || !departureVal)) {
110        $("form.booking .error-message").show();
111        e.preventDefault();
112
113        function showErrors(element) {
114          if (!$(element).val()) {
115            $(element).addClass("error");
116          } else {
117            $(element).removeClass("error");
118          }
119        }
120
121        if (!idfChecked) {
122          showErrors($("#arrivalDate"));
123          showErrors($("#departureDate"));
124        }
125      } else {
126        $("form.booking .error-message").hide();
127      }
128    });
129  }
130
131  $(".datepicker").datepicker(datepickerOptions);
132
133  function checkInput() {
134    $(".wpcf7-form-control").on("focus change", function () {
135      $(this).parent().next().next("label").addClass("active");
136    });
137
138    $(".wpcf7-form-control").on("focusout", function () {
139      if (!$(this).val()) {
140        var labelelement = $(this).parent().next().next("label");
141        $(labelelement).removeClass("active");
142      }
143    });
144
145    $(".wpcf7-form-control").each(function () {
146      if ($(this).val()) {
147        var labelelement = $(this).parent().next().next("label");
148        $(labelelement).addClass("active");
149      }
150    });
151  }
152
153  checkInput();
154
155  /***** Taxonomy page bio filter *****/
156  var list = $(".geo .body > ul > li");
157  var searchWrapper = $(".geo .body > .search-wrapper");
158  var search = $(".geo .body > .search-wrapper > input");
159  var removeFilter = $(".geo .body > a");
160  var nextBtn = $("button.js-next");
161  var prevBtn = $("button.js-previous");
162  var step = 20;
163  var sliceFrom = 0;
164  var sliceTo = step;
165
166  list.slice(sliceFrom, sliceTo).show();
167
168  if (!removeFilter.length) {
169    if (!list.slice(sliceFrom + step, sliceTo + step).length)
170      nextBtn.prop("disabled", true);
171
172    prevBtn.prop("disabled", true);
173
174    search.on("keyup", function () {
175      filterList = [];
176
177      list.hide();
178
179      if (search.val().length >= 1) {
180        for (var li of list) {
181          var upercaseListText = $(li)
182            .children("a")
183            .text()
184            .toUpperCase()
185            .split("<span>")[0];
186          var uppercaseSearchText = search.val().toUpperCase();
187
188          if (upercaseListText.indexOf(uppercaseSearchText) > -1)
189            filterList.push(li);
190        }
191
192        $(filterList.slice(sliceFrom, sliceTo)).show();
193
194        nextBtn.add(prevBtn).hide();
195      } else {
196        sliceFrom = 0;
197        sliceTo = step;
198
199        list.slice(sliceFrom, sliceTo).show();
200
201        nextBtn.add(prevBtn).show();
202        prevBtn.prop("disabled", true);
203      }
204    });
205
206    nextBtn.on("click", function () {
207      sliceFrom += step;
208      sliceTo += step;
209      list.hide();
210      list.slice(sliceFrom, sliceTo).show();
211
212      if (!list.slice(sliceFrom + step, sliceTo + step).length)
213        nextBtn.prop("disabled", true);
214
215      if (prevBtn.is(":disabled")) prevBtn.prop("disabled", false);
216    });
217
218    prevBtn.on("click", function () {
219      sliceFrom -= step;
220      sliceTo -= step;
221      list.hide();
222      list.slice(sliceFrom, sliceTo).show();
223
224      if (!list.slice(sliceFrom - step, sliceTo - step).length)
225        prevBtn.prop("disabled", true);
226
227      if (nextBtn.is(":disabled")) nextBtn.prop("disabled", false);
228    });
229  } else {
230    searchWrapper.add(search).add(nextBtn).add(prevBtn).hide();
231  }
232
233  //trigger date select on click on datepicker (homepage)
234  $(document).on("click", ".datepicker-day-button", function () {
235    $(".confirmation-btns .datepicker-done").trigger("click");
236  });
237});

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.