PageSourceSearch

https://motelplus-schoenefeld.de/js/functions.js

js motelplus-schoenefeld.de collected 2026-10-07 05:12:01 UTC 4,922 bytes, 147 lines download raw bytes

1(function($) {
2	$.fn.getRoomPrice = function() {
3		var elem = this;
4		var arrival = Math.floor(parseInt($.now()) / 1000);
5		var nights = 1;
6		var roid = $(elem).attr('data-rprc-roid');
7		var arrival_id = $(elem).attr('data-rprc-arrival-id');
8		var departure_id = $(elem).attr('data-rprc-departure-id');
9		var noavail = $(elem).attr('data-rprc-noavail');
10
11		$(elem)
12			.removeClass('rprc-noavail')
13			.addClass('rprc-loading');
14
15		if (typeof arrival_id !== 'undefined' && arrival_id !== false && $('#' + arrival_id).length) {
16			var arrivalDate = $.datepicker.parseDate('dd.mm.yy', $('#' + arrival_id).val());
17			var arrivalTime = arrivalDate.getTime();
18			arrival = Math.floor(parseInt(arrivalTime) / 1000);
19
20			if (typeof departure_id !== 'undefined' && departure_id !== false && $('#' + departure_id).length) {
21				var departureDate = $.datepicker.parseDate('dd.mm.yy', $('#' + departure_id).val());
22				var diff = new Date(departureDate - arrivalDate);
23				nights = Math.floor(diff / 1000 / 60 / 60 / 24);
24			}
25		}
26
27		if (typeof roid === 'undefined' || roid === false) {
28			roid = '';
29		}
30
31		$('.raum_ab').hide();
32		$('.raum_prozimmer').hide();
33
34		apiCall = $.ajax({
35			//Ajax request
36			type: 'POST',
37			url: '/index.php',
38			data: {
39				crsid: $('#prid').val(),
40				lng: $('html').attr('lang'),
41				arrival: arrival,
42				nights: nights,
43				roid: roid,
44				execute: 'ajaxCall',
45				do: 'getRoomPrice'
46			},
47			success: function(data) {
48				console.log(data);
49				if ((checkKey = 'price' in data)) {
50					var input_changed = false;
51
52					if ((checkKey = 'dates' in data)) {
53						var minDate = new Date((parseInt(data['dates']['arrival']) + 86400) * 1000);
54						var arrival = new Date(parseInt(data['dates']['arrival']) * 1000);
55						var departure = new Date(parseInt(data['dates']['departure']) * 1000);
56
57						if (typeof arrival_id !== 'undefined' && arrival_id !== false && $('#' + arrival_id).length) {
58							$('#' + arrival_id).datepicker('setDate', arrival);
59							input_changed = true;
60						}
61
62						if (typeof departure_id !== 'undefined' && departure_id !== false && $('#' + departure_id).length) {
63							$('#' + departure_id).datepicker('option', 'minDate', minDate);
64							$('#' + departure_id).datepicker('setDate', departure);
65							input_changed = true;
66						}
67
68						nights = Math.round(parseInt(data['dates']['departure']) - parseInt(data['dates']['arrival'])) / 86400;
69					}
70
71					var text_before = $(elem).attr('data-rprc-before');
72					if (typeof text_before === 'undefined' || text_before === false) {
73						text_before = '';
74					}
75
76					var text_after = $(elem).attr('data-rprc-after');
77					if (typeof text_after === 'undefined' || text_after === false) {
78						text_after = '';
79					}
80
81					if (input_changed) {
82						if ($('html').attr('lang') == 'de') {
83							text_after +=
84								' <div class="period_notavailable"><i>Zum von Ihnen gewählten Zeitraum ist dieses Zimmer leider nicht verfügbar. Wir haben für Sie automatisch den nächst möglichen Reisezeitraum ermittelt.</i></div>';
85						} else {
86							text_after +=
87								' <div class="period_notavailable"><i>Unfortunately this toom is not available for your chosen period. We have automatically changed the date to the next possible period.</i></div>';
88						}
89					}
90
91					var info = '';
92					if ($('html').attr('lang') == 'de') {
93						info += 'Preis im ' + data.room_name + ' für ';
94						if (parseInt(data.occupancy) > 1) {
95							info += data.occupancy + ' Personen (';
96						} else {
97							info += 'eine Person (';
98						}
99						if (parseInt(nights) > 1) {
100							info += nights + ' Nächte)';
101						} else {
102							info += '1 Nacht)';
103						}
104					} else {
105						info += 'Price ' + data.room_name + ' for ';
106						if (parseInt(data.occupancy) > 1) {
107							info += data.occupancy + ' persons (';
108						} else {
109							info += '1 person (';
110						}
111						if (parseInt(nights) > 1) {
112							info += nights + ' nights)';
113						} else {
114							info += '1 night)';
115						}
116					}
117
118					$('.raum_ab').show();
119					$('.raum_prozimmer').show();
120					console.log('1');
121					$(elem)
122						.html('<span>' + text_before + '</span>' + '<span>' + data.price.toFixed(2) + ' €</span>' + '<span>' + text_after + '</span>')
123						.attr('title', info)
124						.removeClass('rprc-loading');
125				} else {
126					$(elem)
127						.html(noavail)
128						.removeClass('rprc-loading')
129						.addClass('rprc-noavail');
130					console.log('2');
131				}
132
133				$('.period_notavailable').each(function() {
134					$('#motelplus').css({ padding: '40px' });
135				});
136			},
137			error: function(XMLHttpRequest, textStatus, errorThrown) {
138				$(elem)
139					.html(noavail)
140					.removeClass('rprc-loading')
141					.addClass('rprc-noavail');
142				console.log(textStatus);
143				console.log('3');
144			}
145		});
146	};
147})(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.