1$.fn.lightGalleryNews = function () { 2 $(this).each(function (n) { 3 var i = $(this), 4 r = i.attr('title'), 5 t = i.attr('src'); 6 t != 'upload/hinhanh/logo-final-2337.png' && 7 t != '/assets/img/embed.png' && 8 t != '/content/images/video.png' && 9 t != '/images/gl.png' && 10 t != '/images/fb.png' && 11 i.replaceWith( 12 "<a data-src='" + 13 t + 14 "' title = '' class='imageGallery' id='imageGallery-" + 15 n + 16 "'>" + 17 this.outerHTML + 18 '</a>' 19 ); 20 }); 21}; 22$(document).ready(function () { 23 $('.content-main img').lightGalleryNews(); 24}); 25 26function isExist(ele) { return ele.length; } 27function isNumeric(value) { return /^\d+$/.test(value); } 28function getLen(str) { return /^\s*$/.test(str) ? 0 : str.length; } 29function isEmpty(o, t) { return "" == o && (void 0 !== t && showNotify(LANG['thongbao'], t, 'error'), !0) } 30function isEmail(o, t) { return emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, !emailRegExp.test(o.toLowerCase()) && (void 0 !== t && showNotify(LANG['thongbao'], t, 'error'), !0) } 31function isPhone(o, t) { 32 if (o.length !== 10) { 33 if (t !== undefined) { 34 showNotify(LANG['thongbao'], t, 'error'); 35 } 36 return true; 37 } 38 if (o.startsWith("00")) { 39 if (t !== undefined) { 40 showNotify(LANG['thongbao'], t, 'error'); 41 } 42 return true; 43 } 44 if (!o.startsWith("0")) { 45 if (t !== undefined) { 46 showNotify(LANG['thongbao'], t, 'error'); 47 } 48 return true; 49 } 50 51 return false; 52} 53 54function validateFormOrder() { 55 const paymentMethod = document.querySelector('input[name="dataOrder[payments]"]:checked'); 56 const fullname = document.getElementById("fullname"); 57 const phone = document.getElementById("phone"); 58 const email = document.getElementById("email"); 59 const address = document.getElementById("address"); 60 const city = document.getElementById("city").value; 61 const district = document.getElementById("district").value; 62 const ward = document.getElementById("ward").value; 63 64 if (!paymentMethod) { 65 isEmpty('', LANG["vuilongchonhinhthucthanhtoan"]); 66 return false; 67 } 68 69 if (isEmpty(fullname.value.trim(), LANG["nhaphoten"])) { 70 fullname.focus(); 71 return false; 72 } 73 74 if (isEmpty(phone.value.trim(), LANG["nhapdienthoai"])) { 75 phone.focus(); 76 return false; 77 } 78 if (isPhone(phone.value.trim(), LANG["nhapdienthoaihople"])) { 79 phone.focus(); 80 return false; 81 } 82 83 if (isEmpty(email.value.trim(), LANG["nhapemail"])) { 84 email.focus(); 85 return false; 86 } 87 if (isEmail(email.value.trim(), LANG["nhapemailhople"])) { 88 email.focus(); 89 return false; 90 } 91 92 if (!isSelectValid(city, LANG["vuilongchontinhthanh"])) return false; 93 if (!isSelectValid(district, LANG["vuilongchonquanhuyen"])) return false; 94 if (!isSelectValid(ward, LANG["vuilongchonphuongxa"])) return false; 95 96 if (isEmpty(address.value.trim(), LANG["nhapdiachi"])) { 97 address.focus(); 98 return false; 99 } 100 return true; 101} 102 103function showNotify(text = 'Notify text', title = LANG['thongbao'], status = 'success') { 104 new Notify({ 105 status: status, // success, warning, error 106 title: title, 107 text: text, 108 effect: 'fade', 109 speed: 400, 110 customClass: null, 111 customIcon: null, 112 showIcon: true, 113 showCloseButton: true, 114 autoclose: true, 115 autotimeout: 3000, 116 gap: 10, 117 distance: 10, 118 type: 3, 119 position: 'right top' 120 }); 121} 122 123function notifyDialog(content = '', title = LANG['thongbao'], icon = 'fas fa-exclamation-triangle', type = 'blue') { 124 $.alert({ 125 title: title, 126 icon: icon, // font awesome 127 type: type, // red, green, orange, blue, purple, dark 128 content: content, // html, text 129 backgroundDismiss: true, 130 animationSpeed: 600, 131 animation: 'zoom', 132 closeAnimation: 'scale', 133 typeAnimated: true, 134 animateFromElement: false, 135 autoClose: 'accept|3000', 136 escapeKey: 'accept', 137 buttons: { 138 accept: { 139 text: LANG['dongy'], 140 btnClass: 'btn-sm btn-primary' 141 } 142 } 143 }); 144} 145 146function confirmDialog( 147 action, 148 text, 149 value, 150 title = LANG['thongbao'], 151 icon = 'fas fa-exclamation-triangle', 152 type = 'blue' 153) { 154 $.confirm({ 155 title: title, 156 icon: icon, // font awesome 157 type: type, // red, green, orange, blue, purple, dark 158 content: text, // html, text 159 backgroundDismiss: true, 160 animationSpeed: 600,
161 animation: 'zoom', 162 closeAnimation: 'scale', 163 typeAnimated: true, 164 animateFromElement: false, 165 autoClose: 'cancel|3000', 166 escapeKey: 'cancel', 167 buttons: { 168 success: { 169 text: LANG['dongy'], 170 btnClass: 'btn-sm btn-primary', 171 action: function () { 172 if (action == 'delete-procart') deleteCart(value); 173 } 174 }, 175 cancel: { 176 text: LANG['huy'], 177 btnClass: 'btn-sm btn-danger' 178 } 179 } 180 }); 181} 182 183function validateForm(ele = '') { 184 if (ele) { 185 $('.' + ele) 186 .find('input[type=submit]') 187 .removeAttr('disabled'); 188 var forms = document.getElementsByClassName(ele); 189 var validation = Array.prototype.filter.call(forms, function (form) { 190 form.addEventListener( 191 'submit', 192 function (event) { 193 if (form.checkValidity() === false) { 194 event.preventDefault(); 195 event.stopPropagation(); 196 } 197 form.classList.add('was-validated'); 198 }, 199 false 200 ); 201 }); 202 } 203} 204 205function readImage(inputFile, elementPhoto) { 206 if (inputFile[0].files[0]) { 207 if (inputFile[0].files[0].name.match(/.(jpg|jpeg|png|gif)$/i)) { 208 var size = parseInt(inputFile[0].files[0].size) / 1024; 209 210 if (size <= 4096) { 211 var reader = new FileReader(); 212 reader.onload = function (e) { 213 $(elementPhoto).attr('src', e.target.result); 214 }; 215 reader.readAsDataURL(inputFile[0].files[0]); 216 } else { 217 notifyDialog(LANG['dungluonghinhanhlon']); 218 return false; 219 } 220 } else { 221 $(elementPhoto).attr('src', ''); 222 notifyDialog(LANG['dinhdanghinhanhkhonghople']); 223 return false; 224 } 225 } else { 226 $(elementPhoto).attr('src', ''); 227 return false; 228 } 229} 230 231function photoZone(eDrag, iDrag, eLoad) { 232 if ($(eDrag).length) { 233 /* Drag over */ 234 $(eDrag).on('dragover', function () { 235 $(this).addClass('drag-over'); 236 return false; 237 }); 238 239 /* Drag leave */ 240 $(eDrag).on('dragleave', function () { 241 $(this).removeClass('drag-over'); 242 return false; 243 }); 244 245 /* Drop */ 246 $(eDrag).on('drop', function (e) { 247 e.preventDefault(); 248 $(this).removeClass('drag-over'); 249 250 var lengthZone = e.originalEvent.dataTransfer.files.length; 251 252 if (lengthZone == 1) { 253 $(iDrag).prop('files', e.originalEvent.dataTransfer.files); 254 readImage($(iDrag), eLoad); 255 } else if (lengthZone > 1) { 256 notifyDialog(LANG['banchiduocchon1hinhanhdeuplen']); 257 return false; 258 } else { 259 notifyDialog(LANG['dulieukhonghople']); 260 return false; 261 } 262 }); 263 264 /* File zone */ 265 $(iDrag).change(function () { 266 readImage($(this), eLoad); 267 }); 268 } 269} 270 271function generateCaptcha(action, id, id_form) { 272 if (RECAPTCHA_ACTIVE && action && id && $('#' + id).length) { 273 grecaptcha.execute(RECAPTCHA_SITEKEY, { action: action }).then(function (token) { 274 var recaptchaResponse = document.getElementById(id); 275 recaptchaResponse.value = token; 276 document.getElementById(id_form).submit(); 277 }); 278 } 279} 280function generateCaptcha2(action, id) { 281 if (RECAPTCHA_ACTIVE && action && id && $('#' + id).length) { 282 grecaptcha.execute(RECAPTCHA_SITEKEY, { action: action }).then(function (token) { 283 var recaptchaResponse = document.getElementById(id); 284 recaptchaResponse.value = token; 285 }); 286 } 287} 288 289function loadPaging(url = '', show = '') { 290 const productsContainer = document.querySelector(show); 291 if (url) { 292 showLoading(productsContainer); 293 $.ajax({ 294 url: url, 295 type: 'GET', 296 data: { 297 show: show 298 }, 299 success: function (result) { 300 hideLoading(productsContainer); // Ẩn loading sau khi load xong 301 $(show + ' .show').html(result); 302 } 303 }); 304 } 305} 306 307function doEnter(event, obj) { 308 if (event.keyCode == 13 || event.which == 13) onSearch(obj); 309} 310 311function onSearch(obj) { 312 var keyword = $('#' + obj).val(); 313 314 if (keyword == '') { 315 notifyDialog(LANG['no_keywords']); 316 return false; 317 } else { 318 location.href = 'tim-kiem?keyword=' + encodeURI(keyword); 319 } 320} 321 322function goToByScroll(id, minusTop) { 323 minusTop = parseInt(minusTop) ? parseInt(minusTop) : 0; 324 id = id.replace('#', ''); 325 $('html,body').animate( 326 { 327 scrollTop: $('#' + id).offset().top - minusTop 328 }, 329 0 330 ); 331} 332 333function holdonOpen( 334 theme = 'sk-circle', 335 text = 'Loading...', 336 backgroundColor = 'rgba(0,0,0,0.8)', 337 textColor = 'white' 338) { 339 var options = { 340 theme: theme, 341 message: text, 342 backgroundColor: backgroundColor, 343 textColor: textColor 344 }; 345 346 HoldOn.open(options); 347} 348 349function holdonClose() { 350 HoldOn.close(); 351} 352 353function FirstLoadAPI(div, url, name_api) { 354 $(div).addClass('active'); 355 var id = $(div).data('id'); 356 var tenkhongdau = $(div).data('tenkhongdau'); 357 FrameAjax( 358 url, 359 'POST', 360 { 361 id: id, 362 tenkhongdau: tenkhongdau 363 }, 364 name_api 365 ); 366} 367 368function LoadAPI(div, url, name_api) { 369 $(div).click(function (event) { 370 $(div).removeClass('active'); 371 $(this).addClass('active'); 372 var id = $(this).data('id'); 373 var tenkhongdau = $(this).data('tenkhongdau'); 374 FrameAjax( 375 url, 376 'POST', 377 { 378 id: id, 379 tenkhongdau: tenkhongdau 380 }, 381 name_api 382 ); 383 }); 384} 385 386function FrameAjax(url, type, data, name) { 387 $.ajax({ 388 url: url, 389 type: type, 390 data: data, 391 success: function (data) { 392 $(name).html(data); 393 NN_FRAMEWORK.Lazys(); 394 } 395 }); 396} 397 398function Filter() { 399 holdonOpen(); 400 var url = $('.url-search').val(); 401 var sort = $('.sort-select-main p .check').data('sort'); 402 var idCat = {}; 403 $('input[name="ip-search"]:checked').each(function (index, element) { 404 var id = $(this).data('list'); 405 if (!idCat[id]) idCat[id] = []; 406 idCat[id].push($(this).val()); 407 }); 408 var queryString = Object.keys(idCat) 409 .map(function (key) { 410 return key + '=' + idCat[key].join(','); 411 }) 412 .join('&'); 413 url += '?sort=' + sort + (queryString ? '&' + queryString : ''); 414 window.location.href = url; 415} 416 417function TextSort() { 418 var text = $('.sort-select-main p .check').text(); 419 $('.sort-show').text(text); 420} 421 422function useStrict(val = '') { 423 return Function(`"use strict";return ${val}`)(); 424} 425 426function showLoading(container) { 427 const loadingOverlay = container.querySelector('.loading-overlay'); 428 if (loadingOverlay) { 429 loadingOverlay.style.display = 'flex'; 430 } 431} 432 433// Function ÄỠẩn loading trong Äúng class .products 434function hideLoading(container) { 435 const loadingOverlay = container.querySelector('.loading-overlay'); 436 if (loadingOverlay) { 437 loadingOverlay.style.display = 'none'; 438 } 439}
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.