").appendTo(a))}else r.splice(0,Math.min(l-n,Math.max(r.length-1,0)));e("
").appendTo(r[0]).append(e(" ").text(t.text()).attr("href","#"+ChangeToKd(t.attr("id")))),l=n})})},n=e.fn.toc;e.fn.toc=t,e.fn.toc.noConflict=function(){return e.fn.toc=n,this},e(function(){t.call(e("[data-toc]"))})}(window.jQuery); function gl() { $('.gallery_collection').owlCarousel({ loop:false,rewind: true, margin:20, nav:true, dots: false, autoplay: false, autoplayTimeout:5000, items:2, autoplayHoverPause: true, autoHeight:true, slideBy: "page", smartSpeed: 100, navText: [' ', ' '], }); } function n(v){var va = v.split(':');return a = va[0]} function rf(){ $( ".filter-list, .filter-show-full" ).each(function( k ) {var x = [];$(this).find( ".pthkt" ).each(function( index ) { var p = $(this).attr('data-p'); var o = $(this).attr('data-or'); var n = $(this).attr('data-pn'); var a = o + ":" + p +":"+n; x.push(a);});x.sort(function(a, b){ return parseInt(n(a))- parseInt(n(b));});const unique = arr => [...new Set(arr)];var h="";$.each(unique(x) , function(index, val) { var va = val.split(':'); var row=''+va[2]+'
'; h+=row;});if ($(this).find('.pthkt').length) { $(this).find('.pthkt').parents('.filter-list, .filter-list-full').append(''+h+'
');} else { $(this).find('.pthkt').parents('.filter-list, .filter-list-full').prepend(''+h+'
');}$(this).find('.pthkt').parents('.filter-list, .filter-list-full').find('a.c-btnbox').css('display','none');$(this).find('.pthkt').parents('.filter-list, .filter-list-full').addClass('nwnhq');$(this).find( ".pthkt.check" ).each(function( index ) { var p = $(this).attr('data-p');$('.hjkkskl'+p).addClass('activehk');});var y = [];$(this).find( ".pthkthh" ).each(function( index ) { var p = $(this).attr('data-p'); var o = $(this).attr('data-or'); var n = $(this).attr('data-pn'); var i = $(this).attr('data-i'); var a = o + ":" + p +":"+n+":"+i; y.push(a);});y.sort(function(a, b){ return parseInt(n(a))- parseInt(n(b));});var hf="";$.each(unique(y) , function(index, valf) { var vaf = valf.split(':'); var rowf=''+vaf[2]+' '; hf+=rowf;});$(''+hf+' ').insertBefore( ".choosedfilter .reset");$('.choosedfilter .pthkthh').css('display','none'); });} function rmpr(){ $(".filter-list-hkx.props").each(function(){if ($(this).find('a').length == 0) { $(this).parents('.filter-list').remove();} }); } $(document).ready(function() { rmpr(); cr(); $('.padding-pro').owlCarousel({ loop:false,rewind: true, margin:4, lazyLoad:true, nav:true, dots: false, autoplay: false, autoplayTimeout:5000, items:5, autoHeight:true, navText: [' ', ' '], }); $(".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','.hjkks', function(e){e.preventDefault();var i = $(this).attr('data-id');$thispr = $(this).parents('.filter-show');var idcat = $('.page-type-collection').attr('data-id');var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm";if ($(this).hasClass("activehk")) { var bt_d = $(this).attr('data-s'); $('.pt-'+i).removeClass('check'); $(this).removeClass('activehk'); var numItems = $(this).parent('.filter-list').children('.c-btnbox.check').length; $(this).parents('.filter-item').children('.jsTitle.showing').removeClass('showing'); $(this).css('border','1px solid #ED3338'); $(this).css('color','inherit');} else { $(this).addClass('activehk'); $(this).attr('style',''); var bt_d = $(this).attr('data-s'); $('.pt-'+i).addClass('check'); $(this).parents('.filter-show').children('.filter-button').css('display','block'); $(this).parents('.filter-show').find('.btn-filter-readmore').addClass('btn-filter-readmore-check'); var id_att_check = $.map( $(".c-a.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_brand_check = $.map( $(".c-b.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_price_check = $.map( $(".c-p.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); });}var list = $(".c-btnbox.check").parents('.filter-item-pr');var keyObj = {};list.each(function(){ if ($(this).find('.filter-list-hkx').length) {var list2 = $(this).find(".c-btnbox.check").parents('.filter-list-hkx');list2.each(function(){var slug_att = $(this).find('strong').attr('data-alias'); var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){return $(elem).attr('data-id'); }); var a = slug_att + "=" + id_att_check;keyObj[slug_att] = id_att_check.join(",");}); } else {var slug_att = $(this).children('.jsTitlepr').find('span').attr('data-alias');var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){ return $(elem).attr('data-id');});var a = slug_att + "=" + id_att_check; keyObj[slug_att] = id_att_check.join(","); }}); var id_qt123 = $.map( $('.km230 .qt.active'), function(elem){ return $(elem).attr('data-id'); });var id_qt = id_qt123.join(",");if (id_qt) { keyObj['t'] = id_qt;}if(id_km){ var id_km = $('.km230 .k30.active').attr('data-id'); keyObj['k'] = id_km;}if ($.param(keyObj)) { var myUrl ='&'+$.param(keyObj);} else { var myUrl ='&myUrl=1';}$.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data :"idcat="+idcat + "&_token="+token +"&action=viewbtnkq"+myUrl, beforeSend: function(){$thispr.find('.filter-button').css('display','flex');$thispr.find('.filter-button').css('justify-content','center');$('.btn-filter-readmore').html('
'); }, success : function(data) {$thispr.find('.filter-button').css('display','block'); $('.btn-filter-readmore').html(data); var numTotal = parseInt($thispr.find('.total-reloading').text()); if (numTotal == 0) {$('.btn-filter-readmore').removeClass('btn-filter-readmore-check');$('.btn-filter-readmore').addClass('disabled_f'); } else {$('.btn-filter-readmore').addClass('btn-filter-readmore-check');$('.btn-filter-readmore').removeClass('disabled_f'); } } }); }); var idpost = $('body').attr('data-id'); var type = $('body').attr('data-type'); $( ".tuxa a" ).each(function( index ) { if ($(this).attr('href') == window.location.pathname) {$(this).addClass('activenb'); } }); gl(); if($('.ent-content-description h1').length || $('.ent-content-description h2').length || $('.ent-content-description h3').length || $('.ent-content-description h4').length || $('.ent-content-description h5').length || $('.ent-content-description h6').length){$(".ent-content-description h2:first-child").before("Tóm Tắt Nội Dung (Thu gọn) (Mở rộng)
"); $("Tóm Tắt Nội Dung (Thu gọn) (Mở rộng)
").insertAfter(".ent-content-description > p:first-child"); $("#toc").toc({content: ".ent-content-description", headings: "h2,h3"}); $(".tdtale .an").click(function(){ $("#toc").css('display','none'); $(".an").css('display','none'); $(".hien").css('display','inherit'); }); $(".tdtale .hien").click(function(){ $("#toc").css('display','block'); $(".hien").css('display','none'); $(".an").css('display','inherit'); }); } var h_product = $('.ent-content-description').height(); if (h_product > 310) {$('.ent-content-description').css('height','310px');$('.ent-content-description').css('overflow','hidden');$("").insertAfter(".ent-content-description"); } $( 'body' ).on('click', ".show-more", function (e) { e.preventDefault(); var heightStyleValue = $(".ent-content-description")[0].style.height; if (heightStyleValue =='310px') {$('.ent-content-description').css('height','auto'); $(this).remove(); } }); $('.ent-body-1').owlCarousel({ loop:false,rewind: true, margin:10, nav:true, dots: false, autoplayHoverPause: true, autoplay: false, autoplayTimeout:5000, items:5, autoHeight:true, navText: [' ', ' '], }); function removeValue(list, value) {return list.replace(new RegExp(",?" + value + ",?"), function(match) {var first_comma = match.charAt(0) ===',', second_comma; if (first_comma && (second_comma = match.charAt(match.length - 1) ===',')) { return ',';}return '';}); }; function findParam(url, param){ var check ="" + param; if(url.search(check )>=0){ return url.substring(url.search(check )).split('&')[0].split('=')[1]; } }var origOffsetY = $('.box-filter').offset().top + 300; var left_y = ($('.ent-full').width() - $('.ent-container').width())/2; $(window).scroll(function(){ if ($(this).scrollTop() > origOffsetY) { $('.box-filter').css('position','fixed'); $('.box-filter').css('padding-left',left_y); $('.box-filter').css('box-shadow','0px 5px 7px 0px rgb(0 0 0 / 10%)'); } else { $('.box-filter').css('position','relative'); $('.box-filter').css('padding-left',0); $('.box-filter').css('box-shadow','none'); } });$('body').on('click','.ththtext', function(e){e.preventDefault();$('.mo_ta_brand').css('display','block');$('.ththtext').addClass('ththtext_2');$(this).removeClass('ththtext');$('.page-type-collection, footer, header').addClass('bg-black1'); }); $('body').on('click','.bg-black1', function(){ $('.mo_ta_brand').css('display','none');$('.ththtext_2').addClass('ththtext');$('.ththtext_2').removeClass('ththtext_2');$('.page-type-collection, footer, header').removeClass('bg-black1'); }); $('body').on('click','.jsTitle', function(e){ e.preventDefault(); $('.filter-show').css('display','none'); $('.arrow-filter').remove(); $('.jsTitle').removeClass('showing'); $(this).addClass('showing'); $(this).parent('.filter-item').children('.filter-show').css('display','flex'); $(this).parent('.filter-item').children('.filter-show').css('flex-wrap','wrap'); $(this).prepend('
'); var top_x = $(".box-filter").offset().top;$('html, body').animate({ scrollTop: top_x}, 500);if ($('.bwdk').length == 0) { $('body').append('
');} }); $('body').on('click','.bwdk', function(e){$('.filter-show').css('display','none');$('.jsTitle').removeClass('showing');$('.arrow-filter').remove();$(this).remove(); }); $(window).scroll(function() {var top_x = $(".h1_collection").offset().top + 50; var scroll = $(window).scrollTop(); if (scroll >= top_x) { $(".box-filter").addClass("darkHeader"); var pad_l = ($('.ent-full').width() - $('.ent-container').width())/2; $('.darkHeader').css('padding-left',pad_l+'px'); } else {$(".box-filter").removeClass("darkHeader"); } }); $('body').on('click','.jsTitle-t', function(e){ e.preventDefault(); $(this).addClass('showing-t'); $('.jsTitle').removeClass('showing'); $('.jsTitle .arrow-filter').remove(); $(this).parent('.filter-item-t').children('.filter-show').css('display','flex'); $(this).prepend('
'); $(this).removeClass('jsTitle-t'); $('.filter-item .filter-show').css('display','none'); $('.filter-item .filter-show .arrow-filter::before').css('display','none'); var top_x = $(".box-filter").offset().top - 20;$('html, body').animate({ scrollTop: top_x}, 500);if ($('.bgw2').length == 0) { $('body').prepend('
');} }); $('body').on('click','.bgw2', function(e){e.preventDefault();$('.arrow-filter').remove();$('.showing-t').parent('.filter-item-t').children('.filter-show').css('display','none');$('.showing-t').addClass('jsTitle-t');$('.showing-t').removeClass('showing-t');$('body,html').removeClass('bg-black overlay-filter');$(this).remove(); }); $('body').on('click','.showing-t', function(e){e.preventDefault();$('.arrow-filter').remove();$(this).parent('.filter-item-t').children('.filter-show').css('display','none');$(this).removeClass('showing-t');$(this).addClass('jsTitle-t');$('body,html').removeClass('bg-black overlay-filter');$('.bgw2').remove(); }); $('body').on('click','.jsTitle.showing', function(e){ e.preventDefault(); $(this).removeClass('showing'); $(this).parent('.filter-item').children('.filter-show').css('display','none'); $('.arrow-filter, .bwdk').remove(); });$('body').on('click','.c-btnbox', function(e){e.preventDefault();$thispr = $(this).parents('.filter-show');var idcat = $('.page-type-collection').attr('data-id');var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm";var $thisc = $(this);if ($thisc.hasClass("check")) { var bt_d = $(this).attr('data-s'); $('.'+bt_d).removeClass('check'); $(this).removeClass('check'); var numItems = $(this).parent('.filter-list').children('.c-btnbox.check').length; $(this).parents('.filter-item').children('.jsTitle.showing').removeClass('showing');$(this).css('border','1px solid #ccc'); $(this).css('color','inherit');} else { $(this).addClass('check'); $(this).attr('style',''); var bt_d = $(this).attr('data-s'); $('.'+bt_d).addClass('check'); $(this).parents('.filter-show').children('.filter-button').css('display','block'); $(this).parents('.filter-show').find('.btn-filter-readmore').addClass('btn-filter-readmore-check'); var id_att_check = $.map( $(".c-a.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_brand_check = $.map( $(".c-b.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_price_check = $.map( $(".c-p.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); });$(this).css('border','1px solid #ED3338'); $(this).css('color','inherit');}if ($(this).parents('.block-manu-t').length) { var list = $(".c-btnbox.check").parents('.filter-item-pr');} else { var list = $(".c-btnbox.check").parents('.filter-item-pr-2');}var keyObj = {};list.each(function(){ if ($(this).find('.filter-list-hkx').length > 0) {var list2 = $(this).find(".c-btnbox.check").parents('.filter-list-hkx');list2.each(function(){ var slug_att = $(this).find('strong').attr('data-alias'); var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){return $(elem).attr('data-id'); }); var a = slug_att + "=" + id_att_check;keyObj[slug_att] = id_att_check.join(",");}); } else {var slug_att = $(this).children('.jsTitlepr').find('span').attr('data-alias');var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){ return $(elem).attr('data-id');});var a = slug_att + "=" + id_att_check;keyObj[slug_att] = id_att_check.join(","); }});var id_km = $('.km230 .k30.active').attr('data-id'); var id_qt123 = $.map( $('.km230 .qt.active'), function(elem){ return $(elem).attr('data-id'); });var id_qt = id_qt123.join(",");if (id_qt) { keyObj['t'] = id_qt;}if(id_km){ var id_km = $('.km230 .k30.active').attr('data-id'); keyObj['k'] = id_km;}if ($.param(keyObj)) { var myUrl ='&'+$.param(keyObj);} else { var myUrl ='&myUrl=1';} $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data :"idcat="+idcat + "&_token="+token +"&action=viewbtnkq"+myUrl, beforeSend: function(){$thispr.find('.filter-button').css('display','flex');$thispr.find('.filter-button').css('justify-content','center');$('.btn-filter-readmore').html('
'); }, success : function(data) {$thispr.find('.filter-button').css('display','block'); $('.btn-filter-readmore').html(data); var numTotal = parseInt($thispr.find('.total-reloading').text()); if (numTotal == 0) {$('.btn-filter-readmore').removeClass('btn-filter-readmore-check');$('.btn-filter-readmore').addClass('disabled_f'); } else {$('.btn-filter-readmore').addClass('btn-filter-readmore-check');$('.btn-filter-readmore').removeClass('disabled_f'); } } }); }); $('body').on('click','.click-sort', function(e){$(this).parent('.sort-select ').children('.sort-select-main').toggle(); }); $('body').on('click','.btn-filter-readmore-check, .sort a, .paged_ul a, .k30, .qt', function(e){e.preventDefault();var h = $.map( $(".c-a.c-btnbox.check"), function(elem){ return $(elem).attr('href');}); var $thisx = $(this).attr('class'); if ($thisx && $(this).parents('.filter-item-pr-2').find('.c-p').length == 0 && $.unique(h.sort()).length == 1 && $.inArray("#", $.unique(h.sort())) === -1 && $thisx.replace(" ", "") !=='paged_ul_li' && $thisx.replace(" ", "") !=='qt') {window.location.href = $.unique(h.sort())[0]; } else { if ($(this).parents('.sort-select-main').length > 0) {$('.sort a').removeClass('check');$(this).addClass('check'); }; if ($(this).parents('.paged_ul').length > 0) {$('.paged_ul a').removeClass('check');$(this).addClass('check'); }; if ($(this).parents('.km230').length > 0) {$(this).toggleClass('active'); }; var $thiskm = $(this); var id_att_check = $.map( $(".c-a.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_brand_check = $.map( $(".c-b.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_price_check = $.map( $(".c-p.c-btnbox.check"), function(elem){$(this).removeClass('check'); return $(elem).attr('data-id'); }); var id_order = $('.sort a.check').attr('data-id'); var id_km = $('.km230 .k30.active').attr('data-id'); var id_qt123 = $.map( $('.km230 .qt.active'), function(elem){ return $(elem).attr('data-id'); }); var id_qt = id_qt123.join(","); var id_page = $('.paged_ul a.check').attr('data-id'); var idcat = $('.page-type-collection').attr('data-id'); var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm"; if ($(this).parents('.block-manu-t').length) {var list = $(".c-btnbox.check").parents('.filter-item-pr'); } else {var list = $(".c-btnbox.check").parents('.filter-item-pr-2'); } var keyObj = {}; list.each(function(){if ($(this).find('.filter-list-hkx').length > 0) { var list2 = $(this).find(".c-btnbox.check").parents('.filter-list-hkx'); list2.each(function(){ var slug_att = $(this).find('strong').attr('data-alias');var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){ return $(elem).attr('data-id');});var a = slug_att + "=" + id_att_check; keyObj[slug_att] = id_att_check.join(","); }); } else { var slug_att = $(this).find('span').attr('data-alias'); var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){return $(elem).attr('data-id'); }); var a = slug_att + "=" + id_att_check;keyObj[slug_att] = id_att_check.join(",");} }); if (id_order) {keyObj["o"] = id_order; } if (id_km) {keyObj["k"] = id_km; } if (id_qt) {keyObj["t"] = id_qt; } if (id_page) {if($(this).parents('.paged_ul').length > 0){ keyObj["q"] = id_page;} else { keyObj["q"] = 1;} } if ($.param(keyObj)) {var myUrl ='&'+$.param(keyObj);var $ml = myUrl.replace('#',''); } else {var myUrl ='&myUrl=1'; } $thiso = new window.URLSearchParams(myUrl).get('o'); $thisk = new window.URLSearchParams(myUrl).get('k'); $thist = new window.URLSearchParams(myUrl).get('t'); let newUrlIS = window.location.href.split('#')[0] + '#' +decodeURIComponent($.param(keyObj)); var $ml = decodeURIComponent($.param(keyObj)); history.pushState({}, null, newUrlIS);$.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data :"idcat="+idcat + "&_token="+token +"&action=viewproductkq_net"+myUrl, beforeSend: function(){$(".box-filter").removeClass('darkHeader'); $('.products_cat_show').addClass('snowcat');$(".page-type-collection").prepend('');if (navigator.userAgent.search("Firefox") <= - 1) { if ($thisx =='paged_ul_li ') {var topxl = $(".scrollhux").offset().top + 5; } else if ($thisx =='btn-filter-readmore btn-filter-readmore-check') {var topxl = $(".box-filter").offset().top; } else {var topxl = $(".box-filter").offset().top; } $('html, body').animate({ scrollTop: topxl}, 500);} }, success : function(data) {if (navigator.userAgent.search("Firefox") > - 1) { if ($thisx =='paged_ul_li ') {var topxl = $(".box-sort").offset().top; } else if ($thisx =='btn-filter-readmore btn-filter-readmore-check') {var topxl = $(".h1_collection").offset().top + 30; } else {var topxl = $(".box-filter").offset().top; } $('html, body').animate({ scrollTop: topxl}, 500);} $(".box-filter").removeClass('darkHeader');$('html,body').removeClass('bg-black overlay-filter'); $('.page-container-collection').html(data); $('#preloader').remove(); be(); $('.bgw2').remove(); $('.bwdk').remove(); var list = $(".sort a"); list.removeClass('check');list.each(function(){var id_order = $(this).attr('data-id');var o_get = $thiso;if(id_order == o_get){ $(this).addClass('check'); $('.sort-show').html($(this).text());} }); if($thisk == 1){$('.k30').addClass('active'); } else {$('.k30').removeClass('active'); } var listt = $(".qt");listt.each(function(){var id_order = $(this).attr('data-id');if ($thist) {var o_get = $thist.split(','); if($.inArray(id_order, o_get) != -1){$(this).addClass('active'); }} }); gl();rf();z($ml); } }); } }); $('body').on('click','.btn-filter-close', function(e){e.preventDefault(); $(this).parents('.filter-show').find('.c-btnbox').removeClass('check');if ($(this).parents('.block-manu-t').length) {var list = $(".c-btnbox.check").parents('.filter-item-pr'); } else {var list = $('.filter-item-pr-2'); } var keyObj = {};list.each(function(){ if ($(this).find('.filter-list-hkx').length) {var list2 = $(this).find(".c-btnbox.check").parents('.filter-list-hkx');list2.each(function(){ var slug_att = $(this).find('strong').attr('data-alias'); var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){return $(elem).attr('data-id'); }); var a = slug_att + "=" + id_att_check;keyObj[slug_att] = id_att_check.join(",");}); } else {var slug_att = $(this).find('.jsTitlepr').find('span').attr('data-alias');var id_att_check = $.map( $(this).find(".c-btnbox.check"), function(elem){ return $(elem).attr('data-id');});if(id_att_check.length){ var a = slug_att + "=" + id_att_check; keyObj[slug_att] = id_att_check.join(",");} }}); var id_order = $('.sort a.check').attr('data-id');var id_page = $('.paged_ul a.check').attr('data-id'); var id_km = $('.km230 .k30.active').attr('data-id'); var id_qt123 = $.map( $('.km230 .qt.active'), function(elem){ return $(elem).attr('data-id'); });var id_qt = id_qt123.join(",");if (id_qt) { keyObj['t'] = id_qt;}if(id_km){ var id_km = $('.km230 .k30.active').attr('data-id'); keyObj['k'] = id_km;}if (id_order) { keyObj["o"] = id_order;}if (id_page) { if($(this).parents('.paged_ul').length > 0){keyObj["q"] = id_page; } else {keyObj["q"] = 1; } }if ($.param(keyObj)) { var myUrl ='&'+$.param(keyObj); var $ml = myUrl.replace('#','');} else { var myUrl ='&myUrl=1';}let newUrlIS = window.location.href.split('#')[0] + '#' +decodeURIComponent($.param(keyObj)); history.pushState({}, null, newUrlIS);$.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data :"idcat="+idcat + "&_token="+token +"&action=viewproductkq_net"+myUrl, beforeSend: function(){$('.products_cat_show').addClass('snowcat'); $(".page-type-collection").prepend(''); $('html, body').animate({scrollTop: $(".box-filter").offset().top }, 500); }, success : function(data) {$('html,body').removeClass('bg-black overlay-filter'); $('.page-container-collection').html(data); $('#preloader').remove(); be(); var list = $(".sort a"); list.removeClass('check'); list.each(function(){ var id_order = $(this).attr('data-id'); var o_get = $thiso; if(id_order == o_get){$(this).addClass('check');$('.sort-show').html($(this).text()); }});if($thisk == 1){ $('.k30').addClass('active');} else { $('.k30').removeClass('active');}var listt = $(".qt"); listt.each(function(){ var id_order = $(this).attr('data-id'); if ($thist) { var o_get = $thist.split(',');if($.inArray(id_order, o_get) != -1){ $(this).addClass('active');} }}); gl();rf();z($ml); } }); }); $('body').on('click','.choosedfilter a.reset, .resetall', function(e){e.preventDefault();$('.c-btnbox').removeClass('check');var id_att_check = $.map( $(".c-btnbox.check"), function(elem){ $(this).removeClass('check'); return $(elem).attr('data-id'); }); var idcat = $('.page-type-collection').attr('data-id'); var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm"; let newUrlIS = window.location.href.split('#')[0]; history.pushState({}, null, newUrlIS);$.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data : "idcat="+idcat + "&_token="+token +"&action=viewproductkq_net", beforeSend: function(){$('.products_cat_show').addClass('snowcat'); $(".page-type-collection").prepend(''); $('html, body').animate({ scrollTop: $(".box-filter").offset().top}, 500); }, success : function(data) { $('html,body').removeClass('bg-black overlay-filter'); $('.page-container-collection').html(data); $('#preloader').remove(); $('.bgw2').remove();rf(); } }); });$('.ctth').owlCarousel({ loop:false,rewind: true, margin:15, lazyLoad:true, nav:true, dots: false, autoplay: false, autoplayTimeout:5000, items:4, autoHeight:true, navText: [' ', ' '], }); $('.rightfullkf').owlCarousel({ loop:false,rewind: true, margin:15, lazyLoad:true, nav:true, dots: false, autoplay: false, autoplayTimeout:5000, items:2, autoHeight:true, navText: [' ', ' '], }); $('body').on('click','.hjkkshk', function(e){e.preventDefault();var im = $(this).attr('data-i');var id = $(this).attr('data-id');var idcat = $('.page-type-collection').attr('data-id');var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm";var hashtag = window.location.hash;var list_id_cr = findParam(hashtag,im);var l = $(this).attr('data-id');var list = $('.pthh-'+l);var y = list_id_cr.split(',');list.each(function(){ var idh = $(this).attr('data-id'); y.splice( $.inArray(idh, y), 1 )});var s = y.join(",");if (s) { var id_cl = s; var new_cl = im+'='+id_cl; var old_cl = im+'='+list_id_cr; var new_hashtag = hashtag.replace(old_cl, new_cl); var new_hashtag = new_hashtag.replace('#','&');} else { var old_cl = im+'='+list_id_cr; var new_hashtag = hashtag.replace(old_cl, ''); var new_hashtag = new_hashtag.replace('#','&'); var new_hashtag = new_hashtag.replace('&&','&');}$.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data : "idcat="+idcat + "&_token="+token +"&action=viewproductkqafdel"+new_hashtag, beforeSend: function(){$('.products_cat_show').addClass('snowcat'); }, success : function(data) { $('.page-container-collection').prepend(data); $('#preloader').remove(); be();gl(); } }); }); $('body').on('click','.nprlk', function(e){e.preventDefault();var im = $(this).attr('data-i');var id = $(this).attr('data-id');var idcat = $('.page-type-collection').attr('data-id');var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm";var hashtag = window.location.hash;var list_id_cr = findParam(hashtag,im);if (removeValue(list_id_cr, id)) { var id_cl = removeValue(list_id_cr, id); var new_cl = im+'='+id_cl; var old_cl = im+'='+list_id_cr; var new_hashtag = hashtag.replace(old_cl, new_cl); var new_hashtag = new_hashtag.replace('#','&');} else { var old_cl = im+'='+list_id_cr; var new_hashtag = hashtag.replace(old_cl, ''); var new_hashtag = new_hashtag.replace('#','&'); var new_hashtag = new_hashtag.replace('&&','&');}$.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data : "idcat="+idcat + "&_token="+token +"&action=viewproductkqafdel"+new_hashtag, beforeSend: function(){$('.products_cat_show').addClass('snowcat'); }, success : function(data) { $('.page-container-collection').prepend(data); $('#preloader').remove(); be();gl(); } }); }); $('body').on('click','.load-more', function(e){var paged = $(this).attr('data-paged');var idcat = $('.page-type-collection').attr('data-id'); var limit = Number($('#limit').val()); var allcount = Number($(this).find('b').text()); var html = $(this).html(); var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm"; var hashtag = window.location.hash;if (hashtag) { var myUrl = hashtag.replace('#','&');} else { var myUrl ='&myUrl=1';}$thiso = new window.URLSearchParams(myUrl).get('o'); $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type: 'post', data : "idcat="+idcat + "&paged="+paged +"&_token="+token +"&action=loadmoreproduct"+myUrl, beforeSend:function(){ $('.load-more').text('Loading...'); }, success: function(response){if(allcount > limit){ var slg = allcount - limit; var paged_i = Number(paged)+1; setTimeout(function() { $('.item:last').after(response).show().fadeIn('slow'); $('.load-more').html(html); $('.load-more b').html(" "+slg+" "); $('.load-more').attr("data-paged",paged_i); }, 1000);} else { $('.item:last').after(response).show().fadeIn('slow'); $('.load-more').remove();} } }); }); rf(); var hashtag = window.location.hash; if (hashtag && $('.mt_sp '+hashtag.split('=')[0]).length > 0) {$(".readmore").trigger("click");$('html, body').animate({scrollTop: $(hashtag).offset().top - 130}, 2000); } else {var token ="yKs5CKQeCpIEigozRxGOZzSNLXZcjOw9CdPi0Ssm";var idcat = $('.page-type-collection').attr('data-id');if (hashtag) { var myUrl = hashtag.replace('#','&'); var $ml = hashtag.replace('#','');} else { var myUrl ='&myUrl=1';}$thiso = new window.URLSearchParams(myUrl).get('o');$thisk = new window.URLSearchParams(myUrl).get('k');$thist = new window.URLSearchParams(myUrl).get('t');if (hashtag) { $.ajax({ url: 'https://baochauelec.com/AjaxEnt', type : 'POST', data : "idcat="+idcat + "&_token="+token +"&action=viewproducthash_net"+myUrl, beforeSend: function(){ $('.products_cat_show').addClass('snowcat');$(".page-type-collection").prepend('');$('html, body').animate({ scrollTop: $(".box-filter").offset().top }, 500);}, success : function(data) { $('.page-container-collection').html(data); $('#preloader').remove(); be(); var list = $(".sort a"); list.removeClass('check');list.each(function(){var id_order = $(this).attr('data-id');var o_get = $thiso;if(id_order == o_get){$(this).addClass('check');$('.sort-show').html($(this).text());} }); if($thisk == 1){$('.k30').addClass('active'); } else {$('.k30').removeClass('active'); } var listt = $(".qt"); listt.each(function(){var id_order = $(this).attr('data-id');if ($thist) { var o_get = $thist.split(','); if($.inArray(id_order, o_get) != -1){$(this).addClass('active'); }} }); gl();rf();rmpr();z($ml); } });} else { return false;} } }); function z(t){ if (t) {var ml = new window.URLSearchParams(t);ml.delete('o');ml.delete('q');ml.delete('t');ml.delete('k');ml.delete('b');var hk = new window.URLSearchParams(t);hk.delete('o');hk.delete('q');hk.delete('t');hk.delete('k');var ml2 = new window.URLSearchParams(t);ml2.delete('o');ml2.delete('q');ml2.delete('t');ml2.delete('k');ml2.delete('b');ml2.delete('p');if(decodeURIComponent(hk.toString())){ var ar = decodeURIComponent(ml.toString()).split("&"); var ak = []; $.each(ar,function(i){var ax = ar[i].split("=").pop();ak.push(ax); }); var u = ak.join(',');var ar2 = decodeURIComponent(ml2.toString()).split("&"); var ak2 = []; $.each(ar2,function(i){var ax2 = ar2[i].split("=").pop();ak2.push(ax2); }); var u2 = ak2.join(',');var l = $(".filter-item-pr-2, .filter-item-pr"); l.each(function(){if ($(this).find('.filter-list-hkx').length) { var da = $(this).find('.filter-list-hkx').find('strong').attr('data-alias');} else { var da = $(this).find('.jsTitlepr').find('span').attr('data-alias');} var at = $(this).find('.filter-list, .filter-list-full').find('a');at.each(function(){var at = $(this).attr('data-s');if (at) {var lIt = at.split("-").pop(); if (at.split("-")[0] =='b') { if (hk.get('b')) {var ji = decodeURIComponent(hk.get('b').toString());if ($.inArray(lIt,ji.split(',')) != -1) { $(this).addClass('check'); $(this).parents('.filter-item-pr-2').find('.jsTitle').addClass('checkshow'); console.log(1);} else {} } } else if (at.split("-")[0] =='p') { console.log('mmmm'); if (hk.get('p')) {var ji = decodeURIComponent(hk.get('p').toString());if ($.inArray(lIt,ji.split(',')) != -1) { $(this).addClass('check'); $(this).parents('.filter-item-pr-2').find('.jsTitle').addClass('checkshow'); console.log('nnnn');} else {} } } else { console.log('z1'); console.log('z2'); if($.inArray(lIt,u2.split(',')) != -1) {$(this).addClass('check');$(this).parents('.filter-item-pr-2').find('.jsTitle').addClass('checkshow');console.log(3);if ($(this).parents('.nwnhq').length) { var pi = $(this).data('p'); $('.hjkkskl'+pi).addClass('activehk');} }}}});});}$('.total-reloading').html($('.h1_collection').attr('e'));if ($('.checkshow').length) { $('.filter-button').css('display','block');} } } function cr(){ var c1 = $('.h1_collection').attr('c'); var e1 = $('.h1_collection').attr('e'); var a = $('.filter-show-brand .filter-list--hang, .filter-item-t .filter-item-full:nth-child(1)').find('a'); a.each(function(){ if ($(this).attr('data-id') == c1) { console.log(4); $(this).addClass('check'); $(this).parents('.filter-item-pr-2').find('.jsTitle').addClass('checkshow'); $(this).parents('.filter-item-pr-2').find('.filter-button').css('display','block'); $(this).parents('.filter-item-pr-2').find('.filter-button').find('.total-reloading').html(e1);} }); } function be() { $('.filter-list').each(function (){var numItems = $(this).find('.c-btnbox.check').length; if(numItems > 0){$(this).parent('.filter-show').children('.filter-button').css('display','block'); $(this).parents('.filter-item').children('.filter-item__title_new').css('border','1px solid #ED3338'); $(this).parents('.filter-item').children('.filter-item__title_new').css('color','#ED3338'); $(this).parents('.filter-item').children('.filter-item__title_new').children('span').addClass('new-border-top'); } }); }