1// JavaScript Document 2function getCalendarDetailAll() { 3 var formData = new FormData($('#myCalendarForm')[0]) 4 var path = $('base').attr('href') + base_url_lang 5 $.ajax({ 6 url: path + '/calendar/load-calendar-list', 7 type: 'POST', 8 success: function (data) { 9 jQuery('#calendarList').show() 10 // jQuery("#calendarList").html(data); 11 safeHtml('#calendarList', data) 12 }, 13 data: formData, 14 cache: false, 15 contentType: false, 16 processData: false 17 }) 18} 19 20function GetCalendar() { 21 var formData = new FormData($('#myCalendarForm')[0]) 22 var path = $('base').attr('href') + base_url_lang 23 // console.log(path); 24 $.ajax({ 25 url: path + '/calendar/load-calendar', 26 type: 'POST', 27 success: function (data) { 28 // console.log(data); 29 jQuery('#calendar').show() 30 // jQuery('#calendar').html(data) 31 safeHtml('#calendar', data) 32 getCalendarDetailAll() 33 $('.select-control.select-year').select2({ 34 theme: 'option-year', 35 minimumResultsForSearch: -1 36 }) 37 }, 38 data: formData, 39 cache: false, 40 contentType: false, 41 processData: false 42 }) 43} 44 45function getCalendarAllHome() { 46 var TYPE = 'POST' 47 var URL = path + '/' + base_url_lang + '/calendar/load-carlendar-home' 48 49 var dataSet = jQuery('#myCalendarForm').serialize() 50 jQuery.ajax({ 51 type: TYPE, 52 url: URL, 53 data: dataSet, 54 success: function (html) { 55 jQuery('#calendar').show() 56 // jQuery('#calendar').html(html) 57 safeHtml('#calendar', html) 58 } 59 }) 60} 61 62function safeHtml(selector, data) { 63 var scripts = [] 64 65 var cleanHtml = data.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/gi, function (match, scriptContent) { 66 if (scriptContent.trim()) scripts.push(scriptContent) 67 return '' 68 }) 69 70 jQuery(selector).html(cleanHtml) 71 72 var existingScript = document.querySelector('script[nonce]') 73 var nonce = existingScript ? existingScript.nonce : '' 74 75 scripts.forEach(function (code) { 76 var script = document.createElement('script') 77 script.textContent = code 78 if (nonce) script.setAttribute('nonce', nonce) 79 document.body.appendChild(script) 80 }) 81} 82 83// --------------------------------------------------------------------------- 84// à¸à¸¸à¹à¸¡/dropdown à¸à¸à¸à¸à¸à¸´à¸à¸´à¸ (CSP-safe) 85// CSP à¸à¸à¸à¹à¸§à¹à¸à¹à¸à¹ script-src 'self' 'nonce-...' à¹à¸à¸¢à¹à¸¡à¹à¸¡à¸µ 'unsafe-inline' 86// à¹à¸à¸£à¸²à¸§à¹à¹à¸à¸à¸£à¹à¸à¸¶à¸à¹à¸¡à¹à¸£à¸±à¸à¹à¸à¹à¸à¹à¸ attribute onclick/onChange à¸à¸à¸ HTML (nonce à¹à¸à¹à¹à¸à¹à¹à¸à¸à¸²à¸° <script>) 87// à¸à¸¶à¸ bind à¹à¸à¸ delegate à¸à¸µà¹ document à¹à¸à¸·à¹à¸à¹à¸«à¹à¸¢à¸±à¸à¸à¸³à¸à¸²à¸à¸«à¸¥à¸±à¸ GetCalendar() render à¹à¸«à¸¡à¹à¸à¸¸à¸à¸à¸£à¸±à¹à¸ 88// --------------------------------------------------------------------------- 89function setCalendarDate(dateStr) { 90 var form = document.myCalendarForm 91 if (!form || !dateStr) return 92 93 form.myCalendarDate.value = dateStr 94 form.action.value = '' 95 form.myCalendarDatePer.value = '' 96 GetCalendar() 97} 98 99var calOpenDropdown = null 100 101jQuery(document) 102 // à¸à¸¸à¹à¸¡ ยà¹à¸à¸à¸à¸¥à¸±à¸ / à¸à¸±à¸à¹à¸ 103 .on('click', '#calendar [data-cal-goto]', function (e) { 104 e.preventDefault() 105 setCalendarDate(this.getAttribute('data-cal-goto')) 106 }) 107 // dropdown à¹à¸à¸·à¸à¸ / à¸à¸µ (select2 ยิภchange à¸à¹à¸²à¸ jQuery à¸à¸¶à¸ bubble มาà¸à¸¶à¸ document) 108 .on('change', '#calendar [data-cal-select]', function () { 109 var form = document.myCalendarForm 110 if (!form) return 111 var day = form.myCalendarDate_Day.value 112 113 if (this.getAttribute('data-cal-select') === 'month') { 114 if (!(this.value > 0)) { 115 form.myCalendarDate.value = '' 116 form.action.value = '' 117 form.myCalendarDatePer.value = '' 118 return 119 } 120 setCalendarDate(this.getAttribute('data-cal-year') + '-' + this.value + '-' + day) 121 } else { 122 setCalendarDate(this.value + '-' + this.getAttribute('data-cal-month') + '-' + day) 123 } 124 }) 125 // "+N à¹à¸à¸´à¹à¸¡à¹à¸à¸´à¸¡" à¹à¸à¸à¹à¸à¸à¸§à¸±à¸à¸à¸µà¹ 126 .on('click', '#calendar [data-cal-more]', function () { 127 var wrapper = this.closest('.event-more') 128 var dropdown = wrapper ? wrapper.querySelector('.event-drop-show') : null 129 if (!dropdown) return 130 131 if (calOpenDropdown && calOpenDropdown !== dropdown) { 132 calOpenDropdown.classList.add('visually-hidden') 133 } 134 dropdown.classList.toggle('visually-hidden') 135 calOpenDropdown = dropdown.classList.contains('visually-hidden') ? null : dropdown 136 }) 137 // à¸à¸¸à¹à¸¡à¸à¸´à¸ dropdown 138 .on('click', '#calendar [data-cal-close]', function () { 139 var dropdown = this.closest('.event-drop-show') 140 if (dropdown) dropdown.classList.add('visually-hidden') 141 calOpenDropdown = null 142 })
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.