").appendTo(g[0]).append(a("").text(b.text()).attr("href","#"+b.attr("id"))),i=c})})},c=a.fn.toc;a.fn.toc=b,a.fn.toc.noConflict=function(){return a.fn.toc=c,this},a(function(){b.call(a("[data-toc]"))})}(window.jQuery);function prrelate() { $('.pr-relate').owlCarousel({ loop:false, rewind: true, nav:true, dots: true, items:5, autoHeight:true, margin: 10, slideBy: "page", smartSpeed: 100, navText: ['', ''], }); } function scrollafteax() { var top_x = $(".main-left").offset().top; $('html, body').animate({ scrollTop: top_x }, 500); } function addCommas(nStr) { nStr +=''; x = nStr.split(','); x1 = x[0]; x2 = x.length > 1 ? ',' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + '.' + '$2'); } return x1 + x2; } function slidehasp(){ var owl = $('.hsp'); $('.hsp').on('initialized.owl.carousel changed.owl.carousel', function(e) { if (!e.namespace) { return; } var carousel = e.relatedTarget; $('.slider-counter').text(carousel.relative(carousel.current()) + 1 + '/' + carousel.items().length); $('.slider-counter').attr('data-count',carousel.relative(carousel.current())); }).on('drag.owl.carousel translate.owl.carousel', function(e) { owl.find('.thumbnail-sl, .gallery-rating').css('display','flex'); }).owlCarousel({ loop:false, margin:0, nav:true, dots: false, autoplayTimeout:5000, items:1, autoHeight:true, navText: ['', ''], });$('body').on('click',".bassmc a", function(e){ e.preventDefault(); var t = $(this).find('.hkj').text(); var p = $(this).attr('data-p'); var im = $(this).attr('data-m'); if (p) { $(".showgia input[name='sale_price']").val(p); $(".product__price.on-sale").html(addCommas(p)+"₫"); } if (t) { $(".showgia input[name='attcl']").val(t); } if (im) { $(".showgia input[name='imgcl']").val(im); } $('.bassmc a').removeClass('activelink'); $(this).addClass('activelink'); const k = $(this).attr('data-i'); var oArray = []; $('.hsp .thumbnail-sl').each(function(){ const ll = $(this).attr('data-i'); var idx = $(this).parents('.owl-item').index(); if (k == ll) { oArray.push(idx); } }); if (oArray) { owl.trigger('to.owl.carousel', [oArray[0],300]); } }); } function sliderimgstar(o){ var carousel = $(".sliderimgstar"); carousel.owlCarousel({ loop:false, rewind: true, margin:0, nav:true, dots: false, autoplayTimeout:5000, items:1, autoHeight:true, navText: ['', ''], }); carousel.trigger('to.owl.carousel', [o, 300]);} function slide_video_sp(){var sync1 = $("#sync1_video"); var sync2 = $("#sync2_video"); var slidesPerPage = 8; var syncedSecondary = true;sync1.owlCarousel({ items: 1, slideSpeed: 2000, nav: true, autoplay: false,dots: false, loop: true, responsiveRefreshRate: 200, navText: ['', ''], }).on('changed.owl.carousel', syncPosition);sync2 .on('initialized.owl.carousel', function() { sync2.find(".owl-item").eq(0).addClass("current"); }) .owlCarousel({ items: slidesPerPage, dots: false, nav: false, smartSpeed: 200, slideSpeed: 500, loop: false, autoplay: false, margin:10, slideBy: slidesPerPage, responsiveRefreshRate: 100 }).on('changed.owl.carousel', syncPosition2);function syncPosition(el) { var count = el.item.count - 1; var current = Math.round(el.item.index - (el.item.count / 2) - .5);if (current < 0) { current = count; } if (current > count) { current = 0; } sync2 .find(".owl-item") .removeClass("current") .eq(current) .addClass("current"); var onscreen = sync2.find('.owl-item.active').length - 1; var start = sync2.find('.owl-item.active').first().index(); var end = sync2.find('.owl-item.active').last().index();if (current > end) { sync2.data('owl.carousel').to(current, 100, true); } if (current < start) { sync2.data('owl.carousel').to(current - onscreen, 100, true); } }function syncPosition2(el) { if (syncedSecondary) { var number = el.item.index; sync1.data('owl.carousel').to(number, 100, true); } }sync2.on("click", ".owl-item", function(e) { e.preventDefault(); var number = $(this).index(); sync1.data('owl.carousel').to(number, 300, true); }); } function slide_hinhthucte(o){ var sync1 = $("#hinhthucte1"); var sync2 = $("#hinhthucte2"); var slidesPerPage = 10; var syncedSecondary = true;sync1.owlCarousel({ items: 1, slideSpeed: 2000, nav: true, autoplay: false,dots: false, loop: false, responsiveRefreshRate: 200, navText: ['', ''], }).on('changed.owl.carousel', syncPosition);sync2 .on('initialized.owl.carousel', function() { sync2.find(".owl-item").eq(0).addClass("current"); }) .owlCarousel({ items: slidesPerPage, dots: false, nav: false, smartSpeed: 200, slideSpeed: 500, loop: false, margin:10, autoplay: false,slideBy: slidesPerPage, responsiveRefreshRate: 100 }).on('changed.owl.carousel', syncPosition2);function syncPosition(el) { var current = el.item.index; var count = el.item.count - 1; if (current < 0) { current = count; } if (current > count) { current = 0; } sync2 .find(".owl-item") .removeClass("current") .eq(current) .addClass("current"); var onscreen = sync2.find('.owl-item.active').length - 1; var start = sync2.find('.owl-item.active').first().index(); var end = sync2.find('.owl-item.active').last().index(); if (current == end) { sync2.trigger('next.owl.carousel'); sync1.trigger('to.owl.carousel', [current, 100]);} if (start == current) { sync2.trigger('prev.owl.carousel'); sync1.trigger('to.owl.carousel', [current, 100]);} if (current < start) { sync2.trigger('prev.owl.carousel'); sync1.trigger('to.owl.carousel', [start-1, 100]);} }function syncPosition2(el) { if (syncedSecondary) { var number = el.item.index; sync1.data('owl.carousel').to(number, 100, true); } } var i = parseInt(slidesPerPage)-1; sync2.on("click", ".owl-item", function(e) { e.preventDefault(); var end = sync2.find('.owl-item.active').last().index(); var start = sync2.find('.owl-item.active').first().index(); var number = $(this).index(); if (number==end) { sync2.trigger('next.owl.carousel'); sync1.trigger('to.owl.carousel', [number, 300]);} else if (number==start) { sync2.trigger('prev.owl.carousel'); sync1.data('owl.carousel').to(number, 300, true); } else { sync1.data('owl.carousel').to(number, 300, true); }}); if (o) { sync1.trigger('to.owl.carousel', [o, 300]); } } function slide_sanpham(o){ var sync1 = $("#hinhsp1"); var sync2 = $("#hinhsp2"); var slidesPerPage = 10; var syncedSecondary = true;sync1.owlCarousel({ items: 1, slideSpeed: 2000, nav: true, autoplay: false,dots: false, loop: false, responsiveRefreshRate: 200, navText: ['', ''], }).on('changed.owl.carousel', syncPosition);sync2 .on('initialized.owl.carousel', function() { sync2.find(".owl-item").eq(0).addClass("current"); }) .owlCarousel({ items: slidesPerPage, dots: false, nav: false, smartSpeed: 200, slideSpeed: 500, loop: false, margin:10, autoplay: false,slideBy: slidesPerPage, responsiveRefreshRate: 100 }).on('changed.owl.carousel', syncPosition2);function syncPosition(el) { var current = el.item.index;var count = el.item.count - 1;if (current < 0) { current = count; } if (current > count) { current = 0; }sync2 .find(".owl-item") .removeClass("current") .eq(current) .addClass("current"); var onscreen = sync2.find('.owl-item.active').length - 1; var start = sync2.find('.owl-item.active').first().index(); var end = sync2.find('.owl-item.active').last().index(); if (current == end) { sync2.trigger('next.owl.carousel'); sync1.trigger('to.owl.carousel', [current, 100]);} if (start == current) { sync2.trigger('prev.owl.carousel'); sync1.trigger('to.owl.carousel', [current, 100]);} if (current < start) { sync2.trigger('prev.owl.carousel'); sync1.trigger('to.owl.carousel', [start-1, 100]);} }function syncPosition2(el) { if (syncedSecondary) { var number = el.item.index; sync1.data('owl.carousel').to(number, 100, true); } }var i = parseInt(slidesPerPage)-1; sync2.on("click", ".owl-item", function(e) { e.preventDefault(); var end = sync2.find('.owl-item.active').last().index(); var start = sync2.find('.owl-item.active').first().index(); var number = $(this).index(); if (number==end) { sync2.trigger('next.owl.carousel'); sync1.trigger('to.owl.carousel', [number, 300]);} else if (number==start) { sync2.trigger('prev.owl.carousel'); sync1.data('owl.carousel').to(number, 300, true); } else { sync1.data('owl.carousel').to(number, 300, true); }}); if (o) { sync1.trigger('to.owl.carousel', [o, 300]); } } function dx() { $('.pr-history').owlCarousel({ loop:false, rewind: true, nav:true, dots: true, items:5, autoHeight:true, margin: 10, slideBy: "page", smartSpeed: 100, navText: ['', ''], }); } function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); }$(document).ready(function() { $('body').on('click',".dttruocngay", function(e){ e.preventDefault(); $('.center-hx-dt-page').css('display','flex'); $('html, body').css('overflow','hidden'); }); $('body').on('click',".p_close_dattruoc", function(e){ e.preventDefault(); $('.center-hx-dt-page').css('display','none'); $('html, body').css('overflow','auto'); }); $('.hsp100').owlCarousel({ loop:false, margin:0, nav:true, dots: false, autoplayTimeout:5000, items:1, autoHeight:true, navText: ['', ''], }); var sync1 = $("#hinhsp100"); var sync2 = $("#hinhsp200"); var slidesPerPage = 5; var syncedSecondary = true;sync1.owlCarousel({ items: 1, slideSpeed: 2000, nav: true, autoplay: false,dots: false, loop: false, responsiveRefreshRate: 200, navText: ['', ''], }).on('changed.owl.carousel', syncPosition);sync2 .on('initialized.owl.carousel', function() { sync2.find(".owl-item").eq(0).addClass("current"); }) .owlCarousel({ items: slidesPerPage, dots: false, nav: false, smartSpeed: 200, slideSpeed: 500, loop: false, margin:10, autoplay: false,slideBy: slidesPerPage, responsiveRefreshRate: 100 }).on('changed.owl.carousel', syncPosition2);function syncPosition(el) { var current = el.item.index;var count = el.item.count - 1;if (current < 0) { current = count; } if (current > count) { current = 0; }sync2 .find(".owl-item") .removeClass("current") .eq(current) .addClass("current"); var onscreen = sync2.find('.owl-item.active').length - 1; var start = sync2.find('.owl-item.active').first().index(); var end = sync2.find('.owl-item.active').last().index(); if (current == end) { sync2.trigger('next.owl.carousel'); sync1.trigger('to.owl.carousel', [current, 100]);} if (start == current) { sync2.trigger('prev.owl.carousel'); sync1.trigger('to.owl.carousel', [current, 100]);} if (current < start) { sync2.trigger('prev.owl.carousel'); sync1.trigger('to.owl.carousel', [start-1, 100]);} }function syncPosition2(el) { if (syncedSecondary) { var number = el.item.index; sync1.data('owl.carousel').to(number, 100, true); } }var i = parseInt(slidesPerPage)-1; sync2.on("click", ".owl-item", function(e) { e.preventDefault(); var end = sync2.find('.owl-item.active').last().index(); var start = sync2.find('.owl-item.active').first().index(); var number = $(this).index(); if (number==end) { sync2.trigger('next.owl.carousel'); sync1.trigger('to.owl.carousel', [number, 300]);} else if (number==start) { sync2.trigger('prev.owl.carousel'); sync1.data('owl.carousel').to(number, 300, true); } else { sync1.data('owl.carousel').to(number, 300, true); }});prrelate(); $('.rightfullkf').owlCarousel({ loop:false, rewind: true, margin:15, lazyLoad:false, nav:true, dots: false, autoplay: true, autoplayTimeout:5000, items:2, autoHeight:true, navText: ['', ''], }); $('.rightfullkfgh').owlCarousel({ loop:false, rewind: true, margin:15, lazyLoad:false, nav:true, dots: false, autoplay: true, autoplayTimeout:5000, items:3, autoHeight:true, navText: ['', ''], }); $('.quat').each(function(){if ($(this).length > 0) { $(this).parents('.kmhx').find('.select_km').attr('checked',true); } }); var idpost = $('#hdfProductID').val(); var type = $('body').attr('data-type'); var height_hu = $('.content').height(); if (height_hu > 300) { $('.content').css('height', '500px'); $('.content').css('overflow', 'hidden'); $('
Xem thêm
').insertAfter('.content'); }$('body').on('click',".tab_content .youtube", function(e){ e.preventDefault(); var k = getParameterByName('v',$(this).attr('data-link')); $(this).parents('p').html('') }); $('body').on('click',".gallery-rating__box__hd__btns__rate-btn", function(e){ e.preventDefault(); var l = $(this).attr('data'); var idproduct = $('.page-type-product').attr('data-id'); var $this = $(this); const $la = $(this).attr('data'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { l: l, idproduct: idproduct, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'galleryrating' },beforeSend: function(){ $(".page-type-product").prepend('
'); }, success: function (data) { $('#preloader').remove(); $this.addClass('active'); $('.gallery-rating__box__hd__thank-you').addClass('active'); $('.gallery-rating').addClass('disabled-all-events'); if ($la == 0) { $('.modal_slider_nb').css('display','block'); $('.gallery-rating-popup__content__body__btn-submit').attr('data-id',data); } }, }); }); $('body').on('click',".popup-video-rating__content__action", function(e){ e.preventDefault(); var idvd = $(this).attr('data-vd'); var idproduct = $('.page-type-product').attr('data-id'); var $this = $(this); var $z = $(this).attr('data-vd'); var l = $(this).attr('data-l'); var $la = $(this).attr('data-l'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { idvd: idvd, l: l, idproduct: idproduct, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'videorating' },beforeSend: function(){ $(".page-type-product").prepend('
'); }, success: function (data) { $('#preloader').remove(); $('.popup-video-rating').removeClass('active'); var uk = $('.popup-video-rating').attr('data-dged'); if (uk) { const arr = uk.split(','); arr.push($z); } else { var arr = $z; } $('.popup-video-rating').attr('data-dged',arr); if ($la == 2) { $('.modal_slider_nb').css('display','block'); $('.modal_slider_nb').attr('data-type','VideoGallery'); $('.gallery-rating-popup__content__body__btn-submit').attr('data-id',data); } }, }); }); $('body').on('click',".question-name-right a", function(e){ e.preventDefault(); var l = $(this).attr('data-i'); var idproduct = $('.page-type-product').attr('data-id'); var $this = $(this); const $la = $(this).attr('data-i'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { l: l, idproduct: idproduct, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'contentrating' },beforeSend: function(){ $(".page-type-product").prepend('
'); }, success: function (data) { $('#preloader').remove(); if ($la == 2) { $('.modalslidernd').css('display','block'); $('.button-send-report-survey').attr('data-id',data); $('.main-form').remove(); } else { $('.main-form').html('Cảm ơn phản hồi của Bạn'); } }, }); }); $('body').on('click',".vehicck", function(){ if ($(this).prop('checked')) { $(this).val(1); $(this).addClass('activeip'); } else { $(this).val(0); $(this).removeClass('activeip'); } if($('.activeip').length > 0) { $('.button-send-report-survey').addClass('activegd'); } else { $('.button-send-report-survey').removeClass('activegd'); } }); $('body').on('click',"a.button-send-report-survey.activegd", function(e){ e.preventDefault(); var l = $(this).attr('data-id'); var vehic1 = $('.vehic1').val(); var vehic2 = $('.vehic2').val(); var vehic3 = $('.vehic3').val(); var content = $('.crm-survey-textarea').val(); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { l: l, vehic1: vehic1, vehic2: vehic2, vehic3: vehic3, content: content, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'contentratingct' },beforeSend: function(){ $(".page-type-product").prepend('
'); }, success: function (data) { $('#preloader').remove(); $('.modalslidernd').html('Cảm ơn phản hồi của Bạn'); $('.modalslidernd').css('text-align','center') }, }); }); $('body').on('click',".gallery-rating-popup__content__body__genders__option", function(e){ e.preventDefault(); $('.gallery-rating-popup__content__body__genders__option').removeClass('active'); $(this).addClass('active'); var a = $(this).attr('data-value'); $('input[name="inputGender"]').val(a); }); $('body').on('click',".gallery-rating-popup__content__body__btn-submit", function(e){ var id = $(this).attr('data-id'); var inputContent = $('textarea[name="inputContent"]').val(); var inputGender = $('input[name="inputGender"]').val(); var inputFullName = $('input[name="inputFullName"]').val(); var inputPhoneNumber = $('input[name="inputPhoneNumber"]').val(); var inputEmail = $('input[name="inputEmail"]').val(); var li = $('.modal_slider_nb').attr('data-type'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { id: id, inputContent: inputContent, inputGender: inputGender, inputFullName: inputFullName, inputPhoneNumber: inputPhoneNumber, inputEmail: inputEmail, li: li, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'galleryrating_kt' }, success: function (data) { if (data == 1) { $('.gallery-rating-popup__content__body__rating-success').html('Đánh giá không hợp lệ'); $('.gallery-rating-popup__content__body__rating-success').css('display','block'); } else if (data == 2) { $('.gallery-rating-popup__content__body__rating-success').html('Vui lòng nhập thêm góp ý'); $('.gallery-rating-popup__content__body__rating-success').css('display','block'); } else { $('.modal_slider_nb').css('display','none'); $('.modal_slider_nb').removeAttr('data-type'); }}, }); }); $('body').on('click',".gallery-rating-popup__content__title__close", function(e) { $('.modal_slider_nb').css('display','none'); }); $('body').on('click','.xemthem', function(e){ e.preventDefault(); $('#thumb-article').click(); });$('body').on('click','.show-more', function(e){ e.preventDefault(); $('.article').css('height','auto'); $(this).remove(); }); slidehasp(); $(".ent-section-header").addClass("closed"); $('.ent-section-header').click(function() { let $this = $(this);$this.toggleClass("closed active"); $this.siblings().slideToggle(); return false; }); $('body').on('click',".total-imgslider, .hsp.owl-carousel .thumbnail-sl,.thumb-article, .btn-xemthem", function(e){ e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); $this2 = $(this); $this = $(this).find('img'); $dttab = $(this).attr('data-tab'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { idproduct: idproduct, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'load_tab_slider' },beforeSend: function(){$(".page-type-product").prepend('
'); }, success: function (data) { $('#preloader').remove(); if ($dttab==4 || $dttab==5 || $dttab==6) { var stt_tab = $dttab; } else { var stt_tab = $('.box-inner .active').attr('data-tab'); }var urlcurrent = $this.attr('src'); if (stt_tab==3) { var oArray = []; if ($($this2).attr('class') =='total-imgslider') { o = $($this2).find('.slider-counter').attr('data-count'); oArray.push(o); } else { $(data).find('#hinhsp2 .thumbnail-sl img').each(function(){ src = $(this).attr('src'); o = $(this).parents('.thumbnail-sl').index(); if (src == urlcurrent) { oArray.push(o); } }); } } if (stt_tab==2) { var oArray1 = []; $(data).find('#hinhthucte2 .thumbnail-sl img').each(function(){ src = $(this).attr('src'); o = $(this).parents('.thumbnail-sl').index(); if (src == urlcurrent) { oArray1.push(o); }}); } $('.contentslider').html(data); $('.modal_slider').css('display','block'); $('html, body').css('overflow','hidden'); slide_video_sp(); slide_hinhthucte(oArray1); slide_sanpham(oArray); $('#tabs a:not(#tab'+stt_tab+')').addClass('inactive'); $('.containerz:not(#tab'+stt_tab+'C)').css('display','none'); var w_item = ($('.modal_content_slider').width() - 20 - 90)/10; $('#hinhsp2, #hinhthucte2').css('height',w_item); var w_item_2 = parseInt(w_item) + 110; $('#hinhsp1, #hinhthucte1').css({ 'height': 'calc(100vh - ' + w_item_2 + 'px)' }); var height_para = $('.modal_content_slider').height() - 100; if ($('.div-para1').height() > height_para) { $('.div-para1').css('height',height_para); $('.div-para1').css('overflow-x','hidden'); $('.div-para1').css('overflow-y','scroll'); } $('.tab_content').css('height',height_para); $('.tab_content').css('overflow-x','hidden'); $('.tab_content').css('overflow-y','scroll'); }, }); });$('body').on('click',"#tabs a", function(e){ e.preventDefault(); var t = $(this).attr('id'); $('#tabs a').addClass('inactive');$(this).removeClass('inactive'); $('.containerz').css('display','none'); var img_thumbnailsl = $('#'+ t + 'C .hsp .owl-stage .owl-item:nth-child(1) img').height(); $('#'+ t + 'C').css('display','block'); var height_para = $('.modal_content_slider').height() - 100; if ($('.div-para1').height() > height_para) { $('.div-para1').css('height',height_para); $('.div-para1').css('overflow-x','hidden'); $('.div-para1').css('overflow-y','scroll'); } if ($('.tab_content').height() > height_para) { $('.tab_content').css('height',height_para); $('.tab_content').css('overflow-x','hidden'); $('.tab_content').css('overflow-y','scroll'); } $('.popup-video-rating').removeClass('active'); });$('body').on('click','.dlx', function(e){ e.preventDefault(); var quat = $('.quat').val(); if (typeof quat ==="undefined") { $('.plChoose-proColor').html('* Vui lòng chọn quà tặng'); $('.plChoose-proColor').css('margin-top','10px'); } }); $('body').on('click','.close_slider', function(e){ e.preventDefault(); $('.modal_slider').css('display','none'); $('.contentslider').html(''); $('html, body').css('overflow','auto'); $('.popup-video-rating').removeClass('active'); }); $('body').on('click',".xdsq", function(e){ e.preventDefault(); var idy = $(this).attr('data-id'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { idy: idy, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'showdsspt' },beforeSend: function(){ $(".page-type-product").prepend('
'); }, success: function (data) { $('#preloader').remove(); $('.modal_showimgdtkm').html(data); $('.showimgkm').css('display','block'); const h_sp = $('.contentshowimgdtkm').height(); const pu = $('.modal_showimgdtkm').height(); if (h_sp > pu) { $('.modal_showimgdtkm').css('overflow-y','scroll'); } }, }); });$('body').on('click',".select_km", function(e){ e.preventDefault(); $(this).parents('.kmhx').find('.xdsq').click(); }); $('body').on('click',".cqngay", function(e){ e.preventDefault(); var $km = $(this).attr('data-km'); var i = $(this).attr('data-i'); var idproduct = $('.page-type-product').attr('data-id'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { idproduct: idproduct, i: i, km: $km, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'showkminkm' }, success: function (data) { $('.listqtkm').remove(); $('.xdsq').html('chọn quà tại đây'); $('.xdsq').removeClass('dq'); $('.kmhx .select_km' ).attr( 'checked', false ); $("
"+data+"
").insertAfter('.kmhx-'+$km+' .kmhx_nd > span'); $('.kmhx-'+$km+' .xdsq').html('(Đổi quà)'); $('.kmhx-'+$km+' .xdsq').addClass('dq'); $('.kmhx-'+$km+' .select_km').prop( 'checked', true ); $('.showimgkm').css('display','none'); $('.btn-buynow').removeClass('dlx'); $('.plChoose-proColor').html(''); }, }); }); $('body').on('click',".close_showimgdtkm", function(e){ e.preventDefault(); $('.showimgkm').css('display','none'); }); }); $(document).ready(function () { $('.btnRatingUpload').bind('click', function () { $this = $(this); $this.parents('.formkh').find('.hdFileRatingUpload').click(); }); $('.hdFileRatingUpload').change(function (e) { e.preventDefault(); $this = $(this); var id = $(this).attr('id'); var error_images =''; var form_data = new FormData(); var files = $('#' + id)[0].files; if (files.length > 100) { error_images +='Bạn không thể chọn nhiều hơn 100 ảnh'; } else { for (var i = 0; i < files.length; i++) { var name = document.getElementById(id).files[i].name; var ext = name.split('.').pop().toLowerCase(); if (jQuery.inArray(ext, ['gif', 'png', 'jpg', 'jpeg']) == -1) { error_images +='
Invalid ' + i + ' File
'; } var oFReader = new FileReader(); oFReader.readAsDataURL(document.getElementById(id).files[i]); var f = document.getElementById(id).files[i]; var fsize = f.size || f.fileSize; if (fsize > 10000000) { error_images +='
Bạn chỉ có thể up ảnh dưới 10Mb
'; alert(error_images); } else { form_data.append('file[]', document.getElementById(id).files[i]); } } } form_data.append("action", "upload_star_product"); form_data.append("_token", "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R"); if (error_images =='') { $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: form_data, contentType: false, cache: false, processData: false, beforeSend: function () { $('#error_multiple_files').html(); }, success: function (data) { $('#error_multiple_files').html(); $this.parents('.formkh').find('.resImg_hdFileRatingUpload').prepend(data); $this.parents('.formkh').find('.hdFileRatingUpload').val(''); return false; } }); } else { $this.parents('.formkh').find('.hdFileRatingUpload').val(''); $this.parents('.formkh').find('.error_multiple_files').html(); return false; } }); $.fn.extend({ toggleText: function (a, b) { var isClicked = false; var that = this; this.click(function () { if (isClicked) { that.text(a); isClicked = false; } else { that.text(b); isClicked = true; } }); return this; } }); $('body').on('click','.delete_img_upload_cmt', function(e) {e.preventDefault(); var id = $(this).attr('id'); $('.data_edit_'+id).remove(); }); $('body').on('click', '#guidanhgia', function(e){ e.preventDefault(); $this = $(this); var stardata = $("#formstar").serialize(); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data : { stardata : stardata, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action : 'data_star_product' },beforeSend: function(){ $(".page-type-product").prepend('
'); }, success : function(data) { $('#preloader').remove(); $this.parents('.formkh').find('.if .alert').css('display', 'block'); if (data==0) { $this.parents('.formkh').find('.if .alert').text('Yêu cầu vote 1-5 sao, nhập thông tin đầy đủ'); } else { $this.parents('.formkh').find('.ratingLst').prepend(data); $this.parents('.formkh').find('.if .alert').text('Gửi đánh giá thành công'); $this.parents('.formkh').find('#fRContent').val(''); $this.parents('.formkh').find('#fRPhone').val(''); $this.parents('.formkh').find('#fRName').val(''); $this.parents('.formkh').find('#fREmail').val(''); $this.parents('.formkh').find('.hdFileRatingUpload').val(''); $this.parents('.formkh').find('.resImg_hdFileRatingUpload').html(''); $('.input_formstar').css('display','none'); $('.hux_m').remove(); $('html').css('overflow','auto'); }} }); }); $('.click_show_cmt').on('click', function () { $('#formstar').toggle(); $('.click_show_cmt').toggleClass('close-btt'); $('html, body').css('overflow','hidden'); $('html').append(''); }); $('#s1').on('click', function () { $('#s1').removeClass('icontt-star-p-dark'); $('#s1').addClass('icontt-star-p'); $('#s2').removeClass('icontt-star-p'); $('#s3').removeClass('icontt-star-p'); $('#s4').removeClass('icontt-star-p'); $('#s5').removeClass('icontt-star-p'); $('#s2').addClass('icontt-star-p-dark'); $('#s3').addClass('icontt-star-p-dark'); $('#s4').addClass('icontt-star-p-dark'); $('#s5').addClass('icontt-star-p-dark'); var content ='Không thích'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s2').on('click', function () { $('#s1').removeClass('icontt-star-p-dark'); $('#s2').removeClass('icontt-star-p-dark'); $('#s1').addClass('icontt-star-p'); $('#s2').addClass('icontt-star-p'); $('#s3').removeClass('icontt-star-p'); $('#s4').removeClass('icontt-star-p'); $('#s5').removeClass('icontt-star-p'); $('#s3').addClass('icontt-star-p-dark'); $('#s4').addClass('icontt-star-p-dark'); $('#s5').addClass('icontt-star-p-dark'); var content ='Tạm được'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s3').on('click', function () { $('#s1').removeClass('icontt-star-p-dark'); $('#s2').removeClass('icontt-star-p-dark'); $('#s3').removeClass('icontt-star-p-dark'); $('#s1').addClass('icontt-star-p'); $('#s2').addClass('icontt-star-p'); $('#s3').addClass('icontt-star-p'); $('#s4').removeClass('iconcom-star'); $('#s5').removeClass('iconcom-star'); $('#s4').addClass('icontt-star-p-dark'); $('#s5').addClass('icontt-star-p-dark'); var content ='Bình thường'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s4').on('click', function () { $('#s1').removeClass('icontt-star-p-dark'); $('#s2').removeClass('icontt-star-p-dark'); $('#s3').removeClass('icontt-star-p-dark'); $('#s4').removeClass('icontt-star-p-dark'); $('#s1').addClass('icontt-star-p'); $('#s2').addClass('icontt-star-p'); $('#s3').addClass('icontt-star-p'); $('#s4').addClass('icontt-star-p'); $('#s5').removeClass('icontt-star-p'); $('#s5').addClass('icontt-star-p-dark'); var content ='Rất tốt'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s5').on('click', function () { $('#s1').removeClass('icontt-star-p-dark'); $('#s2').removeClass('icontt-star-p-dark'); $('#s3').removeClass('icontt-star-p-dark'); $('#s4').removeClass('icontt-star-p-dark'); $('#s5').removeClass('icontt-star-p-dark'); $('#s1').addClass('icontt-star-p'); $('#s2').addClass('icontt-star-p'); $('#s3').addClass('icontt-star-p'); $('#s4').addClass('icontt-star-p'); $('#s5').addClass('icontt-star-p'); var content ='Tuyệt vời quá'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('.lStar > i').on('click', function () { $('.ipt').css('display', 'block'); var id = $(this).attr('id').replace(/[^0-9]/gi, ''); var id_int = parseInt(id, 10); $('#hdfStar').val(id_int); }); $("#fRContent").keyup(function () { $(".ckt").text(($(this).val().length) + " kí tự (tối thiểu 80 kí tự)"); }); $('body').on('click', '.cmtr', function (e) { e.preventDefault(); var id = $(this).attr('data-id'); var dataclass = $(this).attr('data-class'); $('.modal_cmtpost').show(); $(".cn_tt_cmtpost").attr("id", id); $(".cn_tt_cmtpost").attr("data-class", dataclass); var parent = $(this).attr('id'); $('.readycss_p').addClass('reply_input'+parent+dataclass); $('.cn_tt_cmtpost').attr('id',parent); $('html, body').css('overflow','hidden'); }); $('body').on('click','.close_cmtpost, .hdgia_cmt', function(e) {$('.modal_cmtpost').hide(); $('html, body').css('overflow','auto'); $('.hux_m').remove(); }); $('body').on('click','.hdgia_tl_cmt', function(e) {$('.modal_p_cmt').toggle(); $('html, body').css('overflow','auto'); }); $('body').on('click','.yeuthich', function(e) {e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); var $this = $(this); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", idproduct: idproduct, action: 'yeuthich' }, beforeSend: function(){ $this.css('pointer-events','none'); }, success: function (data) { $('.yeuthich .iconwt-yeuthich').addClass('yeuthich_x'); $('.yeuthich_x').removeClass('iconwt-yeuthich'); $('.yeuthich').addClass('yeuthich_2'); $('.yeuthich_2').removeClass('yeuthich'); if ($('.ytcou').length > 0) { var cr_c = parseInt($('.ytcou').text())+1; $('.ytcou').html(cr_c); } else { $('.favorite_x span').html('(
1
)'); }$this.css('pointer-events','auto'); } }); }); $('body').on('click','.yeuthich_2', function(e) {e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); var $this = $(this); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", idproduct: idproduct, action: 'watch_unlike' }, beforeSend: function(){ $this.css('pointer-events','none'); }, success: function (data) { $('.yeuthich_2 .yeuthich_x').addClass('iconwt-yeuthich'); $('.iconwt-yeuthich').removeClass('yeuthich_x'); $('.yeuthich_2').addClass('yeuthich'); $('.yeuthich').removeClass('yeuthich_2'); var cr_c = parseInt($('.ytcou').text())-1; $('.ytcou').html(cr_c); $this.css('pointer-events','auto'); } }); }); $('body').on('click', '.cn_tt_cmtpost', function (e) { e.preventDefault(); var parent = $(this).attr('id'); var dataclass = $(this).attr('data-class'); var cfmUserName = $('.modal_cmtpost .cfmUserName').val(); var cfmUserPhone = $('.modal_cmtpost .cfmUserPhone').val(); var cfmUserEmail = $('.modal_cmtpost .cfmUserEmail').val(); var content = $('.reply_input' + parent + dataclass).val(); var hdfProductID = $('#hdfProductID').val();if (parent =='' || cfmUserName =='' || cfmUserPhone =='' || content =='') { alert('Bạn phải điền đầy đủ thông tin') } else { $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", dataclass: dataclass, parent: parent, cfmUserName: cfmUserName, cfmUserPhone: cfmUserPhone, cfmUserEmail: cfmUserEmail, hdfProductID: hdfProductID, content: content, action: 'reply_product' }, success: function (data) { $('.modal_cmtpost').hide(); $('#r-' + parent + dataclass).append(data); $('.cfmUserName').val(''); $('.cfmUserEmail').val(''); $('.reply_input' + parent + dataclass).val(''); $(".cn_tt").attr("id", ''); $('html, body').css('overflow','auto'); }, error: function () { $('#formstar .alert').removeClass('hidden'); $('#formstar .alert').html('Đã có lỗi xảy ra, hãy thử lại.'); } }); } }); $('body').on('click', '.load_more_star', function (e) { e.preventDefault(); $this = $(this); var p = $(this).attr('data-p'); var v = $(this).attr('data-v'); var idproduct = $('.page-type-product').attr('data-id'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", p: p, v: v, idproduct: idproduct, action: 'load_more_star' }, beforeSend: function(){ $this.prepend('
'); }, success: function (data) { setTimeout(function() { $('.cont_bl').append(data); var p_c = parseInt($this.attr('data-p'))+1; $this.attr('data-p',p_c); var c = parseInt($this.attr('data-c')); if ((p_c - 1)*5 >= c) { $this.remove(); } $('.bubblingG').remove(); }, 3000); }, error: function () { } }); }); $('body').on('click', '.load_more_cmt', function (e) { e.preventDefault(); $this = $(this); var p = $(this).attr('data-p'); var idproduct = $('.page-type-product').attr('data-id'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", p: p, idproduct: idproduct, action: 'load_more_cmt' }, success: function (data) { $('.cont_bl_cmt').append(data); var p_c = parseInt($this.attr('data-p'))+1; $this.attr('data-p',p_c); var c = parseInt($this.attr('data-c')); if ((p_c - 1)*3 >= c) { $this.remove(); } }, error: function () { } }); }); $('body').on('click','.cont_bl .rat img', function(e) { e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); $this = $(this); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", idproduct: idproduct, action: 'load_star_img' }, success: function (data) { var urlcurrent = $this.attr('src'); var oArray = []; $(data).find('.ent-src').each(function(){ src = $(this).attr('src'); o = $(this).parents('.hs_slider').index(); if (src == urlcurrent) { oArray.push(o); }}); $('.contentshowimgdt').html(data); $('.showimgdt').css('display','block'); $('html,body').css('overflow','hidden'); sliderimgstar(oArray); }, error: function () { } });}); $('body').on('click','.close_showimgdt', function(e) { e.preventDefault(); $('.showimgdt').css('display','none'); $('.contentshowimgdt').html(''); $('html,body').css('overflow','auto'); }); $('body').on('click','.cmtl', function(e) {e.preventDefault(); var idrating = $(this).attr('data-rate'); var $this = $(this); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", idrating: idrating, action: 'likerating' }, success: function (data) { if (data==0) { return false; } else { $this.html(data); } }, error: function () { } }); }); $('body').on('click','.cmtlcmt', function(e) {e.preventDefault(); var idrating = $(this).attr('data-rate'); var $this = $(this); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", idrating: idrating, action: 'likeratingcmt' }, success: function (data) { if (data==0) { return false; } else { $this.html(data); } }, error: function () { } }); }); $('body').on('click','.container-checkbox', function(e) { e.preventDefault(); $(this).find('input').toggleClass('checkedx'); var list_id_product = $('.container-checkbox').find('.checkedx').map(function(){ return this.value; }).get(); var id_product_current = $('body').attr('data-id'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", list_id_product: list_id_product, id_product_current: id_product_current, action: 'giamthem_pkkmk' }, success: function (data) { var obj = $.parseJSON( JSON.stringify(data) ); $('.tt_x').html(obj.data.sale_price); $('.gia_ttx').html(obj.data.sell_price); $('.gia_tkx2').html('Tiết kiệm '+obj.data.tk); $('.right_bottom_dh').html(' MUA NGAY '+obj.data.count+' SẢN PHẨM'); $('.right_bottom_dh').attr('href',obj.data.list_product); }, error: function () { } }); });$('body').on('click','.title_filter_rv', function(e) {e.preventDefault(); $('.arrow-filter').toggle(); $('.ul_item_rv').toggle(); }); $('body').on('click','.ul_item_rv_item', function(e) { e.preventDefault(); $('.ul_item_rv_item').removeClass('active'); $(this).addClass('active'); $('.ul_item_rv').css('display','none'); $('.arrow-filter').css('display','none'); var idproduct = $('.page-type-product').attr('data-id'); var r = $(this).attr('data-v'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", r: r, idproduct: idproduct, action: 'load_filter_star' }, success: function (data) { $('.cont_bl_t').html(data);if ($('.load_more_star').attr('data-c')) { var count = parseInt($('.load_more_star').attr('data-c')); } else { var count = parseInt($('.cont_bl .par').length); }$('#boxRatingCmt .title_dg').html(count + ' đánh giá'); }, error: function () { } }); }); $('body').on('click','.btnYt', function(e) {var urlk = $(this).parents('.youtube-play').attr('data-link'); var c = new URL(urlk); var ufli ='https://www.youtube.com/embed/'+c.searchParams.get("v")+'?autoplay=1'; $(this).parents('.youtube-play').html(''); }); $('body').on('click','.youtube', function(e) {var urlk = $(this).attr('data-link'); var c = new URL(urlk); var ufli ='https://www.youtube.com/embed/'+c.searchParams.get("v")+'?autoplay=1'; $(this).parents('p').html(''); }); });jQuery(document).ready(function($) { $('body').on('click', '#p_guidanhgia', function(e){ e.preventDefault(); $this = $(this); var commentdata = $("#input_cmt").serialize(); var posttype = $(this).attr('data-posttype'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data : { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", commentdata : commentdata, posttype : posttype, action : 'p_comment' }, success : function(data) { if (data==0) { $this.parents('.extCt').find('.alert').text('Số điện thoại, Tên, Nội dung bình luận là bắt buộc'); $this.parents('.extCt').find('.alert').css('display','block'); } else { $('.ratingLst .cont_bl_cmt').prepend(data); $('#input_cmt').hide(); $('html, body').css('overflow','auto'); $('.hux_m').remove();$('#p_name').val(''); $('#p_phone').val(''); } } }); }); $('body').on('click', '.hdgia', function(e){ e.preventDefault();$('.input_formstar').css('display','none'); $('.hux_m').remove(); $('html, body').css('overflow','auto'); }); $('body').on('click', '.tlcmtr', function(e){ e.preventDefault();var id = $(this).attr('id');$('.tlrr-'+id).css('display','block'); }); $('body').on('click', '.tlcmtr', function (e) { e.preventDefault(); var dataclass = $(this).attr('data-class');var id = $(this).attr('data-id'); var dataclass = $(this).attr('data-class'); $('.modal_p_cmt').show(); $(".b_r_p_button").attr("id", id); $(".b_r_p_button").attr("data-class", dataclass); var parent = $(this).attr('id'); $('.readycss').addClass('reply_input'+parent+dataclass); $('.b_r_p_button').attr('id',parent); $('html, body').css('overflow','hidden'); }); $('body').on('click','.p_close_cmtpost', function(e) {$('.modal_p_cmt').hide(); $('#readycss').attr('class',''); $('#readycss').addClass('readycss'); $('html, body').css('overflow','auto'); }); $('body').on('click', '.b_r_p_button', function (e) { e.preventDefault(); var dataclass = $(this).attr('data-class'); var parent = $(this).attr('id'); var r_p_name = $('.r_p_name').val(); var r_p_phone = $('.r_p_phone').val(); var content = $('.reply_input' + parent + dataclass).val(); var p_id = $('#p_id').val(); if (parent =='' || r_p_name =='' || r_p_phone =='' || content =='') { alert('Bạn phải điền đầy đủ thông tin') } else { $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", dataclass: dataclass, parent: parent, name: r_p_name, phone: r_p_phone, p_id: p_id, content: content, action: 'cmt_product' }, success: function (data) { $('.modal_p_cmt').hide(); $('#r-' + parent + dataclass).append(data); $('.r_p_name').val(''); $('.r_p_mail').val(''); $('.reply_input' + parent + dataclass).val(''); $(".b_r_p_button").attr("id", ''); }, error: function () { $('#formstar .alert').removeClass('hidden'); $('#formstar .alert').html('Đã có lỗi xảy ra, hãy thử lại.'); } }); } }); $('body').on('click','#thumb-images-gallery-tt',function(e){ e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); $('.box-inner-item').removeClass('active'); $(this).addClass('active'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { idproduct: idproduct, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'gallery_tt' }, success: function (data) { $('.data-slide').html(data); slidehasp(); scrollafteax(); }, }); });$('body').on('click','#thumb-videos',function(e){ e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); $this2 = $(this); $dttab = $(this).attr('data-tab'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'POST', data: { idproduct: idproduct, _token : "sL8GaBoMOHGFx2jFYBVKwSwbrGs0VRIz5qQrri4R", action: 'load_tab_slider' },beforeSend: function(){$(".page-type-product").prepend('