PageSourceSearch

https://haveyougot.com/assets/js/search.js?v=4

js haveyougot.com collected 2026-10-06 12:22:02 UTC 2,978 bytes, 113 lines download raw bytes

1var today = new Date();
2const urlParams = new URLSearchParams(window.location.search);
3
4const picker = new Litepicker({ 
5	element: document.getElementById('datePicker'),
6	singleMode: false,
7	minDate:  printDate(today),
8	maxDate: printDate(new Date(today.setFullYear(today.getFullYear() + 1))),
9	lockDays: [],
10	disallowLockDaysInRange: true,
11	minDays: 2,
12	numberOfMonths: 2,
13	numberOfColumns: 2,
14	format: "DD MMM YYYY",
15	startDate: urlParams.get('check_in'),
16	endDate: urlParams.get("check_out"),
17	resetButton: () => {
18		let btn = document.createElement('button');
19		btn.innerText = 'Clear';
20		btn.addEventListener('click', (evt) => {
21			evt.preventDefault();
22			$('#checkin').val("");
23			$('#checkout').val("");
24		});
25
26		return btn;
27	},
28	tooltipText: {
29		one: 'night',
30		other: 'nights'
31	},
32	tooltipNumber: (totalDays) => {
33		return totalDays - 1;
34	},
35	setup: (picker) => {
36		picker.on('render:day', (day,date) => {
37	        if(day.classList.contains('is-locked') )
38	            day.classList.add('line-through');
39	    });
40
41		picker.on('selected', (date1, date2) => {
42
43			if (!date1 || !date2)
44				return;
45
46			$('#checkin').val(printDate(date1));
47			$('#checkout').val(printDate(date2))
48		});
49	}
50});
51
52$(document).ready(function()
53{
54    $("#place").select2({
55        ajax: {
56            url: "/autocomplete",
57            dataType: 'json',
58            delay: 250,
59            placeholder: "Search destination",
60            data: function (params) {
61                return {
62                    q: params.term, // search term
63                };
64            },
65            processResults: function (data, params) {
66                params.page = params.page || 1;
67                return {
68                    results: data.items,
69                    pagination: {
70                        more: false
71                    }
72                };
73            },
74            cache: true
75        },
76        minimumInputLength: 2,
77    });
78
79    $('#place').on('select2:open', function() {
80        let select2SearchField = $('.select2-search__field');
81        select2SearchField[0].focus();
82    });
83
84    $("#place_destinations").select2({
85        ajax: {
86            url: "/autocomplete/destinations",
87            dataType: 'json',
88            delay: 250,
89            placeholder: "Search destinations",
90            data: function (params) {
91                return {
92                    q: params.term, // search term
93                };
94            },
95            processResults: function (data, params) {
96                params.page = params.page || 1;
97                return {
98                    results: data.items,
99                    pagination: {
100                        more: false
101                    }
102                };
103            },
104            cache: true
105        },
106        minimumInputLength: 2,
107    });
108
109    $('#place_destinations').on('select2:open', function() {
110        let select2SearchField = $('.select2-search__field');
111        select2SearchField[0].focus();
112    });
113});

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.