PageSourceSearch

https://herzliya-marina.co.il/wp-content/plugins/blog-post-calendar-widget/js/wp_calendar.js?v1&ver=1

js herzliya-marina.co.il collected 2026-10-02 06:29:39 UTC 9,742 bytes, 229 lines download raw bytes

1var wp_cal_dates = new Array();
2var wp_cal_posts = new Array();
3var wp_cal_link = '';
4var finish = true;
5
6function WP_Cal_open_link(lnk) {
7    document.location.href = lnk;
8}
9
10function WP_Cal_convertMonth(month) {
11    var m = new Array(7);
12    m["01"] = 1;
13    m["02"] = 2;
14    m["03"] = 3;
15    m["04"] = 4;
16    m["05"] = 5;
17    m["06"] = 6;
18    m["07"] = 7;
19    m["08"] = 8;
20    m["09"] = 9;
21    m["10"] = 10;
22    m["11"] = 11;
23    m["12"] = 12;
24    return m[month];
25}
26
27
28jQuery(document).ready(function(){
29    jQuery('#wp-calendar').datepicker({dateFormat: "yy-mm-dd"});
30    jQuery('#wp-calendar a.ui-state-active').addClass('wp-calendar-current-date').parent('td').addClass('wp-calendar-today-active');
31
32    function clickEvent(elm){
33        if(finish){
34            finish = false;
35            jQuery('.WP-Cal-popup.current').removeClass('current');
36            jQuery(elm).addClass('current');
37
38            jQuery('.wp_calendar .post.active')
39                .fadeOut(500,function(){
40                    jQuery(this).removeClass('active')
41                })
42                .promise()
43                .done(function() {
44                    var selected = jQuery(elm).attr('id');
45                    jQuery('[data-post-display='+selected+']').fadeIn(function(){
46                        jQuery(this).addClass('active');
47                        finish = true;
48                    });
49
50                });
51        }
52
53    }
54    function WP_Cal_get_posts_by_month( month, year){
55        var check_date = month+'-'+year;
56
57            jQuery(".wp_calendar .calendar_wrap_loading").removeClass('calendar_wrap_loading_hide').addClass('calendar_wrap_loading_show');
58            jQuery(".wp_calendar .calendar_wrap_loading").css( "top", "-" + (jQuery('#calendar_wrap table.wp-cal-datepicker-calendar').height() - 1) + "px" );
59            jQuery('#wp-calendar .ui-datepicker-prev').toggle();
60            jQuery('#wp-calendar .ui-datepicker-next').toggle();
61
62            jQuery('#calendar_wrap .calendar-pagi a').each(function(){
63                jQuery(this).removeClass('pagi_state_show').toggle();
64            });
65            
66            wp_cal_dates.push(check_date);
67            jQuery.ajax({
68                type    :   'POST',
69                url     :   wpCalendarObj.ajaxurl,
70                data    :   {
71                    action          :   'wp_calendar_get_posts',
72                    ajax            :   'true',
73                    post            :   wpCalendarObj.wpCalPostname,
74                    future          :   wpCalendarObj.future,
75                    author          :   wpCalendarObj.author,
76                    comment_count   :   wpCalendarObj.comment_count,
77                    taxonomy        :   wpCalendarObj.taxonomy,
78                    term            :   wpCalendarObj.term,
79                    month           :   month,
80                    year            :   year
81                },
82                success :   function( data ){
83                    data = jQuery.parseJSON( data );
84
85                    /* Display */
86                    var posts_display = data.display;
87                    jQuery('#display-posts').html("");
88                    if( posts_display != null){
89
90                        var today = new Date();
91                        var dd = today.getDate();
92                        dd = dd < 10 ? '0' + dd : '' + dd;
93                        var mm = today.getMonth()+1;
94                        mm = mm < 10 ? '0' + mm : '' + mm;
95                        var yyyy = today.getFullYear();
96                        var this_date = yyyy + '-' + mm + '-' + dd;
97                        var found_current = false;
98
99                        jQuery.each( posts_display, function (key , value){
100                            var html = jQuery.parseHTML( value );
101
102                            if(this_date == key){
103                                html = jQuery(html).addClass('active');
104                                jQuery('.ui-datepicker-today').addClass('current');
105                                found_current = true;
106                            }
107                            jQuery('#display-posts').append(html);
108                        });
109                        jQuery('.carousel').carousel({
110                            interval: false
111                        });
112
113
114
115                    }
116
117
118                    /* Calendar */
119                    var posts = data.posts;
120                    var this_dates = data.classes;
121                    var curr_date = new Array();
122                    var d = '';
123                    jQuery.each( this_dates, function (key , value){
124                        curr_date = key.split('-');
125                        d = curr_date[2];
126                        d = d < 10 ? d.slice(1) : d;
127                        var element = jQuery('#wp-calendar a.ui-state-default:contains("'+d+'")');
128                        if( element.length > 1 ){
129                            jQuery(element).each( function(){
130                                if( jQuery( this ).text() == d ){
131                                    jQuery( this ).parent('td').addClass('WP-Cal-popup');
132                                    jQuery( this ).parent('td').attr('id',key);
133                                    jQuery( this ).parent('td').find('a').attr('aria-describedby',key);
134                                }
135                                
136                            });
137                            
138                        }
139                        else{
140                            jQuery( element ).parent('td').addClass('WP-Cal-popup');
141                            jQuery( element ).parent('td').attr('id',key);
142                            jQuery( element ).parent('td').find('a').attr('aria-describedby',key);
143                        }
144                    });
145                    jQuery('#wp-calendar .WP-Cal-popup').each( function (){
146                        var year = jQuery(this).attr('data-year');
147                        var month = jQuery(this).attr('data-month');
148                        month = parseInt( month ) + 1;
149                        var day = jQuery(this).find('a.ui-state-default').text();
150                        var this_date = year + '-' + month + '-' + day;
151//                        var innerContent = posts[this_date];
152//                        jQuery(this).append( '<div class="wp-cal-tooltip">'+innerContent+'</div>' );
153                    });
154                    var new_data_element = {
155                        month : check_date,
156                        classes : this_dates,
157                        posts : posts
158                    };
159                    wp_cal_posts.push( new_data_element );
160
161                    
162
163                    if(!found_current){
164                        jQuery('.wp-calendar-today-active').first().addClass('current');
165                        var selected = (jQuery('.wp-calendar-today-active.current').attr('id'));
166                        jQuery('[data-post-display='+selected+']').addClass('active');
167                        jQuery('.box-responsiv .post').each(function(){
168                            
169                            var ids= jQuery(this).attr('data-post-display');
170                            jQuery(this).find('.item').attr('id','item-'+ids);
171                        });
172                    }
173
174                    jQuery('.WP-Cal-popup').click(function(e){
175                        e.preventDefault();
176                        clickEvent(this);
177                    });
178//                    jQuery('.WP-Cal-popup').bind('click',clickEvent);
179
180                    setTimeout(function(){
181                        jQuery('a.ui-state-default').attr('tabindex', '-1');
182                        jQuery('.WP-Cal-popup a.ui-state-default').attr('tabindex', '0');
183                        console.log( jQuery('a.ui-state-default').attr('tabindex'), jQuery('.WP-Cal-popup a.ui-state-default') );
184                    }, 3100);
185
186                },
187                complete: function() {
188
189                    jQuery('.ui-datepicker-next, .ui-datepicker-prev, .wp-cal-prev, .wp-cal-next').bind('click');
190                    
191                    jQuery(".wp_calendar .calendar_wrap_loading").removeClass('calendar_wrap_loading_show').addClass('calendar_wrap_loading_hide');
192                    jQuery('#wp-calendar .ui-datepicker-prev').toggle();
193                    jQuery('#wp-calendar .ui-datepicker-next').toggle();
194                    jQuery('#calendar_wrap .calendar-pagi a').each(function(){
195                        jQuery(this).removeClass("pagi_state_hide").toggle();
196                    });
197                    jQuery('.calendar-container,.posts-container').toggle();
198
199                    jQuery('#display-posts').height(jQuery('.calendar-container').height());
200                    
201                    
202                }
203            });
204    }
205
206    jQuery('.ui-datepicker-next, .ui-datepicker-prev, .wp-cal-prev, .wp-cal-next').live('click', function (){
207        jQuery('.calendar-container,.posts-container').toggle(); 
208        
209        var Month = jQuery('#wp-calendar .ui-datepicker-month #monthnum').val();
210        Month = Month < 10 ? '0' + Month : '' + Month;
211        var Year = jQuery('#wp-calendar .ui-datepicker-year').text(); //alert(Month);
212//        Month = WP_Cal_convertMonth(Month); //alert(Month);
213        WP_Cal_get_posts_by_month( Month, Year );
214    });
215
216    function getMonth(date) {
217        var month = date.getMonth() + 1;
218        return month < 10 ? '0' + month : '' + month; // ('' + month) for string result
219    }
220
221    //(parseInt(c_date.getMonth()) + 1);
222    var c_date = new Date();
223    c_month = getMonth(c_date);
224    c_year = c_date.getFullYear();
225   
226    WP_Cal_get_posts_by_month(c_month, c_year);
227
228
229});

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.