1jQuery( function( $ ) { 2 3 var $widget_wrapper = $( '.tribe-mini-calendar-wrapper' ).parent(); 4 5 function fix_widget_height() { 6 var wrapper = $( '.tribe-mini-calendar-wrapper' ); 7 if ( $( '.tribe-mini-calendar-wrapper.layout-wide' ).length && $( '.tribe-mini-calendar-right' ).length ) { 8 var right_bar = $( '.tribe-mini-calendar-right' ); 9 var w_height = wrapper.height(); 10 var rb_height = right_bar.outerHeight(); 11 rb_height = rb_height + 20; 12 13 if ( rb_height > w_height ) { 14 wrapper.css( 'height', rb_height + 'px' ); 15 } 16 else { 17 wrapper.css( 'height', 'auto' ); 18 } 19 } 20 else if ( $( '.tribe-mini-calendar-wrapper.layout-wide' ).length ) { 21 wrapper.css( 'height', 'auto' ); 22 } 23 } 24 25 function change_active_day( obj ) { 26 var $calendar = obj.closest( '.tribe-mini-calendar' ); 27 $calendar.find( '.tribe-events-thismonth,.tribe-events-othermonth' ).removeClass( 'tribe-mini-calendar-today' ); 28 obj.parents( '.tribe-events-has-events' ).addClass( 'tribe-mini-calendar-today' ); 29 } 30 31 32 fix_widget_height(); 33 34 35 var date = new Date(), 36 day = date.getDate().toString(), 37 month = (date.getMonth() + 1).toString(), 38 year = date.getFullYear().toString(), 39 current = year + '-' + (month[1] ? month : '0' + month[0]) + '-' + (day[1] ? day : '0' + day[0]), 40 current_ym = current.slice( 0, 7 ); 41 42 $widget_wrapper 43 .on( 'click', '.tribe-mini-calendar-nav-link', function( e ) { 44 console.log('events-customize-changes >> widget-calendar-1.js'); //WPB-4249 45 e.preventDefault(); 46 47 var $this = $( this ); 48 49 var $current_calendar = $this.closest( '.tribe-mini-calendar' ); 50 var $current_calendar_wrapper = $this.closest( '.tribe-mini-calendar-wrapper' ); 51 52 var month_target = $this.attr( 'data-month' ), 53 target_ym = month_target.slice( 0, 7 ); 54 55 if ( current_ym == target_ym ) { 56 month_target = current; 57 } 58 59 var params = { 60 action : 'tribe-mini-cal', 61 eventDate: month_target, 62 count : $current_calendar.data( 'count' ), 63 tax_query: $current_calendar.data( 'tax-query' ), 64 nonce : $current_calendar.data( 'nonce' ) 65 }; 66 $current_calendar.find( '.tribe-mini-calendar-nav div > span' ).addClass( 'active' ).siblings( '#ajax-loading-mini' ).show(); 67 68 $.post( 69 TribeMiniCalendar.ajaxurl, 70 params, 71 function( response ) { 72 $current_calendar.find( '.tribe-mini-calendar-list-wrapper' ).remove(); 73 if ( response.success ) { 74 var $the_content = $.parseHTML( response.html ); 75 $current_calendar.find( '.tribe-mini-calendar-nav div > span' ).removeClass( 'active' ).siblings( '#ajax-loading-mini' ).hide(); 76 $current_calendar_wrapper.replaceWith( $the_content ); 77 fix_widget_height(); 78 } 79 } 80 ); 81 } ) 82 .on( 'click', '.tribe-mini-calendar-day-link', function( e ) { 83 e.preventDefault(); 84 var $this = $( this ); 85 var date = $this.attr( 'data-day' ); 86 var day = $this.text(); 87 var $current_calendar = $this.closest( '.tribe-mini-calendar' ); 88 var $current_calendar_events_list = $current_calendar.parent().siblings( '.tribe-mini-calendar-list-wrapper' ); 89 90 $( 'h2.tribe-mini-calendar-title' ).text( $( '#tribe-mini-calendar-month-name' ).val() + ' ' + day + ' Events' ); 91 change_active_day( $this ); 92 var params = { 93 action : 'tribe-mini-cal-day', 94 eventDate: date, 95 count : $current_calendar.data( 'count' ), 96 tax_query: $current_calendar.data( 'tax-query' ), 97 nonce : $current_calendar.data( 'nonce' ) 98 }; 99 100 $current_calendar.find( '.tribe-mini-calendar-nav div > span' ).addClass( 'active' ).siblings( '#ajax-loading-mini' ).show(); 101 $.post( 102 TribeMiniCalendar.ajaxurl, 103 params, 104 function( response ) { 105 if ( response.success ) { 106 var $the_content = ''; 107 if ( 'function' === typeof $.fn.parseHTML ) { 108 $the_content = $.parseHTML( response.html ); 109 } 110 else { 111 $the_content = response.html; 112 } 113 $current_calendar.find( '.tribe-mini-calendar-nav div > span' ).removeClass( 'active' ).siblings( '#ajax-loading-mini' ).hide(); 114 $current_calendar_events_list.replaceWith( $the_content ); 115 fix_widget_height(); 116 } 117 } 118 ); 119 } ); 120} );
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.