PageSourceSearch

https://honarmand.org/wp-content/plugins/elementor-pro/megatheme/i…/assets/js/persian-datepicker-loader.js

js honarmand.org collected 2026-10-03 02:58:00 UTC 4,405 bytes, 129 lines download raw bytes

1jQuery(document).ready(function ($) {
2    $(document).on('click', '.shamsi_due_date input',function() {
3        let value = $("input.elementor-date-time-picker.flatpickr.elementor-control-tag-area.flatpickr-input");
4        $(this).pDatepicker({
5            format: 'YYYY-MM-DD HH:mm',
6            autoClose: true,
7            timePicker: {
8                enabled: true
9            },
10            formatter: function (unix) {
11                let date = new Date(unix);
12
13                let year = date.getFullYear();
14                let month = ('0' + (date.getMonth() + 1)).slice(-2);
15                let day = ('0' + date.getDate()).slice(-2);
16                let hours = ('0' + date.getHours()).slice(-2);
17                let minutes = ('0' + date.getMinutes()).slice(-2);
18
19                let formattedDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes;
20
21                let element = document.getElementById(value.attr("id"));
22
23                if (element) {
24                    element.value = formattedDate;
25                    // Create a new 'input' event
26                    let event = new Event('input', {
27                        bubbles: true,
28                        cancelable: true,
29                    });
30
31                    // Dispatch the event
32                    element.dispatchEvent(event);
33                } else {
34                    console.log('Element not found!');
35                }
36
37                return formattedDate;
38            }
39        });
40    });
41    let flt = $('.elementor-date-time-picker');
42    setTimeout(function () {
43        $(".flatpickr-calendar").remove();
44    },2000)
45    setTimeout(function () {
46        $(".flatpickr-calendar").remove();
47    },1000)
48    if (!flt.hasClass('elementor-persian-date')) {
49        $(".flatpickr-calendar").remove();
50        $('#flatpickr-css').remove();
51        $('#flatpickr-js').remove();
52        flt.pDatepicker({
53            format: 'YYYY-MM-DD HH:mm',
54            autoClose: true,
55            timePicker: {
56                enabled: true
57            },
58            formatter: function (unix) {
59                console.log(unix)
60                let date = new Date(unix);
61
62                let year = date.getFullYear();
63                let month = ('0' + (date.getMonth() + 1)).slice(-2);
64                let day = ('0' + date.getDate()).slice(-2);
65                let hours = ('0' + date.getHours()).slice(-2);
66                let minutes = ('0' + date.getMinutes()).slice(-2);
67
68                let formattedDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes;
69
70                return formattedDate;
71            }
72        });
73    }
74    $(document).on('click','.elementor-persian-datepicker-editor,.elementor-persian-date',function () {
75        $('.flatpickr-calendar').removeClass('open');
76        let options = {
77            format: "YYYY-MM-DD",
78            initialValue: true,
79            autoClose: true,
80
81        };
82
83        if ($(this).is('[min]')) {
84            let dateString = $(this).attr('min');
85            options.minDate = Date.parse(dateString);
86            console.log(options.minDate);
87        }
88
89        if ($(this).is('[max]')) {
90            let dateString = $(this).attr('max');
91            options.maxDate = Date.parse(dateString);
92            console.log(options.maxDate);
93        }
94
95        $(this).pDatepicker(options);
96        $(".flatpickr-calendar").remove();
97        $('#flatpickr-css').remove();
98        $('#flatpickr-js').remove();
99    });
100
101    let pdatepicker = $('.elementor-persian-date');
102
103    if (pdatepicker.length) {
104        let options = {
105            format: "YYYY-MM-DD",
106            initialValue: true,
107            autoClose: true,
108
109        };
110
111        if (pdatepicker.is('[min]')) {
112            let dateString = pdatepicker.attr('min');
113            options.minDate = Date.parse(dateString);
114            console.log(options.minDate);
115        }
116
117        if (pdatepicker.is('[max]')) {
118            let dateString = pdatepicker.attr('max');
119            options.maxDate = Date.parse(dateString);
120            console.log(options.maxDate);
121        }
122
123        pdatepicker.pDatepicker(options);
124        $(".flatpickr-calendar").remove();
125        $('#flatpickr-css').remove();
126        $('#flatpickr-js').remove();
127    }
128});
129

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.