1var VNT_BLOG = VNT_BLOG || {}; 2 3VNT_BLOG = { 4 init: function () { 5 VNT_BLOG.globalJS(); 6 // VNT_BLOG.trackingJS(); 7 VNT_BLOG.copyCoupon(); 8 VNT_BLOG.addHotelBookmark(); 9 VNT_BLOG.removeHotelBookmark(); 10 VNT_BLOG.checkBookmarkHotel(); 11 VNT_BLOG.tabBookmark(); 12 VNT_BLOG.vntripLogin(); 13 VNT_BLOG.vntripLogout(); 14 VNT_BLOG.sidebarCallbox(); 15 VNT_BLOG.slideOwlCarousel(); 16 VNT_BLOG.clickInsertComment(); 17 18 $(document).ready(function () { 19 let user = localStorage.getItem('__amplify__user'); 20 user = JSON.parse(user); 21 22 if (user) { 23 if (user?.data) { 24 $('#login_btn').hide(); 25 $('.nav-account').show(); 26 $('#user_fullname').text(user.data.full_name); 27 } else { 28 VNT_BLOG.vntripGoogleOneTap(); 29 } 30 } else { 31 VNT_BLOG.vntripGoogleOneTap(); 32 } 33 34 }); 35 }, 36 37 globalJS: function () { 38 $('.btnLogin').click(function () { 39 $('#loginBox').addClass('open'); 40 $('#registerBox').removeClass('open'); 41 $('#passBox').removeClass('open'); 42 }); 43 44 $('.btnRegister').click(function () { 45 $('#loginBox').removeClass('open'); 46 $('#registerBox').addClass('open'); 47 $('#passBox').removeClass('open'); 48 }); 49 50 $('.btnPass').click(function () { 51 $('#loginBox').removeClass('open'); 52 $('#registerBox').removeClass('open'); 53 $('#passBox').addClass('open'); 54 }); 55 56 $('.formLogin__backdrop, .formLogin__close').click(function () { 57 $('.formLogin').removeClass('open'); 58 }); 59 60 $('.acount-loged').click(function () { 61 $('.membership-regLog').slideToggle(200); 62 }); 63 64 $(".schema-faq-question").on("click", function () { 65 if ($(this).hasClass("active")) { 66 $(this).removeClass("active"); 67 $(this) 68 .siblings(".schema-faq-answer") 69 .slideUp(200); 70 } else { 71 $(this) 72 $(".schema-faq-question").removeClass("active"); 73 $(this).addClass("active"); 74 $(".schema-faq-answer").slideUp(200); 75 $(this) 76 .siblings(".schema-faq-answer") 77 .slideDown(200); 78 } 79 }); 80 81 }, 82 83 trackingJS: function () { 84 // (function (i, s, o, g, r, a, m) { 85 // i['GoogleAnalyticsObject'] = r; 86 // i[r] = i[r] || function () { 87 // (i[r].q = i[r].q || []).push(arguments) 88 // }, i[r].l = 1 * new Date(); 89 // a = s.createElement(o), 90 // m = s.getElementsByTagName(o)[0]; 91 // a.async = 1; 92 // a.src = g; 93 // m.parentNode.insertBefore(a, m) 94 // })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 95 // ga('create', 'UA-134441135-1', 'auto'); 96 97 window.onload = function () { 98 ga('send', 'pageview'); 99 setTimeout(function () {
vendor: 647 bytes, lines 99-112
99 100 (function (w, d, s, l, i) { 101 w[l] = w[l] || []; 102 w[l].push({ 103 'gtm.start': 104 new Date().getTime(), event: 'gtm.js' 105 }); 106 var f = d.getElementsByTagName(s)[0], 107 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; 108 j.async = true; 109 j.src = 110 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; 111 f.parentNode.insertBefore(j, f); 112 })(window, document, 'script', 'dataLayer', '
112GTM-P7TQ2Q
vendor: 16 bytes, lines 112-113
112'); 113
113}, 3000); 114 } 115 }, 116 117 copyCoupon: function () { 118 $(document).on("click", ".copy_coupon", function (e) { 119 let coupon = e.currentTarget.getAttribute('data-coupon'); 120 121 VNT_BLOG.setClipboard(coupon); 122 alert(`Mã ${coupon} Äã ÄÆ°á»£c sao chép!`); 123 }); 124 }, 125 126 setClipboard: function (value) { 127 var tempInput = document.createElement("input"); 128 tempInput.style = "position: absolute; left: -1000px; top: -1000px"; 129 tempInput.value = value; 130 document.body.appendChild(tempInput); 131 tempInput.select(); 132 document.execCommand("copy"); 133 document.body.removeChild(tempInput); 134 }, 135 136 /** 137 * Click bookmark hotel 138 */ 139 addHotelBookmark: function () { 140 $(document).on("click", ".add_hotel_favourite", function (e) { 141 e.preventDefault(); 142 $this = $(this); 143 let hotel_id = e.currentTarget.getAttribute('data-id'); 144 145 let arr = VNT_BLOG.getCookie('hotel_bookmark') || []; 146 147 if (arr.length > 0) { 148 arr = JSON.parse(arr); 149 } 150 151 if (!arr.includes(hotel_id)) { 152 let hotel_ids = arr; 153 hotel_ids.unshift(hotel_id); 154 155 $this.removeClass('add_hotel_favourite'); 156 $this.addClass('btn_checked').addClass('remove_hotel_favourite'); 157 $this.html(`<svg width='13' height='10' viewBox='0 0 13 10' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M11.6953 0.265625C11.75 0.210938 11.8047 0.15625 11.9141 0.15625C11.9961 0.15625 12.0781 0.210938 12.1328 0.265625L12.4609 0.566406C12.5156 0.648438 12.543 0.730469 12.543 0.8125C12.543 0.921875 12.5156 0.976562 12.4609 1.03125L4.25781 9.23438C4.17578 9.31641 4.09375 9.34375 4.01172 9.34375C3.92969 9.34375 3.84766 9.31641 3.79297 9.23438L0.539062 5.98047C0.484375 5.92578 0.457031 5.87109 0.457031 5.76172C0.457031 5.67969 0.484375 5.59766 0.539062 5.51562L0.867188 5.21484C0.921875 5.16016 0.976562 5.10547 1.08594 5.10547C1.16797 5.10547 1.25 5.16016 1.30469 5.21484L4.01172 7.92188L11.6953 0.265625Z' fill='#262626'></path></svg>`); 158 159 VNT_BLOG.setCookie('hotel_bookmark', JSON.stringify(hotel_ids), 30); 160 VNT_BLOG.setCountBookmark(); 161 162 // Show header 163 $(".headerM").css('display', 'flex').css('position', 'fixed'); 164 } 165 166 }); 167 }, 168 removeHotelBookmark: function () { 169 $(document).on("click", ".remove_hotel_favourite", function (e) { 170 e.preventDefault(); 171 $this = $(this); 172 let hotel_id = e.currentTarget.getAttribute('data-id'); 173 let arr = VNT_BLOG.getCookie('hotel_bookmark') || []; 174 175 if (arr.length > 0) { 176 arr = JSON.parse(arr); 177 } 178 179 arr.splice(arr.indexOf(hotel_id), 1); 180 181 $this.addClass('add_hotel_favourite'); 182 $this.removeClass('btn_checked').removeClass('remove_hotel_favourite'); 183 $this.html(`<svg width='12' height='16' viewBox='0 0 12 16' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M9.84375 0.875C10.2246 0.875 10.5469 1.02148 10.8398 1.28516C11.1035 1.57812 11.25 1.90039 11.25 2.28125V15.875L5.625 12.5938L0 15.875V2.28125C0 1.90039 0.117188 1.57812 0.410156 1.28516C0.673828 1.02148 0.996094 0.875 1.40625 0.875H9.84375ZM10.3125 14.2344V2.28125C10.3125 2.16406 10.2539 2.04688 10.166 1.95898C10.0781 1.87109 9.96094 1.8125 9.84375 1.8125H1.40625C1.25977 1.8125 1.14258 1.87109 1.05469 1.95898C0.966797 2.04688 0.9375 2.16406 0.9375 2.28125V14.2344L5.625 11.5098L10.3125 14.2344Z' fill='white'></path></svg><span>Quan tâm</span>`); 184 185 VNT_BLOG.setCookie('hotel_bookmark', JSON.stringify(arr), 30); 186 VNT_BLOG.setCountBookmark(); 187 188 // Show header 189 $(".headerM").css('display', 'flex').css('position', 'fixed'); 190 }); 191 }, 192 setCountBookmark: function () { 193 let arr_hotel = VNT_BLOG.getCookie('hotel_bookmark') || []; 194 let arr_coupon = VNT_BLOG.getCookie('coupon_bookmark') || []; 195 196 if (arr_hotel.length > 0) { 197 arr_hotel = JSON.parse(arr_hotel); 198 } 199 200 if (arr_coupon.length > 0) { 201 arr_coupon = JSON.parse(arr_coupon); 202 } 203 204 let total_count = arr_hotel.length + arr_coupon.length; 205 206 $('.badge__count').text(total_count); 207 }, 208 checkBookmarkHotel() { 209 let hotel_ids = VNT_BLOG.getCookie('hotel_bookmark') || []; 210 if (hotel_ids.length > 0) { 211 hotel_ids = JSON.parse(hotel_ids); 212 } 213 hotel_ids.forEach(function (value) { 214 $(`[data-id=${value}]`).removeClass('add_hotel_favourite').addClass('btn_checked remove_hotel_favourite').html(`<svg width="13" height="10" viewB
214ox="0 0 13 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.6953 0.265625C11.75 0.210938 11.8047 0.15625 11.9141 0.15625C11.9961 0.15625 12.0781 0.210938 12.1328 0.265625L12.4609 0.566406C12.5156 0.648438 12.543 0.730469 12.543 0.8125C12.543 0.921875 12.5156 0.976562 12.4609 1.03125L4.25781 9.23438C4.17578 9.31641 4.09375 9.34375 4.01172 9.34375C3.92969 9.34375 3.84766 9.31641 3.79297 9.23438L0.539062 5.98047C0.484375 5.92578 0.457031 5.87109 0.457031 5.76172C0.457031 5.67969 0.484375 5.59766 0.539062 5.51562L0.867188 5.21484C0.921875 5.16016 0.976562 5.10547 1.08594 5.10547C1.16797 5.10547 1.25 5.16016 1.30469 5.21484L4.01172 7.92188L11.6953 0.265625Z" fill="#262626"></path></svg>`) 215 }); 216 }, 217 218 setCookie: function (key, cvalue, exdays) { 219 var d = new Date(); 220 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 221 var expires = "expires=" + d.toGMTString(); 222 document.cookie = key + "=" + cvalue + ";" + expires + ";path=/"; 223 }, 224 getCookie: function (key) { 225 var name = key + "="; 226 var decodedCookie = decodeURIComponent(document.cookie); 227 var ca = decodedCookie.split(';'); 228 for (var i = 0; i < ca.length; i++) { 229 var c = ca[i]; 230 while (c.charAt(0) == ' ') { 231 c = c.substring(1); 232 } 233 if (c.indexOf(name) == 0) { 234 return c.substring(name.length, c.length); 235 } 236 } 237 return ""; 238 }, 239 240 postRating: function (e) { 241 $('.star-post-rating').click(function (e) { 242 let star_value = e.currentTarget.getAttribute('data-value'); 243 let post_id = $('#post_id').val(); 244 245 VNT_BLOG.ajaxPostRating(star_value, post_id); 246 }); 247 }, 248 ajaxPostRating(star_value, post_id) { 249 $.ajax({ 250 url: vntrip.ajax_url, 251 data: { 252 'action': 'rating_post', 253 'star': star_value, 254 'post_id': post_id, 255 }, 256 beforeSend: function () { 257 $('.rateStar').hide(); 258 $('#post_rating_loading').show(); 259 }, 260 success: function (data) { 261 $('#post_rating_loading').hide(); 262 $('#post_rating_smile').show(); 263 $('.rate-title').text("Cảm Æ¡n bạn Äã Äánh giá!"); 264 setTimeout(function () { 265 $('#btn_rating').hide(); 266 $('.starPopup').removeClass('open'); 267 }, 1500); 268 }, 269 error: function (e) { 270 console.log('error: ', e); 271 } 272 }); 273 }, 274 275 vntripLogin: function () { 276 $('#submit_login').click(function () { 277 let login_email = $('#login_email').val(); 278 let login_password = $('#login_password').val(); 279 let $this = $(this); 280 281 $.ajax({ 282 url: 'https://micro-services.vntrip.vn/v2-user/frontend/login/', 283 method: 'POST', 284 data: { 285 "email": login_email, 286 "password": login_password 287 }, 288 beforeSend: function () { 289 $this.text("Äang ÄÄng nháºp...").prop('disable', true); 290 }, 291 success: function (data) { 292 if (data.status === "success") { 293 VNT_BLOG.vntripGetUserInfo(data.data.access_token); 294 } else { 295 $this.text("ÄÄng nháºp").prop('disable', false); 296 alert('ÄÄng nháºp thất bại. Vui lòng thá» lại!'); 297 } 298 }, 299 error: function (e) { 300 $this.text("ÄÄng nháºp").prop('disable', false); 301 console.log(e); 302 } 303 }); 304 }); 305 306 }, 307 vntripLogout: function () { 308 $('#user_logout').click(function () { 309 localStorage.removeItem('__amplify__user'); 310 location.reload(); 311 }); 312 }, 313 vntripGetUserInfo: function (token) { 314 $.ajax({ 315 url: 'https://micro-services.vntrip.vn/v2-user/frontend/users/profile/', 316 headers: { 317 'Authorization': `Bearer ${token}`, 318 }, 319 beforeSend: function () { 320 321 }, 322 success: function (response) { 323 let user_info = response.data.filter(function (v, i) { 324 return v.type === "person"; 325 }); 326 327 let date = new Date(); 328 date.setDate(date.getDate() + 7); 329 date.getTime(); 330 331 let user = user_info[0]; 332 let data_user = { 333 "data": { 334 "access_token": token, 335 "email": user.email, 336 "user_id": 26997, 337 "birthday": user.birthday, 338 "first_name": user.first_name, 339 "last_name": user.last_name, 340 "full_name": `${user.first_name} ${user.last_name}`, 341 "phone": user.phone, 342 "gender": user.gender, 343 "time": date, 344 "account_type": "user" 345 }, 346 "expires": null 347 }; 348 349 localStorage.setItem('__amplify__user', JSON.stringify(data_user)); 350 location.reload(); 351 352 }, 353 error: function (e) { 354 console.log(e); 355 } 356 }); 357 }, 358
359 vntripGoogleOneTap: function () { 360 window.onload = function () { 361 google.accounts.id.initialize({ 362 client_id: '301462092120-bmkrma6siqqrkfoer19k0cthpn6224ie.apps.googleusercontent.com', // live 363 // client_id: '1026187770118-6mi7pd7t0eqg47ru6qb3254ugdsel4ar.apps.googleusercontent.com', // test 364 callback: handleCredentialResponse, 365 cancel_on_tap_outside: false 366 }); 367 google.accounts.id.prompt((notification) => { 368 console.log("notification: ", notification); 369 }); 370 }; 371 372 function handleCredentialResponse(data) { 373 console.log("handleCredentialResponse: ", data) 374 375 $.ajax({ 376 url: 'https://micro-services.vntrip.vn/v2-user/frontend/login/', 377 method: 'POST', 378 data: { 379 "google_id_token": data.credential, 380 "grant_type": "password", 381 "client_id": "16GuKzV8K1@92YcLg85uR5ku;peVriRZSn!1.UTh", 382 "client_secret": "TCuMmpT!EGz5UT7GE3D?s-ikA5i0sCV2pI7cFYqc!0c;z1oIyCeLsVb_ZDRdI7KOg4Pem7XKz4UU0yJ2K37I5;3Sp2UVw!tNK-ps4vaguqr09MopDwB_7larJWAmXHyv" 383 }, 384 success: function (data) { 385 if (data.status === "success") { 386 VNT_BLOG.vntripGetUserInfo(data.data.access_token); 387 } else { 388 alert('ÄÄng nháºp thất bại. Vui lòng thá» lại!'); 389 } 390 }, 391 error: function (e) { 392 console.log(e); 393 } 394 }); 395 396 } 397 }, 398 399 400 tabBookmark: function () { 401 $('#tab_bookmark_hotel').click(function (e) { 402 e.preventDefault(); 403 document.getElementById("list_bookmark").innerHTML = ''; 404 $('#tab_bookmark_hotel').addClass('active'); 405 $('#tab_bookmark_promotion').removeClass('active'); 406 407 VNT_BLOG.ajaxHotelBookmark(); 408 }); 409 410 $('#tab_bookmark_promotion').click(function (e) { 411 e.preventDefault(); 412 document.getElementById("list_bookmark").innerHTML = ''; 413 $('#tab_bookmark_hotel').removeClass('active'); 414 $('#tab_bookmark_promotion').addClass('active'); 415 416 VNT_BLOG.ajaxLoadCouponBookmark(); 417 }); 418 }, 419 ajaxLoadCouponBookmark: function () { 420 let cookie_post_ids = VNT_BLOG.getCookie('coupon_bookmark') || []; 421 $.ajax({ 422 url: vntrip.ajax_url, 423 data: { 424 'action': 'get_coupon_bookmark', 425 'cookie_post_ids': cookie_post_ids 426 }, 427 beforeSend: function () { 428 $('#list_bookmark_loading').show(); 429 }, 430 success: function (data) { 431 console.log("data coupon: ", data); 432 $('#list_bookmark_loading').hide(); 433 $('#list_bookmark').append(data.data); 434 }, 435 error: function (e) { 436 $('#list_bookmark_loading').hide(); 437 console.log(e); 438 } 439 }); 440 }, 441 ajaxHotelBookmark: function () { 442 let cookie_hotel_ids = VNT_BLOG.getCookie('hotel_bookmark') || []; 443 $.ajax({ 444 url: vntrip.ajax_url, 445 data: { 446 'action': 'get_hotel_bookmark', 447 'cookie_hotel_ids': cookie_hotel_ids, 448 'device': 'desktop' 449 }, 450 beforeSend: function () { 451 $('#list_bookmark_loading').show(); 452 }, 453 success: function (data) { 454 console.log("data hotel: ", data); 455 $('#list_bookmark_loading').hide(); 456 $('#list_bookmark').append(data.data); 457 }, 458 error: function (e) { 459 $('#list_bookmark_loading').hide(); 460 console.log(e); 461 } 462 }); 463 }, 464 465 fbShare: function (url) { 466 var winTop = (screen.height / 2) - (350 / 2); 467 var winLeft = (screen.width / 2) - (520 / 2); 468 window.open('http://www.facebook.com/sharer.php?s=100&u=' + url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=520,height=350'); 469 }, 470 471 sidebarCallbox: function () { 472 $('.callBox__title').click(function () { 473 $(this).toggleClass('rotate'); 474 $('.callBox__form').slideToggle(200); 475 }); 476 477 $('#callbox_submit').click(function () { 478 let phone_number = $('#call_box_phone_number').val(); 479 let full_name = $('#full_name').val(); 480 481 let a = full_name.indexOf(' '); 482 let last_name = full_name.substring(0, a); 483 let first_name = full_name.substring(a + 1); 484 485 if (!phone_number) return alert('Vui lòng nháºp sá» Äiá»n thoại!'); 486 487 // Call API here, wait api 488 $.ajax({ 489 url: 'https://micro-services.vntrip.vn/v3-booking/general-ticket/hotline/', 490 method: 'POST', 491 data: { 492 "source": 13, 493 "phone": phone_number, 494 "first_name": first_name, 495 "lastname": last_name 496 }, 497 beforeSend: function () { 498 $('#callbox_submit').text('Äang gá»i yêu cầu...').prop('disable', true); 499 $('#callbox_status').hide(); 500 }, 501 success: function (data) { 502 if (data.status === 'success') { 503 $('#callbox_status').show(); 504 $('#callbox_submit').text('Gá»i').prop('disable', false); 505 } 506 }, 507 error: function (e) { 508 console.log('error: ', e); 509 } 510 }); 511 }); 512 }, 513 514 slideOwlCarousel: function () { 515 let owl_items = $('.owl-carousel').data('items') || 6; 516 $('.owl-carousel').owlCarousel({ 517 loop: false, 518 nav: true, 519 items: owl_items, 520 dots: false, 521 lazyLoad: true, 522 smartSpeed: 600,
523 navText: [ 524 '<svg width="7" height="13" viewBox="0 0 7 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n' + 525 ' <path d="M6.50781 12.2656C6.45312 12.3203 6.39844 12.3477 6.28906 12.3477C6.20703 12.3477 6.125 12.3203 6.07031 12.2656L0.273438 6.46875C0.21875 6.41406 0.191406 6.33203 0.191406 6.25C0.191406 6.14062 0.21875 6.08594 0.273438 6.03125L6.07031 0.234375C6.125 0.179688 6.20703 0.152344 6.28906 0.152344C6.39844 0.152344 6.45313 0.179688 6.50781 0.234375L6.72656 0.453125C6.78125 0.507812 6.80859 0.5625 6.80859 0.671875C6.80859 0.753906 6.78125 0.835938 6.72656 0.917969L1.36719 6.25L6.72656 11.582C6.78125 11.6367 6.80859 11.7188 6.80859 11.8281C6.80859 11.9102 6.78125 11.9922 6.72656 12.0469L6.50781 12.2656Z" fill="black"/>\n' + 526 '</svg>', 527 '<svg width="7" height="13" viewBox="0 0 7 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n' + 528 ' <path d="M0.492188 0.734375C0.546875 0.679688 0.601562 0.652344 0.710938 0.652344C0.792969 0.652344 0.875 0.679688 0.929688 0.734375L6.72656 6.53125C6.78125 6.58594 6.80859 6.66797 6.80859 6.75C6.80859 6.85938 6.78125 6.91406 6.72656 6.96875L0.929688 12.7656C0.875 12.8203 0.792969 12.8477 0.710938 12.8477C0.601562 12.8477 0.546875 12.8203 0.492188 12.7656L0.273438 12.5469C0.21875 12.4922 0.191406 12.4375 0.191406 12.3281C0.191406 12.2461 0.21875 12.1641 0.273438 12.082L5.63281 6.75L0.273438 1.41797C0.21875 1.36328 0.191406 1.28125 0.191406 1.17188C0.191406 1.08984 0.21875 1.00781 0.273438 0.953125L0.492188 0.734375Z" fill="black"/>\n' + 529 '</svg>\n' 530 ], 531 }) 532 }, 533 534 clickInsertComment: function () { 535 $('#commentform').submit(function (event) { 536 event.preventDefault(); 537 console.log('insert comment...') 538 539 VNT_BLOG.ajaxInsertComment() 540 541 }); 542 }, 543 544 ajaxInsertComment: function () { 545 const comment_text = $('#comment').val() 546 let user = localStorage.getItem('__amplify__user'); 547 user = JSON.parse(user); 548 549 console.log('data: ', { 550 'comment_text': comment_text, 551 'user': user, 552 }) 553 554 if (user) { 555 if (user?.data) { 556 const button = $('#submit'), // submit button 557 respond = $('#respond'), // comment form container 558 commentlist = $('.comment-list'), // comment list container 559 cancelreplylink = $('#cancel-comment-reply-link'), 560 post_id = $('#post_id').val(); 561 562 // ajax request 563 $.ajax({ 564 type: 'POST', 565 url: vntrip.ajax_url, 566 data: `comment=${comment_text}&action=ajaxcomments&author=${user.data.full_name}&email=${user.data.email}&comment_post_ID=${post_id}`, // send form data + action parameter 567 beforeSend: function (xhr) { 568 button.text('Loading...').prop('disabled', true); 569 }, 570 error: function (request, status, error) { 571 if (status == 500) { 572 alert('Error while adding comment'); 573 } else if (status == 'timeout') { 574 alert('Error: Server doesn\'t respond.'); 575 } else { 576 // process WordPress errors 577 var wpErrorHtml = request.responseText.split("<p>"), 578 wpErrorStr = wpErrorHtml[1].split("</p>"); 579 580 alert(wpErrorStr[0]); 581 } 582 }, 583 success: function (addedCommentHTML) { 584 // if this post already has comments 585 if (commentlist.length > 0) { 586 587 // if in reply to another comment 588 if (respond.parent().hasClass('comment')) { 589 590 // if the other replies exist 591 if (respond.parent().children('.children').length) { 592 respond.parent().children('.children').prepend(addedCommentHTML); 593 } else { 594 // if no replies, add <ol class="children">
595 addedCommentHTML = '<ol class="children">' + addedCommentHTML + '</ol>'; 596 respond.parent().prepend(addedCommentHTML); 597 } 598 // close respond form 599 cancelreplylink.trigger("click"); 600 } else { 601 // simple comment 602 commentlist.prepend(addedCommentHTML); 603 } 604 } else { 605 // if no comments yet 606 addedCommentHTML = '<ol class="comment-list">' + addedCommentHTML + '</ol>'; 607 respond.before($(addedCommentHTML)); 608 } 609 // clear textarea field 610 $('#comment').val(''); 611 }, 612 complete: function () { 613 // what to do after a comment has been added 614 button.removeClass('loadingform').text('Gá»i').prop('disabled', false); 615 } 616 }); 617 } else { 618 alert('Vui lòng ÄÄng nháºp Äá» gá»i bình luáºn!') 619 } 620 } else { 621 alert('Vui lòng ÄÄng nháºp Äá» gá»i bình luáºn!') 622 } 623 624 }, 625 626}; 627 628VNT_BLOG.init();
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.