1// ðãã®1è¡ç®ããå§ããã®ããã¹ãï¼ 2(function() { 3 var css = ` 4 input[type="date"].holidaycheck::-webkit-calendar-picker-indicator { 5 opacity: 0 !important; 6 pointer-events: none !important; 7 }`; 8 var style = document.createElement('style'); 9 style.type = 'text/css'; 10 style.appendChild(document.createTextNode(css)); 11 document.head.appendChild(style); 12})(); 13 14 15jQuery(document).ready(function($) { 16 console.log('jQuery is ready'); 17 // æ¥ä»ããã«ã¼ããã¼ãããã¦ããã確èªããå¿ è¦ã«å¿ãã¦åæå 18 if ($.fn.datepicker) { 19 console.log('Datepicker is loaded'); 20 21 // #datepickerãåæå 22 if ($('#datepicker').length > 0 && !$('#datepicker').data('datepicker-initialized')) { 23 console.log('#datepicker found and initializing'); 24 $('#datepicker').datepicker({ 25 dateFormat: 'yy-mm-dd', // æ¥ä»å½¢å¼ãè¨å® 26 onSelect: function(dateText) { 27 console.log('Selected date from #datepicker:', dateText); 28 } 29 }); 30 $('#datepicker').data('datepicker-initialized', true); 31 } else { 32 console.log('#datepicker not found or already initialized'); 33 } 34 35 // .datepickerã¯ã©ã¹ãæã¤è¦ç´ ãåæå 36 $('[class*="datepicker"]').each(function() { 37 var $input = $(this); 38 if (!$input.hasClass('holidaycheck') && !$input.data('datepicker-initialized')) { 39 console.log('.datepicker found and initializing:', $input); 40 $input.datepicker({ 41 dateFormat: 'yy-mm-dd', // æ¥ä»å½¢å¼ãè¨å® 42 onSelect: function(dateText) { 43 console.log('Selected date from .datepicker:', dateText); 44 } 45 }); 46 $input.data('datepicker-initialized', true); 47 } else { 48 console.log('.datepicker not found or already initialized:', $input); 49 } 50 }); 51 52 // .holidaycheckã¯ã©ã¹ãæã¤è¦ç´ ãåæå 53 $('[class*="holidaycheck"]').each(function() { 54 var $input = $(this); 55 var classList = $input.attr('class').split(/\s+/); 56 var daysFromNow = 0; 57 58 // ã¯ã©ã¹åããæ°åãåå¾ 59 classList.forEach(function(className) { 60 var match = className.match(/^holidaycheck(\d+)$/); 61 if (match) { 62 daysFromNow = parseInt(match[1], 10); 63 } 64 }); 65 66 if (!$input.data('datepicker-initialized')) { 67 console.log('.holidaycheck found and initializing:', $input); 68 $.ajax({ 69 url: holidayCheckParams.ajax_url, 70 method: 'POST', 71 data: { 72 action: 'get_holiday_settings' 73 }, 74 success: function(response) { 75 console.log('Holiday settings received:', response); 76 var holidays = JSON.parse(response); 77 var weekdays = holidays.weekdays; 78 var dates = holidays.dates; 79 80 $input.datepicker({ 81 dateFormat: 'yy-mm-dd', // æ¥ä»å½¢å¼ãè¨å® 82 minDate: daysFromNow, // æå®æ¥ä»¥éãã鏿å¯è½ 83 beforeShowDay: function(date) { 84 var day = date.getDay(); 85 var dayOfMonth = $.datepicker.formatDate('yy-mm-dd', date); 86 87 // ææ¥ãç¡å¹å 88 if (weekdays.includes(day.toString())) { 89 return [false, '', 'Unavailable']; 90 } 91 92 // ç¹å®ã®æ¥ä»ãç¡å¹å 93 if (dates.includes(dayOfMonth)) { 94 return [false, '', 'Unavailable']; 95 } 96 97 return [true, '', '']; 98 }, 99 onSelect: function(dateText) { 100 console.log('Selected date from .holidaycheck:', dateText); 101 // 鏿ããæ¥ä»ãinputã«è¨å® 102 $(this).val(dateText); 103 } 104 }); 105 $input.data('datepicker-initialized', true); 106 }, 107 error: function(jqXHR, textStatus, errorThrown) { 108 console.log('Error fetching holiday settings:', textStatus, errorThrown); 109 } 110 }); 111 } else { 112 console.log('.holidaycheck not found or already initialized:', $input); 113 } 114 }); 115 } else { 116 console.log('Datepicker is not loaded'); 117 } 118}); 119 120document.addEventListener('DOMContentLoaded', function() { 121 console.log('DOM fully loaded and parsed'); 122 if (document.querySelectorAll('input.holidaycheck').length > 0) { 123 console.log('Adding CSS to hide HTML5 calendar icon'); 124 var style = document.createElement('style'); 125 style.innerHTML = ` 126 input[type="date"].holidaycheck::-webkit-calendar-picker-indicator { 127 opacity: 0; 128 pointer-events: none; 129 } 130 `; 131 document.head.appendChild(style); 132 } 133});
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.