1jQuery( document ).ready( 2 function ($) { 3 $( ".span-month" ).hide(); 4 $( ".span-year" ).hide(); 5 const monthNames = ["January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December"]; 6 month = jQuery( ".callender-month" ).val(); 7 year = jQuery( ".callender-year" ).val(); 8 month = get_month( month ); 9 date = year + "-" + month + "-02"; 10 // date= "2019-11-01"; 11 current_date = new Date( date ); 12 var offset = new Date().getTimezoneOffset(); 13 offset = offset == 0 ? 0 : -offset; 14 var new_date = new Date( current_date.getTime() - ((offset) * 60000) ); 15 current_date = new_date 16 17 next_year = new Date( current_date.getFullYear() + parseInt( 2 ), current_date.getMonth(),current_date.getDate() ); 18 // alert(next_year); 19 html = ''; 20 21 while (current_date <= next_year) { 22 // console.log(current_date); 23 html += "<option data-month='" + monthNames[current_date.getMonth()] + "' data-year='" + current_date.getFullYear() + "' value='" + monthNames[current_date.getMonth()] + "-" + current_date.getFullYear() + "'>" + ph_booking_month_picker_date.months[current_date.getMonth()] + " " + current_date.getFullYear() + "</option>"; 24 25 current_date = new Date( current_date.getFullYear() , current_date.getMonth() + parseInt( 1 ),current_date.getDate() ); 26 } 27 $( '.month-year-wraper' ).append( "<select style='text-transform: uppercase;'' class='booking_month' id='booking_month'>" + html + "</slecet>" ); 28 $( ".booking_month" ).change( 29 function () { 30 31 ph_current_month = new Date().toLocaleString( 'en-US', { month: 'long' } ); 32 ph_current_year = new Date().getFullYear(); 33 // alert(jQuery(this).find(':selected').attr('data-month')); 34 // jQuery( ".callender-month" ).val(jQuery(this).find(':selected').attr('data-month')); 35 // jQuery( ".callender-year" ).val(jQuery(this).find(':selected').attr('data-year')); 36 year = jQuery( this ).find( ':selected' ).attr( 'data-year' ); 37 month = jQuery( this ).find( ':selected' ).attr( 'data-month' ); 38 month = get_month( month ); 39 // 106328 40 monthNumber = month; 41 date = year + "-" + month + "-02"; 42 date = new Date( date ); 43 44 var offset = new Date().getTimezoneOffset(); 45 offset = offset == 0 ? 0 : -offset; 46 var new_date = new Date( date.getTime() - ((offset) * 60000) ); 47 date = new_date 48 // console.log(" new "+date); 49 previous_month = new Date( date.getFullYear() , date.getMonth() - parseInt( 1 ),date.getDate() ); 50 // return false; 51 // resetSelection() // The plugin is not supports to select backward. 52 product_id = jQuery( "#phive_product_id" ).val(); 53 month = jQuery( ".callender-month" ).val(); 54 year = jQuery( ".callender-year" ).val(); 55 month = monthNames[previous_month.getMonth()]; 56 year = previous_month.getFullYear(); 57 calender_type = jQuery( "#calender_type" ).val(); 58 if (calender_type == 'time') { 59 calendar_for = 'time-picker'; 60 } else if (calender_type == 'date' ) { 61 calendar_for = 'date-picker'; 62 } else { 63 calendar_for = ''; 64 } 65 var data = { 66 action: 'phive_get_callender_next_month', 67 // security : phive_booking_locale.security, 68 product_id: product_id, 69 month: month, 70 year: year, 71 calendar_for:calendar_for, 72 asset: $( ".input-assets" ).val(), 73 }; 74 75 $( "#ph-calendar-overlay" ).show(); 76 77 $.post( 78 ph_booking_month_picker_date.ajaxurl, 79 data, 80 function (res) { 81 $( "#ph-calendar-overlay" ).hide(); 82 if (calender_type == 'time') { 83 $( "#ph-calendar-time" ).html( '<center>' + ph_booking_month_picker_date.Please_Pick_a_Date + '</center>' ); 84 } 85 86 result = jQuery.parseJSON( res ); 87 88 $( "#ph-calendar-days" ).html( result.days ); 89 90 jQuery( ".callender-month" ).val( result.month ); 91 jQuery( ".callender-year" ).val( result.year ); 92 93 if ( (result.month == ph_current_month) && (result.year == ph_current_year) ) { 94 95 jQuery( ".ph-prev" ).hide(); 96 } else { 97 98 jQuery( ".ph-prev" ).show(); 99 } 100 101 // Month text not translatin in arabic language for polylang 192179 102 if (result.display_month) { 103 jQuery( ".span-month" ).html( result.display_month ); 104 } else { 105 jQuery( ".span-month" ).html( ph_booking_month_picker_date.months[monthNames.indexOf( result.month )] ) 106 } 107 jQuery( ".span-year" ).html( result.display_year ) 108 block_unavailable_dates(); 109 110 // override_deactive_by_charge_by_night(); 111 112 // 106328 113 if ((jQuery( '.ph-date-from' ).val() != '') && $( '#charge_per_night' ).val() == 'yes') { 114 ph_date_from = jQuery( '.ph-date-from' ).val(); 115 var isSafari = /constructor/i.test( window.HTMLElement ) || (function (p) { 116 return p.toString() === "[object SafariRemoteNotification]"; })( ! window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification) ); 117 var isIE = /*@cc_on!@*/false || ! ! document.documentMode; 118 if (isSafari || isIE) { 119 date_and_time_from = ph_date_from.split( " " ); 120 date_form = date_and_time_from[0].split( "-" ); 121 ph_date_from = date_form[1] + "/" + date_form[2] + "/" + date_form[0]; 122 } 123 ph_date_from = new Date( ph_date_from ); 124 ph_date_from_month = (ph_date_from.getMonth() + 1); 125 if ((ph_date_from_month + 1) == monthNumber) { 126 elem = $( 'li.ph-calendar-date.de-active' ).first(); 127 if (is_overridable_by_charge_per_night( $( elem ) )) { 128 $( elem ).addClass( "can-be-checkout-date" ); 129 // added_class = true; 130 } 131 } 132 } 133 134 } 135 ); 136 } 137 ) 138 $( '.callender-month' ).change( 139 function () {
140 month = $( '.callender-month' ).val(); 141 year = $( '.callender-year' ).val(); 142 143 old_month = jQuery( '.booking_month' ).find( ':selected' ).attr( 'data-month' ); 144 // alert(old_month); 145 if (month == 'December' && old_month == 'January') { 146 year = parseInt( year ) - 1; 147 } else if (old_month == 'December' && month == 'January') { 148 year = parseInt( year ) + 1; 149 } 150 // alert(month+"-"+year); 151 $( '.booking_month' ).val( month + "-" + year ); 152 // $('.booking_month').each(function(){ 153 154 // }); 155 } 156 ); 157 158 function block_unavailable_dates() { 159 if (jQuery( '#calender_type' ).val() == 'time') { 160 product_id = jQuery( "#phive_product_id" ).val(); 161 start_date = jQuery( ".callender-full-date" ).first().val(); 162 var data = { 163 action: 'phive_get_blocked_dates', 164 product_id: product_id, 165 start_date: start_date, 166 asset: $( ".input-assets" ).val(), 167 }; 168 // $(".ph-calendar-overlay").show(); 169 $.post( 170 ph_booking_month_picker_date.ajaxurl, 171 data, 172 function (res) { 173 // console.log('success'); 174 result = jQuery.parseJSON( res ); 175 console.log( result ); 176 $.each( 177 result, 178 function (key, value) { 179 first_el = $( "input[value='" + value + "']" ).closest( "li.ph-calendar-date" ); 180 first_el.addClass( 'de-active' ); 181 first_el.addClass( 'not-available' ); 182 } 183 ); 184 // $(".ph-calendar-overlay").hide(); 185 } 186 ).fail( 187 function () { 188 console.log( 'failed' ); 189 // $(".ph-calendar-overlay").hide(); 190 } 191 ); 192 } 193 } 194 195 // 106328 196 function is_overridable_by_charge_per_night(el) { 197 198 if ($( '#calender_type' ).val() == 'date' && $( "#book_interval_type" ).val() != 'fixed' && $( '#charge_per_night' ).length && $( '#charge_per_night' ).val() == 'yes') { 199 prev = el.prev( '.ph-calendar-date' ); 200 if ( ! prev.hasClass( "booking-full" ) && ! prev.hasClass( "booking-disabled" ) && ! prev.hasClass( "de-active" )) { 201 // Override only for TO date 202 if (($( ".selected-date" ).length ) || (jQuery( '.ph-date-from' ).val() != '')) { 203 return true; 204 } 205 } 206 } 207 return false; 208 } 209 } 210); 211function get_month(month) 212{ 213 var monthArray = new Array(); 214 monthArray["January"] = "01"; 215 monthArray["February"] = "02"; 216 monthArray["March"] = "03"; 217 monthArray["April"] = "04"; 218 monthArray["May"] = "05"; 219 monthArray["June"] = "06"; 220 monthArray["July"] = "07"; 221 monthArray["August"] = "08"; 222 monthArray["September"] = "09"; 223 monthArray["October"] = "10"; 224 monthArray["November"] = "11"; 225 monthArray["December"] = "12"; 226 return monthArray[month]; 227 228}
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.