PageSourceSearch

https://www.efachagor.gr/wp-content/themes/efaxagor/js/pikaday-settings.js?ver=1790244223

js efachagor.gr collected 2026-09-24 10:04:37 UTC 4,976 bytes, 127 lines download raw bytes

1var pikadayElement = document.getElementById("calendar-container");
2if(pikadayElement != null) {
3    // Builds two pikaDay calendars and uses the startRange and endRange functions
4    // Pikaday is a Lightweight and dependency free datepicker
5    // https://github.com/Pikaday/Pikaday
6    this.buildDatePicker = (startInput, endInput) => {
7        const container = document.getElementById('calendar-container');
8        const minDate = new Date();
9        minDate.setHours(0, 0, 0, 0);
10        
11        const htmlTag = document.querySelector('html');
12        let currentLang = htmlTag.getAttribute('lang');
13        let monthsi18n = ['January','February','March','April','May','June','July','August','September','October','November','December'];
14        let weekdaysi18n = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
15        let weekdaysShorti18n = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
16        if(currentLang == 'el') {
17            monthsi18n = ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος','Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'];
18            weekdaysi18n = ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο']; 
19            weekdaysShorti18n = ['Κυρ','Δευτέρα','Τρί','Τετ','Πέμ','Παρ','Σάββ'];
20        }
21
22        this.startPicker = new Pikaday({
23            bound: false,
24            container: container,
25            field: startInput,
26            firstDay: 1,
27            theme: 'calendar__start-wrapper',
28            // minDate: minDate,
29            i18n: {
30                months : monthsi18n,
31                weekdays : weekdaysi18n,
32                weekdaysShort : weekdaysShorti18n
33            },
34            onSelect: () => {
35                this.updateStartDate(this.startPicker.getDate());
36            }
37        });
38
39        this.endPicker = new Pikaday({
40            bound: false,
41            container: container,
42            field: endInput,
43            firstDay: 1,
44            theme: 'calendar__end-wrapper',
45            // minDate: minDate,
46            i18n: {
47                months : monthsi18n,
48                weekdays : weekdaysi18n,
49                weekdaysShort : weekdaysShorti18n
50            },
51            onSelect: () => {
52            this.updateEndDate(this.endPicker.getDate());
53            } 
54        });
55
56        this.endPicker.hide();
57        this.bindReset(startInput, endInput);
58        this.bindMouseMove(endInput, container);
59    };
60
61    this.updateStartDate = selectedDate => {
62        this.startPicker.hide();
63        this.endPicker.setMinDate(selectedDate);
64        this.endPicker.setStartRange(selectedDate);
65        this.endPicker.gotoDate(selectedDate);
66        this.setEndRange(selectedDate);
67        this.endPicker.show();
68    };
69
70    this.updateEndDate = selectedDate => {
71        this.endDate = new Date(selectedDate);
72        // console.log('set end date');
73        // console.log(selectedDate);
74        this.setEndRange(selectedDate);
75        document.getElementById('calendar-clear').style.display = 'block';
76    };
77
78    this.setEndRange = endDate => {
79        this.endPicker.setEndRange(endDate);
80        this.endPicker.draw();
81    };
82
83    this.bindReset = (startInput, endInput) => {
84        const reset = document.getElementById('calendar-clear');
85        reset.addEventListener('click', event => {
86            event.preventDefault();
87
88            this.endPicker.setDate(null);
89            this.updateEndDate(null);
90            endInput.value = null;
91
92            this.startPicker.setDate(null);
93            this.updateStartDate(null);
94            this.startPicker.gotoDate(new Date());
95            startInput.value = null;
96
97            this.endPicker.hide();
98            this.startPicker.show();
99            document.getElementById('calendar-clear').style.display = 'none';
100        });
101    };
102
103    this.bindMouseMove = (endInput, container) => {
104    this.target = false;
105
106    document.querySelector('body').addEventListener('mousemove', btn => {
107        if (!btn.target.classList.contains('pika-button')) {
108        if (this.target === true) {
109            this.target = false;
110            this.setEndRange(this.endPicker.getDate());
111        }
112        } else
113
114        {
115        this.target = true;
116        const pikaBtn = btn.target;
117        const pikaDate = new Date(pikaBtn.getAttribute('data-pika-year'), pikaBtn.getAttribute('data-pika-month'), pikaBtn.getAttribute('data-pika-day'));
118        this.setEndRange(pikaDate);
119        }
120    });
121    };
122
123    const start = document.getElementById('calendar-start');
124    const end = document.getElementById('calendar-end');
125
126    this.buildDatePicker(start, end);
127}

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.