1var App = { 2 datePicker: function () { 3 if (jQuery('.datepicker').length) { 4 jQuery('.datepicker').each(function () { 5 var $this = jQuery(this); 6 var option = { 7 dateFormat: 'dd-mm-yy' 8 }; 9 if ($this.data('changemonth')) { 10 option.changeMonth = true; 11 } 12 if ($this.data('changeyear')) { 13 option.changeYear = true; 14 } 15 if ($this.data('yearrange')) { 16 option.yearRange = $this.data('yearrange'); 17 } 18 $this.datepicker(option); 19 }); 20 } 21 }, 22 initCss: function () { 23 if (jQuery('.selectpicker').length) { 24 jQuery('.selectpicker').each(function () { 25 var $this = jQuery(this); 26 var option = { 27 'noneSelectedText': 'Vui lòng chá»n' 28 }; 29 $this.selectpicker(option); 30 }); 31 } 32 }, 33 initEvent: function () { 34 if (jQuery('[data-trigger]').length) { 35 jQuery('[data-trigger]').each(function () { 36 var $trigger = jQuery(this).data('trigger'); 37 jQuery(this).trigger($trigger); 38 39 }); 40 if (jQuery('.selectpicker').length) { 41 jQuery('.selectpicker').selectpicker('refresh'); 42 } 43 } 44 if (jQuery('.alert-msg').length && jQuery('.alert-msg .alert').length) { 45 jQuery('.alert-msg').modal('show'); 46 } 47 if (location.hash) { 48 var $hash = location.hash; 49 var $class = $hash.replace("#", "."); 50 if (jQuery($hash).length) { 51 jQuery('body,html').animate({scrollTop: jQuery($hash).offset().top}, 1000); 52 } else if (jQuery($class).length) { 53 jQuery('body,html').animate({scrollTop: jQuery($class).offset().top}, 1000); 54 } 55 } 56 if (jQuery('.scrollto').length) { 57 jQuery('.scrollto').each(function () { 58 var $this = jQuery(this); 59 $this.click(function () { 60 var $target = jQuery(jQuery(this).data('target')); 61 if ($target.length) { 62 jQuery('body,html').animate({scrollTop: $target.offset().top}, 1000); 63 } 64 }) 65 66 67 68 }); 69 } 70 if (jQuery('.custom-file-input').length) { 71 var $default = jQuery('.custom-file-label').text(); 72 jQuery('.custom-file-input').change(function () { 73 var parent = jQuery(this).parent(); 74 var files = jQuery(this)[0].files; 75 if (files.length) { 76 for (var $i = 0; $i < files.length; $i++) { 77 var filetype = files[$i].type; 78 if (files[$i].size > 10 * 1024 * 1024) { 79 jQuery(this).val(''); 80 parent.find('.custom-file-label').addClass('error'); 81 return false; 82 } 83 84 } 85 parent.find('.custom-file-label').removeClass('error'); 86 if (files.length == 1) { 87 parent.find('.custom-file-label').text(files[0].name); 88 } 89 } 90 }); 91 } 92 if (jQuery('.footer-page .nav-link').length) { 93 jQuery('.footer-page .nav-link').each(function () { 94 var $this = jQuery(this); 95 $this.click(function () { 96// location.href=$this.attr('href'); 97 var hashValue = $this.attr('href').split('#'); 98 if (hashValue.length == 2) { 99 var $hash = '#'+hashValue[1]; 100 var $class = '.'+hashValue[1]; 101 if (jQuery($hash).length) { 102 jQuery('body,html').animate({scrollTop: jQuery($hash).offset().top}, 1000); 103 } else if (jQuery($class).length) { 104 jQuery('body,html').animate({scrollTop: jQuery($class).offset().top}, 1000); 105 } 106 } 107 108// window.location.reload(); 109 }) 110 }); 111 } 112 if (jQuery('.selectpicker').length) { 113 jQuery('.selectpicker').selectpicker('refresh'); 114 } 115 116 if (jQuery('input[name="paymentMethod"]').length) { 117 jQuery('input[name="paymentMethod"]').change(function () { 118 if (jQuery('input[name="paymentMethod"]:checked').val() == 2) { 119 jQuery('.bankaccountinfo').removeClass('d-none'); 120 } else { 121 jQuery('.bankaccountinfo').addClass('d-none'); 122 if (jQuery('input[name="bankaccount"]').length && !jQuery('input[name="bankaccount"]:checked').length) { 123 jQuery(jQuery('input[name="bankaccount"]')[0]).prop({'checked': true}); 124 } 125 } 126 }); 127 jQuery('input[name="paymentMethod"]').trigger('change'); 128 } 129 if (jQuery('input[name="username"]').length) { 130 jQuery('input[name="username"]').keyup(function () { 131 var $this = jQuery(this); 132 $this.val($this.val().replace(/[^a-zA-Z0-9]/g, '').toLowerCase()); 133 }); 134 } 135 136 }, 137 initSlide: function () { 138 if (jQuery('.swiper-container').length) { 139 jQuery('.swiper-container').each(function () { 140 var $this = jQuery(this); 141 var $option = { 142 143 // Optional parameters 144 loop: true, 145 speed: 1200, 146 parallax: true, 147 // If we need pagination 148 pagination: { 149 el: $this.find('.swiper-pagination'), 150 clickable: true 151 }, 152 153 // Navigation arrows 154 navigation: { 155 nextEl: $this.find('.swiper-button-next'), 156 prevEl: $this.find('.swiper-button-prev') 157 }, 158 159 // And if we need scrollbar 160 scrollbar: { 161 el: $this.find('.swiper-scrollbar') 162 } 163 }; 164 if ($this.data('loop')) { 165 $option.loop = $this.data('loop'); 166 } 167 if ($this.data('space-between')) { 168 $option.spaceBetween = $this.data('space-between'); 169 } 170 if ($this.data('slides-per-view')) { 171 $option.slidesPerView = $this.data('slides-per-view'); 172 } 173 if ($this.data('next-el')) { 174 $option.navigation.nextEl = $this.parent().find($this.data('next-el')); 175 } 176 if ($this.data('prev-el')) { 177 $option.navigation.prevEl = $this.parent().find($this.data('prev-el')); 178 } 179 if ($this.data('breakpoints')) { 180 181 $option.breakpoints = $this.data('breakpoints'); 182 } 183 new Swiper($this, $option); 184 }); 185 } 186 187 } 188}; 189 190jQuery(document).ready(function (e) { 191 App.datePicker(); 192 App.initCss(); 193 App.initEvent(); 194 App.initSlide(); 195}); 196 197let modalCount = 0; 198t = function(type, text, data = {}) { 199 let icon, title, className;
200 let autohide = data.autohide ?? false; 201 let url = data.url ?? false; 202 203 if (type === "e") { 204 icon = "fa fa-circle-xmark"; 205 title = "Error!"; 206 className = "text-danger"; 207 } else if (type === "w") { 208 icon = "fa fa-exclamation-triangle"; 209 title = "Warning!"; 210 className = "text-warning"; 211 } else if (type === "s") { 212 icon = "fa fa-check-circle"; 213 title = "Success!"; 214 className = "text-success"; 215 } else if (type === "i") { 216 icon = "fa fa-info-circle"; 217 title = "Information"; 218 className = "text-info"; 219 } else { 220 icon = "fa fa-circle-o"; 221 title = "Information"; 222 className = "text-secondary"; 223 } 224 225 modalCount++; 226 let modalId = `dynamicModal${modalCount}`; 227 228 let modalHTML = ` 229 <div class="modal fade" id="${modalId}" tabindex="-1" aria-labelledby="${modalId}Label" aria-hidden="true"> 230 <div class="modal-dialog modal-dialog-centered"> 231 <div class="modal-content"> 232 ${autohide ? ` 233 <div class="progress" style="height: 4px;"> 234 <div class="progress-bar bg-secondary" id="progressBar${modalId}" role="progressbar" style="width: 100%;"></div> 235 </div>` : ''} 236 <div class="modal-header border-0 pb-0"> 237 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 238 </div> 239 <div class="modal-body text-center"> 240 <div class="mb-3"> 241 <i class="${icon} ${className}" style="font-size:60px;"></i> 242 </div> 243 <div> 244 <div>${text}</div> 245 </div> 246 </div> 247 <div class="modal-footer border-0"> 248 <button type="button" class="btn btn-haroct btn-block" data-bs-dismiss="modal">Okay</button> 249 </div> 250 </div> 251 </div> 252 </div>`; 253 254 $('body').append(modalHTML); 255 256 let myModal = new bootstrap.Modal(document.getElementById(modalId)); 257 myModal.show(); 258 259 if (autohide) { 260 let duration = 3000; 261 let progressBar = $(`#progressBar${modalId}`); 262 263 progressBar.animate({ width: '0%' }, duration, function() { 264 myModal.hide(); 265 $(`#${modalId}`).on('hidden.bs.modal', function () { 266 $(this).remove(); 267 }); 268 269 if (url) { 270 location.href = url; 271 } 272 }); 273 } 274 275 return modalId; 276} 277 278ajax_error = function(error){ 279 if(error.status == 0){ 280 // t('e', 'You network currently are offline!!'); 281 }else if(error.status == 404){ 282 t('e', 'Requested URL not found.'); 283 }else if(error.status == 500){ 284 t('e', 'Internel Server Error.'); 285 }else if(error == 'parsererror'){ 286 t('e', 'Parsing JSON Request failed.'); 287 }else if(error == 'timeout'){ 288 t('e', 'Request Time out.'); 289 }else { 290 t('e', 'Unknow Error : '+ error.responseText); 291 } 292} 293 294ajax_form = function(data, url){ 295 if (typeof data === 'string') { 296 data += '&version=11111'; 297 } else if (Array.isArray(data)) { 298 data.push({ 299 name: 'version', 300 value: 11111 301 }); 302 } else if (typeof data === 'object') { 303 data.version = 11111; 304 } 305 306 return $.ajax({ 307 type: 'POST', 308 url: url, 309 dataType: 'json', 310 data: data, 311 headers: { 312 'Api-Secret': 'wbhZDkHjLxp9DzJPwgSwd2ch6rKM9sAS', 313 'Api-Key': 'gMpsvU5rB35DGvFS', 314 'Authorization': 'dev' 315 } 316 }); 317} 318 319async function processRequest(requests) { 320 for (const request of requests) { 321 try { 322 const response = await ajax_form(request.data, request.url).then(res => res); 323 request.handler(response); 324 } catch (error) { 325 ajax_error(error); 326 } 327 } 328}
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.