PageSourceSearch

https://www.hestiahotels.com/wp-content/themes/hestia_group/js/main.js?ver=1.1.0

js hestiahotels.com collected 2026-09-24 11:33:02 UTC 7,284 bytes, 253 lines download raw bytes

1var debug = function (v) {
2	if (arguments.length > 1) {
3		console.debug(arguments);
4	} else {
5		console.debug(v);
6	}
7};
8
9jQuery(document).ready(function () {
10
11    /* ----------------------------------------------------
12       HOTEL URL KONFIGURATSIOON
13    ---------------------------------------------------- */
14    const hotelUrls = {
15        haapsalu: "Hestia-Hotel-Haapsalu-Spa/JLY3",
16        strand: "Hestia-Hotel-Strand/JLY6",
17        hugo: "Hestia-Hotel-Hugo/J338",
18        hestiahotelilmarinedirect: "Hestia-Hotel-Ilmarine/JLPQ",
19        euroopaoudirect: "Hestia-Hotel-Europa/JLPC",
20        talinnseaportdirect: "Hestia-Hotel-Seaport/JLPA",
21        hotelsusidirect: "Hestia-Hotel-Susi/JLPX",
22        baronsdirect: "Hestia-Hotel-Barons/JLCX",
23        hestiahotelkentmannidirect: "Hestia-Hotel-Kentmanni/JLCC",
24        radiundraugi: "Hestia-Hotel-Draugi/JLCA",
25        pkrigahoteldirect: "Hestia-Hotel-Jugend/JLCQ"
26    };
27
28    const GROUP_FALLBACK = "Hestia-Hotel-Group/JLCE";
29
30    /* ----------------------------------------------------
31       ABIFUNKTSIOON KUUPÄEVA KONVERTIMISEKS
32    ---------------------------------------------------- */
33    function convertDate(str) {
34        const [d, m, y] = str.split("/");
35        return `${y}-${m}-${d}`;
36    }
37
38/* ----------------------------------------------------
39   DATEPICKER
40---------------------------------------------------- */
41
42const setCheckIn = moment();
43const setCheckOut = moment().add(1, "days");
44
45jQuery(".datepicker:not(.product_datepicker):not(.gform-datepicker)").datepicker({
46    dateFormat: "dd/mm/yy",
47    minDate: 1,
48    firstDay: 1,
49    onSelect: function () {
50
51        if (jQuery(this).is("#checkin")) {
52
53            const [d, m, y] = jQuery(this).val().split("/");
54            const setDate = moment([y, m - 1, d]).add(1, "days");
55
56            jQuery("#checkout").datepicker("option", "minDate", new Date(setDate));
57            jQuery("#checkout").val(setDate.format("DD/MM/YYYY"));
58
59            setTimeout(() => {
60                jQuery("#checkout").datepicker("show");
61            }, 16);
62        }
63    }
64});
65
66jQuery(".datepicker.product_datepicker").datepicker({
67    dateFormat: "dd. M yy",
68    minDate: 1,
69    firstDay: 1
70});
71
72jQuery("#checkin").val(setCheckIn.format("DD/MM/YYYY"));
73jQuery("#checkout").val(setCheckOut.format("DD/MM/YYYY"));
74
75    /* ----------------------------------------------------
76       DESKTOP BOOKING LOGIC
77    ---------------------------------------------------- */
78    jQuery(".booking .btn, .sub_booking .btn").on("click", function (e) {
79        e.preventDefault();
80
81        const clientName = jQuery('.booking-block #hotelsSelect').val();
82        const lang = jQuery(this).attr("data-lang");
83
84        const hotelPath = hotelUrls[clientName] || GROUP_FALLBACK;
85
86        const checkin = convertDate(jQuery("#checkin").val());
87        const checkout = convertDate(jQuery("#checkout").val());
88
89        const url = `https://www.secure-hotel-booking.com/${hotelPath}/${lang}/?arrivalDate=${checkin}&departureDate=${checkout}`;
90
91        window.open(url);
92        return false;
93    });
94
95    /* ----------------------------------------------------
96       MOBILE BOOKING LOGIC
97    ---------------------------------------------------- */
98    jQuery(".mobile-booking-block .btn").on("click", function (e) {
99        e.preventDefault();
100
101        const clientName = jQuery('.mobile-booking-block #hotelsSelect').val();
102        const lang = jQuery(this).attr("data-lang");
103
104        const hotelPath = hotelUrls[clientName] || GROUP_FALLBACK;
105        const url = `https://www.secure-hotel-booking.com/${hotelPath}/${lang}`;
106
107        window.open(url);
108        return false;
109    });
110
111    /* ----------------------------------------------------
112       UI / MUU FUNKTSIONAALSUS (MUUTMATA)
113    ---------------------------------------------------- */
114
115	jQuery(".nav_trigger").click(function () {
116		jQuery(".nav_overlay").addClass("active");
117		return false;
118	});
119
120    jQuery(".trigger_cart").on("click", function (e) {
121    	e.preventDefault();
122        jQuery(".shopping_cart_preview").toggleClass("active");
123        return false;
124    });
125
126	jQuery(".overlay_close").click(function () {
127		jQuery(".nav_overlay").removeClass("active");
128		return false;
129	});
130
131	jQuery(".book_trigger").click(function () {
132		jQuery(".sub_booking").slideToggle("slow").toggleClass("active");
133		return false;
134	});
135
136	jQuery(".search_trigger").click(function () {
137		jQuery(".search_overlay").addClass("active");
138		jQuery(".nav_overlay").removeClass("active");
139		return false;
140	});
141
142	jQuery(".search_close").click(function () {
143		jQuery(".search_overlay").removeClass("active");
144		return false;
145	});
146
147	jQuery(".trigger_mobile_booking").click(function () {
148		jQuery(".mobile_booking_home").slideToggle("slow").toggleClass("active");
149		return false;
150	});
151
152	jQuery(".close_booking_home").click(function () {
153		jQuery(".mobile_booking_home").fadeOut(500);
154		return false;
155	});
156
157	jQuery(".accordion h3:first").addClass("active");
158	jQuery(".accordion .acc_txt:not(:first)").hide();
159
160	jQuery(".accordion h3").click(function () {
161		jQuery(this).next(".acc_txt").slideToggle("slow").siblings(".acc_txt:visible").slideUp("slow");
162		jQuery(this).toggleClass("active");
163		jQuery(this).siblings("h3").removeClass("active");
164	});
165
166	jQuery(".moretext").hide();
167	jQuery(".showtext").click(function () {
168		jQuery(this).toggleClass("active");
169		jQuery(this).siblings(".moretext").slideToggle("slow").toggleClass("active");
170		return false;
171	});
172
173	jQuery('.lightgallery').lightGallery({
174		thumbnail: true,
175		subHtmlSelectorRelative: true
176	});
177
178	jQuery('.lightgallery .gallery').lightGallery({
179		thumbnail: true,
180		subHtmlSelectorRelative: true
181	});
182});
183
184/* ----------------------------------------------------
185   SWIPER
186---------------------------------------------------- */
187var swiper = new Swiper('.bigslider', {
188	effect: 'slide',
189	loop: true,
190	navigation: {
191		nextEl: '.bigslider-next',
192		prevEl: '.bigslider-prev',
193	},
194	autoplay: {
195		delay: 4000,
196	},
197	pagination: {
198		el: '.swiper-pagination',
199		clickable: true,
200	},
201});
202
203/* ----------------------------------------------------
204   HEADER & LOADING
205---------------------------------------------------- */
206var getBodyActualWidth = function () {
207	jQuery("body").css("overflow", "hidden");
208	var ww = jQuery(window).width();
209	jQuery("body").css("overflow", "");
210	return ww;
211};
212
213var actualBodyWidth = 0;
214
215jQuery(window).load(function () {
216	actualBodyWidth = getBodyActualWidth();
217
218	jQuery(window).on("resize", function () {
219		actualBodyWidth = getBodyActualWidth();
220	});
221
222	var $header = jQuery("header");
223	$header.addClass("smaller");
224
225	jQuery(window).on("scroll", function () {
226		if (actualBodyWidth <= 800) {
227			$header.addClass("smaller");
228		} else {
229			var distanceY = jQuery(window).scrollTop();
230			(distanceY > 800) ? $header.addClass("smaller") : $header.removeClass("smaller");
231		}
232	});
233
234	jQuery(window).trigger("scroll");
235
236
237if (window.location.hash) {
238    var hash = document.location.hash.slice(1);
239    var target = jQuery('#' + hash);
240
241    if (target.length) {
242        jQuery('html, body').animate({
243            scrollTop: target.offset().top - 70
244        }, 1000);
245    }
246}
247
248});
249
250jQuery(window).load(function () {
251	jQuery("#loadingDiv").fadeOut();
252	jQuery("#wrapperDiv").fadeIn();
253});

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.