////!function (e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).easy_toc = t() }(this, (function () { "use strict"; var e = document; return function () { function t(t, i) { var n; this._defaults = { include: ["h1", "h2", "h3", "h4", "h5", "h6"], exclude: ["[data-no-toc]"], prefix: "easy_toc_", hierarchical: !0, anchor_tagname: "div", anchor_class: "anchor" }, this.append_to_el = null !== t && "string" == typeof t ? (n = t, e.querySelector(n)) : t, t || (this.append_to_el = e.body), this.settings = this._merge_settings(this._defaults, i || {}), this._includeStr = this.settings.include.join(","), this._excludeStr = this.settings.exclude.join(","), this._found_selectors = {}, this._toc_list_element = null, this._is_rendered = !1 } return t.prototype._merge_settings = function () { for (var e = [], t = 0; t < arguments.length; t++)e[t] = arguments[t]; var i = {}; return Array.prototype.forEach.call(e, (function (e) { for (var t in e) { if (!Object.prototype.hasOwnProperty.call(e, t)) return; i[t] = e[t] } })), i }, t.prototype._get_nodes = function () { var t, i = this, n = (t = this._includeStr, e.querySelectorAll(t)); return this.settings.exclude.length > 0 && (n = Array.prototype.slice.call(n).filter((function (e) { if (!0 !== (e.matches || e.matchesSelector || e.msMatchesSelector || e.mozMatchesSelector || e.webkitMatchesSelector || e.oMatchesSelector).call(e, i._excludeStr)) return e }))), n }, t.prototype._build_node_obj = function () { var e = this, t = {}, i = {}; return Array.prototype.forEach.call(this._get_nodes(), (function (n, r) { var s; if (e.settings.hierarchical) { var l = void 0; s = null !== (l = /h\d/i.exec(n.tagName)) ? parseInt(l[0].substr(1, 1)) : null } else s = null; var o = e._slugify(n.textContent, 0, i); i[r] = o, t[r] = { el: n, heading_level: s, className: e.settings.prefix + e.settings.anchor_class, id: e.settings.prefix + o } })), t }, t.prototype._slugify = function (e, t, i) { var n = removeVietnameseTones(e.trim().toLowerCase().split(" ").join("-").replace(/[!@#$%^&*():]/gi, "").replace(/\//gi, "-")); return Object.values(i).indexOf(n) > -1 && (t++, n = this._slugify(e + " " + t, t, i)), n }, t.prototype._wrap = function (e, t) { e.parentNode.insertBefore(t, e), t.appendChild(e) }, t.prototype._unwrap = function (e) { var t = e.parentElement; t.insertAdjacentElement("afterend", e), t.parentNode.removeChild(t) }, t.prototype._render = function () { var t = this, i = Object.values(this._found_selectors), n = this.settings.hierarchical ? "ol" : "ul", r = e.createElement(n); r.className = this.settings.prefix + "list", this._toc_list_element = r, this.append_to_el.appendChild(r); var s = null, l = r, o = 1; Array.prototype.forEach.call(i, (function (i) { var a = e.createElement(t.settings.anchor_tagname); a.classList.add(i.className), a.id = i.id, t._wrap(i.el, a); var c = e.createElement("li"); if (c.className = t.settings.prefix + "list-item", t.settings.hierarchical && null !== s && s < i.heading_level) { var h = e.createElement(n); h.setAttribute("data-level", o.toString()), l.appendChild(h), o++, (l = h).appendChild(c) } else t.settings.hierarchical && null !== s && s == i.heading_level ? l.appendChild(c) : (l = r, r.appendChild(c)); var d = e.createElement("a"); d.className = t.settings.prefix + "list-item_link", d.href = "#" + i.id, d.setAttribute("data-heading_level", i.heading_level.toString()), d.innerText = i.el.textContent, c.appendChild(d), s = i.heading_level })), this._is_rendered = !0 }, t.prototype.init = function () { this.destroy(), this._found_selectors = this._build_node_obj(), this._render() }, t.prototype.update = function () { this.init() }, t.prototype.destroy = function () { var e = this; if (!1 !== this._is_rendered) { var t = Object.values(this._found_selectors); Array.prototype.forEach.call(t, (function (t) { e._unwrap(t.el) })), this._toc_list_element.parentNode.removeChild(this._toc_list_element) } this._found_selectors = {}, this._is_rendered = !1 }, t }() }));
////function removeVietnameseTones(str) {
//// str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|?g, "a");
//// str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|?g, "e");
//// str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
//// str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|?g, "o");
//// str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|?g, "u");
//// str = str.replace(/ỳ|ý|ỵ|ỷ|?g, "y");
//// str = str.replace(/đ/g, "d");
//// str = str.replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|?g, "A");
//// str = str.replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|?g, "E");
//// str = str.replace(/Ì|Í|Ị|Ỉ|Ĩ/g, "I");
//// str = str.replace(/Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|?g, "O");
//// str = str.replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|?g, "U");
//// str = str.replace(/Ỳ|Ý|Ỵ|Ỷ|?g, "Y");
//// str = str.replace(/Đ/g, "D");
//// // Some system encode vietnamese combining accent as individual utf-8 characters
//// // Một vài b?encode coi các dấu mũ, dấu ch?như một kí t?riêng biệt nên thêm hai dòng này
//// str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ""); // ̀ ́ ̃ ̉ ̣ huyền, sắc, ngã, hỏi, nặng
//// str = str.replace(/\u02C6|\u0306|\u031B/g, ""); // ˆ ̆ ̛ Â, Ê, Ă, Ơ, Ư
//// // Remove extra spaces
//// // B?các khoảng trắng liền nhau
//// str = str.replace(/ + /g, " ");
//// str = str.replace(/\xA0/g, "-");
//// str = str.replace(/ /g, "-");
//// str = str.trim();
//// // Remove punctuations
//// // B?dấu câu, kí t?đặc biệt
//// str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|\$|_|`|{|}|\||\\/g, "");
//// return str;
////}
/* modal bootrap 5 start*/
function OpenModal(idModal, backdrop, event, start) {
try {
if (idModal) {
if (!backdrop || backdrop == '') {
backdrop = "static";
}
var myModal = new bootstrap.Modal(document.getElementById(idModal), { backdrop: backdrop, keyboard: false });
if (start) {
document.getElementById(idModal).addEventListener('shown.bs.modal', start);
}
else {
document.getElementById(idModal).addEventListener('shown.bs.modal', function () { })
}
if (event) {
document.getElementById(idModal).addEventListener('hidden.bs.modal', event);
}
myModal.show();
}
}
catch {
}
}
//$(document).on("click", ".addToCart", function (n) {
// n.preventDefault();
// var t = $(this).data("id"), i = $(this).parent().parent();
// $.post("/Cart/_AddCart", { id: t }, function (n) {
// var t = $("#countCart");
// $("#countCart").html(n.number);
// alertAddCart()
// })
//});
function CloseModal(idModal) {
if (!idModal) {
idModal = "modal_Set";
}
try {
const truck_modal = document.querySelector('#' + idModal);
const modal = bootstrap.Modal.getInstance(truck_modal);
modal.hide();
} catch { }
try {
var myModal = new bootstrap.Modal(document.getElementById(idModal), {
keyboard: false
})
myModal.hide()
} catch { }
try {
$('.modal-backdrop.fade.show').each(function () {
$(this).remove();
})
} catch { }
try { $rootScope.$broadcast('updateData'); } catch { }
}
/* modal bootrap 5 end */
/* auto-size image start */
//$(window).on('load', function () {
// $('.auto-size-image, .frames, .user-support-img, .comment-img,.sp-img-wrapper a').each(function () {
// var th = $(this);
// var img = th.find('img');
// if (img.hasClass('lazy') || img.attr('data-original')) {
// var imgUrl = img.attr('data-original');
// } else {
// var imgUrl = img.attr('src');
// }
// var imgObj = new Image();
// imgObj.onload = function () {
// if ((th.width() / th.height()) < (this.width / this.height)) {
// img.removeClass('h-auto').removeClass('w-100').addClass('h-100 w-auto');
// }
// else {
// img.removeClass('h-100').removeClass('w-auto').addClass('h-auto w-100');
// }
// };
// imgObj.src = imgUrl;
// });
//});
/* auto-size image end */
/*Xóa tiêu điểm modal trong ckediter start*/
$(document).ready(function () {
try {
$.fn.modal.Constructor.prototype._initializeFocusTrap = function () { return { activate: function () { }, deactivate: function () { } } };
} catch { }
});
/*Xóa tiêu điểm modal trong ckediter end*/
/*form-falcon start button clear value and show pass */
$(document).ready(function () {
$('.form-falcon input[type*="password"]').each(function () {
$(this).after('');
});
$('.form-falcon input[type*="text"]').each(function () {
$(this).after('');
});
$('.form-falcon').on('click', 'input[type*="password"] ~ span.icon-see, input[type*="text"] ~ span.icon-see', function () {
var input = $(this).siblings('input');
var type = input.attr('type') == 'password' ? 'text' : 'password';
input.attr({ 'type': type, 'data-typeold': type == 'password' ? 'text' : 'password' });
}).on('click', 'input[type*="password"] ~ span.icon-clear, input[type*="text"] ~ span.icon-clear', function () {
$(this).siblings('input').val('');
});
});
/*form-falcon end button clear value and show pass */
/* checkmenu start */
$(document).ready(function () {
ckeckmenufind();
});
function ckeckmenufind(urlAct) {
if (urlAct) {
var rf = $('#menu-main > ul').find('[href="' + urlAct + '"]');
ckeckmenu(rf.parent());
}
else {
var rf = $('#menu-main > ul').find('[href="' + window.location.pathname + '"]');
if (rf) { ckeckmenu(rf.parent()); }
}
}
function ckeckmenu(x) {
if (x) {
if (!x.hasClass('act')) {
x.addClass('act');
}
var y = x.parent();
if (y && y.hasClass('sub-menu')) {
if (y.parent()) {
ckeckmenu(y.parent());
}
}
}
}
/* checkmenu end */
/* menu-hot start */
$(document).ready(function () {
//$("#menu-hot .menu-hot").masonry({ itemSelector: ".col-12" });
});
/* menu-hot end */
/*show text input passwork start*/
$(document).on("click", ".showpasswork", function () {
if ($(this).hasClass("fa-eye-slash")) {
$(this).removeClass("fa-eye-slash").addClass("fa-eye");
}
else {
$(this).removeClass("fa-eye").addClass("fa-eye-slash");
}
var inputPasswork = $(this).siblings("input");
if (inputPasswork.attr("type") == "password") {
inputPasswork.attr("type", "text");
}
else {
inputPasswork.attr("type", "password");
}
});
$(document).on("click", ".clear-val", function () {
var th = $(this);
var input = $(this).siblings("input");
if (input) {
var type = $(input).attr('type');
$(input).attr("type", "text");
$(input).val('');
$(input).attr("type", type);
}
});
/*show text input passwork end*/
/*set Language start*/
//$(document).on("click", "#language a", function (){
// var th = $(this);
// var href = $(th).data('href');
// var id = $(th).data('id');
// if (id) {
// $.post("/Language/ChangLanguage", { ID: id }, function (rs) {
// if (rs.status == true) {
// if (href) {
// window.location.href = href;
// }
// }
// else { }
// })
// }
//})
/*set Language end*/
/* light box imagee start */
function lightboxslide(className, groupName) {
if (className == null || className == '' || className == ' ') {
className = 'img';
}
if (groupName == null || groupName == '' || groupName == ' ') {
groupName = 'gallery-1';
}
$(className).each(function () {
var srcOld = $(this).attr('src') != undefined ? $(this).attr('src') : '';
var altOld = $(this).attr('alt') != undefined ? 'alt="' + $(this).attr('alt') + '" ' : '';
var classOld = $(this).attr('class') != undefined ? 'class="' + $(this).attr('class') + '" ' : '';
var styleOld = $(this).attr('style') != undefined ? 'style="' + $(this).attr('style') + '" ' : '';
var p = $(this).parent();
p.html('
');
})
}
/*light box image end */
/*module toogle star */
//$(document).on('click', '.toggle-title', function () {
// var th = $(this);
// var b = th.siblings('.toggle-body');
// var c = th.find('.toggle-button');
// if (b) {
// if (b.hasClass('show') == true) {
// b.slideToggle(300);
// c.html('');
// b.removeClass("show");
// }
// else {
// b.slideToggle(300);
// c.html('');
// b.addClass('show');
// }
// }
//});
$(document).on('click', '.toggle-title', function () {
var b = $(this).siblings('.toggle-body');
var c = $(this).find('.toggle-button');
if (b) {
b.slideToggle(300);
c.html(b.hasClass('show') ? '' : '');
b.toggleClass('show');
}
});
//$(document).on('click', '.btn-style', function () {
// var item = $(this).data('item');
// var style = $(this).data('style');
// if (item && style) {
// $(item).attr('style', style);
// }
//})
$(document).on('click', '.btn-style', function () {
var { item, style } = $(this).data();
if (item && style) {
$(item).attr('style', style);
}
});
//$(document).on('click', '.toggle-button', function () {
// var th = $(this);
// var a = $(this).parent();
// if (a.hasClass('toggle-title') == false) {
// var b = a.siblings(".toggle-body");
// if (b) {
// if (b.hasClass('show') == true) {
// b.slideToggle(300);
// th.html('');
// b.removeClass('show');
// }
// else {
// b.slideToggle(300);
// th.html('');
// b.addClass('show');
// }
// }
// }
//});
//$(document).ready(function () {
// $(".toggle-body").each(function () {
// var th = $(this);
// var b = th.siblings("div");
// b.each(function () {
// var d = b.find(".toggle-button");
// if (th.hasClass('hide') == true) {
// d = d.html('');
// th.removeClass("hide");
// th.attr("style", "display: none");
// }
// else {
// d = d.html('');
// th.addClass('show');
// }
// })
// });
//});
$(document).on('click', '.toggle-button', function () {
const th = $(this);
const a = th.parent();
if (a.hasClass('toggle-title')) return;
const b = a.siblings('.toggle-body');
if (b) {
b.slideToggle(300);
th.html(b.hasClass('show') ? '' : '');
b.toggleClass('show');
}
});
$(document).ready(function () {
$('.toggle-body.hide').each(function () {
const th = $(this);
const d = th.siblings('div').find('.toggle-button');
d.html('');
th.removeClass('hide').attr('style', 'display: none');
});
});
/*module toogle end */
$(function () {
$(".lazy").lazyload({
effect: "fadeIn"
}).removeClass("lazy");
$(document).ajaxStop(function () {
$(".lazy").lazyload({
effect: "fadeIn"
}).removeClass("lazy");
});
});
/* maruqe footer start */
//$('#marquee-item-footer').marquee({
// speed: 30,
// gap: 1000,
// delayBeforeStart: 0,
// direction: 'left',
// duplicated: true,
// pauseOnHover: true
//});
/* maruqe footer end */
//$(".box-video-image").parents("a").click(function (e) {
// e.preventDefault();
// var id = $(this).attr("href");
// $(id).modal("show");
//})
function fnmenu() {
if ($(window).width() > 991) {
$lilast = $(".menu>ul>li").last();
$submenu = $lilast.children(".sub-menu");
if ($submenu.length) {
$right = $submenu.offset().left + $submenu.width();
if ($right > $(window).width()) {
$submenu.css("left", 0 - ($right - $(window).width()));
//$("head").append("");//s?dụng khi menu có arrow trên đỉnh
}
}
}
}
//function slideads(offset) {
// if ($("#slideads").length) {
// var pl = ($(window).width() - $(".container").width() - offset * 2) / 2;
// $("#slideads").css({ left: pl, width: $(".container").width() + offset * 2 });
// if ($("#slideads1").length) {
// if (pl - $("#slideads1").width() < 0) {
// $("#slideads").addClass("d-none");
// }
// else {
// $("#slideads").removeClass("d-none");
// }
// }
// else if ($("#slideads2").length) {
// if (pl + $(".container").width() + offset * 2 + $("#slideads2").width() > $(window).width()) {
// $("#slideads").addClass("d-none");
// }
// else {
// $("#slideads").removeClass("d-none");
// }
// }
// if ($("#menu") && $("#menu").offset()) {
// $('#slideads').css({ top: ($("#menu").offset().top - $(window).scrollTop() + $("#menu").height() + 6) });
// }
// }
//}
function slideads(offset) {
const slideadsEl = $("#slideads");
const containerEl = $(".container");
const slideads1El = $("#slideads1");
const slideads2El = $("#slideads2");
const menuEl = $("#menu");
if (slideadsEl.length) {
const pl = ($(window).width() - containerEl.width() - offset * 2) / 2;
slideadsEl.css({ left: pl, width: containerEl.width() + offset * 2 });
if (slideads1El.length) {
slideadsEl.toggleClass("d-none", pl - slideads1El.width() < 0);
} else if (slideads2El.length) {
slideadsEl.toggleClass("d-none", pl + containerEl.width() + offset * 2 + slideads2El.width() > $(window).width());
}
if (menuEl && menuEl.offset()) {
slideadsEl.css({ top: (menuEl.offset().top - $(window).scrollTop() + menuEl.height() + 6) });
}
}
}
fnmenu();
slideads(10);
$(window).resize(function () {
fnmenu();
slideads(10);
});
$('#adsbottom .btn-close').click(function () {
$('#adsbottom').addClass('d-none');
})
//$(".menu .sub-menu .menu-item").hover(function () {
// $submenu = $(this).children(".sub-menu");
// if ($submenu.length) {
// if ($submenu.hasClass("dr-left") == false) {
// $right = $submenu.offset().left + $submenu.width();
// if ($right > $(window).width()) {
// $submenu.addClass("dr-left");
// }
// else {
// $submenu.removeClass("dr-left");
// }
// }
// }
//});
$(".menu .sub-menu .menu-item").hover(function () {
$submenu = $(this).children(".sub-menu");
if ($submenu.length && !$submenu.hasClass("dr-left")) {
if ($submenu.offset().left + $submenu.width() > $(window).width()) {
$submenu.addClass("dr-left");
}
}
});
//end function menu
//function for auto images ratio for frame
//$('[class*="hig-img-auto"]').each(function() {
function img_auto() {
//$('.hig-img-auto').each(function () {
// //var pseudoElementContent = window.getComputedStyle($(divpre)[0], ':before').getPropertyValue('padding-top');
// //alert(pseudoElementContent);
// var ratio = 1;
// var divparent = $(this).parent().closest('div');
// var ratioframe = $(divparent).height() / $(divparent).width();
// if ($(this)[0].hasAttribute("data-original")) {
// var img = $(this);
// var tmpImg = new Image();
// tmpImg.src = document.location.protocol + "//" + document.location.host + $(this).attr("data-original"); //or document.images[i].src;
// $(tmpImg).on('load', function () {
// //var ratioframe=divparent.height/divparent.width;
// var ratio = 1;
// if (tmpImg.width > 0) { ratio = tmpImg.height / tmpImg.width }
// if (ratio >= ratioframe) {
// $(img).addClass("w-100");
// }
// else {
// $(img).addClass("h-100");
// }
// });
// }
// else {
// if ($(this).width() > 0) { ratio = $(this).height() / $(this).width(); }
// if (ratio >= ratioframe) {
// $(this).addClass("w-100");
// }
// else {
// $(this).addClass("h-100");
// }
// }
//});
}
function owl_img_auto() {
//$('[class*="hig-owl-img-auto"]').each(function () {
// var classname = this.className;
// var index = classname.lastIndexOf("hig-owl-img-auto");
// var ratioframe = classname.substring(index + 16).substring(2, 4);
// //alert(ratioframe);
// if (ratioframe != "") {
// if (ratioframe == "00") {
// ratioframe = 1;
// }
// else {
// ratioframe = parseFloat(ratioframe) / 100;
// }
// }
// else {
// ratioframe = 1;
// }
// var img = $(this);
// var tmpImg = new Image();
// tmpImg.src = document.location.protocol + "//" + document.location.host + $(this).attr("src"); //or document.images[i].src;
// $(tmpImg).on('load', function () {
// var ratio = 1;
// if (tmpImg.width > 0) { ratio = tmpImg.height / tmpImg.width }
// if (ratio >= ratioframe) {
// $(img).addClass("w-100");
// //alert(h);
// }
// else {
// $(img).addClass("h-100");
// }
// });
//});
}
//end function for auto images ratio for frame
//$(document).on("click", ".remove-cart", function () {
// var id = $(this).data("id");
// $.post("/Cart/Delete", { id: id }, function () {
// $.get("/Cart/_Cart", function (html) {
// $("#cart-content").replaceWith(html);
// });
// })
// $("#countCart").html(parseInt($("#countCart").text()) - 1);
//})
//$(document).click(function (e) {
// var element = $("#cart .cart-link");
// if (!element.is(e.target) && element.has(e.target).length === 0) {
// if ($('#cart #cart-content').hasClass('in')) {
// $('#cart #cart-content').removeClass('in');
// }
// }
// else {
// if ($('#cart #cart-content').hasClass('in')) {
// $('#cart #cart-content').removeClass('in');
// }
// else {
// $('#cart #cart-content').addClass('in');
// }
// }
//});
$("#nav-toggle > #menu-button, #nav-toggle.nav-toggle").click(function (e) {
e.preventDefault();
$('#menu').css({ 'z-index': '1095' });
$('#menu-body').css({ 'left': '0', });
$('#closemenu').css('left', '0');
/*$('#logo img').css('z-index', '0');*/
});
$("#closemenu").click(function (e) {
e.preventDefault();
$('#menu').removeAttr("style");
$('#menu-body').removeAttr("style");
$('#closemenu').removeAttr("style");
//$('#logo img').removeAttr("style");
});
$('.menu-product-sub > ul > li:last-child').click(function () {
if ($('.menu-product-sub > ul').hasClass('sub-menu-max')) {
$('.menu-product-sub > ul').removeClass('sub-menu-max');
$('.menu-product-sub > ul').removeAttr("style");
}
else {
$('.menu-product-sub > ul').addClass('sub-menu-max');
$('.menu-product-sub > ul').css({ 'max-height': '100%','height': 'auto', 'padding-bottom': '2rem'});
}
})
$("#menu-product .menu-product-sub").on('mouseover', function () {
$('.menu-product-sub > ul').addClass('sub-menu-max');
$('.menu-product-sub > ul').css({ 'max-height': '100%', 'height': 'auto' });/*, 'padding-bottom': '2rem'*/
});
$("#menu-product .menu-product-sub").on('mouseleave', function () {
$('.menu-product-sub > ul').removeClass('sub-menu-max');
$('.menu-product-sub > ul').removeAttr("style");
});
$('#menu-product-title').click(function () {
if ($('.menu-product-sub').hasClass('act')) {
$('.menu-product-sub').removeClass('act');
}
else {
$('.menu-product-sub').addClass('act');
}
})
$("#menu-product > li").on('mouseover', function () {
if ($('.menu-product-sub').hasClass('act')) {
}
else {
$('.menu-product-sub').addClass('act');
}
});
$("#menu-product > li").on('mouseleave', function () {
if ($('.menu-product-sub').hasClass('act')) {
$('.menu-product-sub').removeClass('act');
}
else {
}
});
//$(document).on("click", "#search span", function () {
// var i = $(this).find("i")
// , c = $("i", this).attr("class");
// $("#frmsearch").slideToggle("slow");
// c == "fas fa-search" ? $("i", this).attr("class", "fas fa-times") : $("i", this).attr("class", "fas fa-search");
//});
$("#search .search-close").click(function () {
$('#search').removeClass('act');
$('#search #btnsearch').fadeOut(500);
$('#search #txtsearch').fadeOut(500);
$('#search .search-close').fadeOut(500);
$('#header').css({ 'z-index': '1085' });
});
$('.showsearch').off('click').on('click', function () {
$('#search').addClass('act');
setTimeout(function () {
$('#search #txtsearch').fadeIn(100);
$('#search #btnsearch').fadeIn(500);
$('#search .search-close').fadeIn(500);
$('#search #txtsearch').focus();
$('#header').css({'z-index':'1095'});
}, 300);
});
$(document).on("click", ".showhide-subul", function () {
var n = $(this).next()
, t = $(this).parents("li").siblings()
, i = $("i", this).attr("class")
, svg = $("svg", this).attr("class");
$(t).find(".showhide-subul > i").attr("class", "far fa-plus-square");
$(t).find(".showhide-subul").removeAttr("style");
$(t).find("ul").slideUp(0);
$(n).slideToggle(0);
i == "far fa-plus-square" ? $("i", this).attr("class", "far fa-minus-square") : ($("i", this).attr("class", "far fa-plus-square"),
$(this).removeAttr("style"),
$(n).find(".showhide-subul > i").attr("class", "far fa-plus-square"),
$(n).find(".showhide-subul").removeAttr("style"));
//svg != "svg-inline--fa fa-square-plus" ? $("svg", this).attr("class", "svg-inline--fa fa-square-plus") : ($("svg", this).attr("class", "svg-inline--fa fa-square-minus"),
// $(this).removeAttr("style"),
// $(n).find(".showhide-subul > svg").attr("class", "svg-inline--fa fa-square-plus"),
// $(n).find(".showhide-subul").removeAttr("style"))
//var z = $(this).siblings('#menu-product-sub > .sub-menu');
//if (z) {
// if ($(z).hasClass('d-block')) {
// $(z).removeClass('d-block');
// }
// else {
// $(z).addClass('d-block');
// }
//}
});
function toogle(a) {
$("#" + a).slideToggle();
var i = $(a).find(i);
if (i.hasClass('fa-minus-square')) {
i.removeClass('fa-minus-square').addclass('fa-plus-square');
} else {
i.removeClass('fa-plus-square').addclass('fa-minus-square');
}
if (i.hasClass('fa-minus')) {
i.removeClass('fa-minus').addclass('fa-plus');
} else {
i.removeClass('fa-plus').addclass('fa-minus');
}
}
var $li_pr = $('#menudmsp ul li a.selected').parent().parent().parent();
while ($li_pr.length) {
$li_pr.children('span').first().find('i').removeClass('fa-plus');
$li_pr.children('span').first().find('i').addClass('fa-minus');
$li_pr = $li_pr.parent().parent();
}
$('#menudmsp span').click(function () {
if ($(this).find('i').hasClass('fa-plus')) {
$(this).find('i').removeClass('fa-plus');
$(this).find('i').addClass('fa-minus');
}
else {
$(this).find('i').removeClass('fa-minus');
$(this).find('i').addClass('fa-plus');
}
});
$(document).ready(function () {
var autoplay = false;
if ($(window).width() < 1024) autoplay = true;
$(".slideshowPlugin").each(function () {
var th = $(this);
var openonclickid = th.data('openonclickid');
if (openonclickid) {
$('.ckfinder-owl .ckfinder-href img[links]').each(function () {
$(this).closest('.ckfinder-href').on('click', function () {
var links = $(this).find('img').attr('links');
if (links) {
var target = $(this).find('img').attr('imgtarget');
if (target && target == '_blank') {
window.open(links, target);
}
else {
window.location.href = links;
}
}
});
});
}
var x = th.find('.ckfinder-owl');
x.owlCarousel({
loop: th.data('loop'),
responsiveClass: true,
items: th.data('maxitem'),
responsive: {
0: { items: th.data('countitemshowid') ?? 1 },
1: { items: th.data('countitemshowid') ?? 1 },
300: { items: th.data('countitemshowid') ?? 1 },
425: { items: th.data('countitemshowxsid') ?? 1 },
576: { items: th.data('countitemshowsmid') ?? 1 },
768: { items: th.data('countitemshowmdid') ?? 1 },
992: { items: th.data('countitemshowlgid') ?? 1 },
1200: { items: th.data('countitemshowxlid') ?? 1 },
},
lazyLoad: th.data('lazyload'),
autoplay: th.data('autostartid'),
autoplayTimeout: (th.data('animspeedid') ?? 1) * 1000,
autoplayHoverPause: th.data('autoplayhoverpause'),
dots: th.data('showthumbid'),
nav: th.data('showcontrolid'),
navText: ["", ""],
margin: th.data('marginitem')
});
//if (th.data('mousewheel')) {
// x.on('mousewheel', '.owl-stage', function (e) {
// if (e.deltaY > 0) {
// x.trigger('next.owl');
// } else {
// x.trigger('prev.owl');
// }
// e.preventDefault();
// });
//};
if (th.data('mousewheel')) {
x.on('wheel', '.owl-stage', function (e) {
if (e.originalEvent.deltaY > 0) {
x.trigger('next.owl');
} else {
x.trigger('prev.owl');
}
e.preventDefault();
});
}
var alignid = th.data('alignid');
if (alignid) {
var styles = { 'display': 'block' };
switch (alignid) {
case 'center':
styles.margin = 'auto';
break;
case 'left':
styles['margin-right'] = 'auto';
break;
case 'right':
styles['margin-left'] = 'auto';
break;
case 'normal':
// do nothing
break;
}
th.css(styles);
}
})
$("#owl-headertopbar, #owl-adsbottom").owlCarousel({
loop: true,
responsiveClass: true,
items: 10,
responsive: {
0: { items: 1 },
},
lazyLoad: false,
autoplay: autoplay,
autoplayTimeout: 2500,
autoplayHoverPause: true,
dots: false,
nav: true,
navText: ["", ""],
margin: 0
});
$(".owl-productcategory.owl-carousel").owlCarousel({
loop: true,
responsiveClass: true,
items: 5,
responsive: {
0: { items: 2 },
375: { items: 2 },
425: { items: 3 },
576: { items: 4 },
768: { items: 6 },
992: { items: 8 },
1200: { items: 10 }
},
lazyLoad: true,
autoplay: autoplay,
autoplayTimeout: 2500,
autoplayHoverPause: true,
dots: false,
nav: true,
navText: ["", ""],
margin: 0
});
$(".owl-product-hns.owl-carousel").owlCarousel({
loop: true,
responsiveClass: true,
items: 5,
responsive: {
0: { items: 1 },
375: { items: 1 },
425: { items: 2 },
576: { items: 3 },
768: { items: 4 },
992: { items: 5 },
1200: { items: 6 }
},
lazyLoad: true,
autoplay: true,
autoplayTimeout: 2500,
autoplayHoverPause: true,
dots: false,
nav: true,
navText: ["", ""],
margin: 0
});
$("#owl-customer.owl-carousel").owlCarousel({
loop: true,
responsiveClass: true,
items: 1,
responsive: {
0: { items: 2 },
350: { items: 2 },
425: { items: 3 },
520: { items: 4 },
992: { items: 6 },
1200: { items: 8 },
1300: { items: 9 },
},
lazyLoad: true,
autoplay: autoplay,
autoplayTimeout: 2500,
autoplayHoverPause: true,
dots: false,
nav: true,
navText: ["", ""],
margin: 14
});
$("#owl-comment.owl-carousel").owlCarousel({
loop: true,
responsiveClass: true,
items: 4,
responsive: {
0: { items: 1 },
1: { items: 1 },
520: { items: 1 },
768: { items: 2 },
992: { items: 3 },
1200: { items: 3 },
},
lazyLoad: true,
autoplay: autoplay,
autoplayTimeout: 2500,
autoplayHoverPause: true,
dots: false,
nav: true,
navText: ["", ""],
margin: 32
});
//img_auto();
//owl_img_auto();
});
//$(document).on("click", ".wg-open", function () {
// $(this).attr("class", "wg-open d-none");
// $(".wg-close").attr("class", "wg-close d-block");
// $("#widget-contact").slideToggle();
// $("#hig-alo-phoneIcon").slideToggle();
//});
//$(document).on("click", ".wg-close", function () {
// $(this).attr("class", "wg-close d-none");
// $(".wg-open").attr("class", "wg-open d-block");
// $("#widget-contact").slideToggle();
// $("#hig-alo-phoneIcon").slideToggle();
//});
//$("#askinfo").submit(function () {
// $("#buttonwait").show();
// $("#buttonsend").hide();
// $.post("/FeedBack/Post", $("#askinfo").serialize(), function (data) {
// if (data.status == true)
// $("#askinfo").html("success");
// $("#buttonwait").show();
// $("#buttonsend").hide();
// })
// return false;
//})
//$("#formSub").submit(function () {
// $.post("/Home/Subscribe", { email: $("#formEmail").val() }, function (data) {
// if (data.status == -1) {
// alert('email không được đ?trống!');
// }
// else if (data.status == -3) {
// alert('Đăng ký email quá nhanh.Vui lòng ch?')
// }
// else if (data.status == true) {
// $('#formEmail').val("");
// alert('Đăng ký thành công');
// }
// else {
// alert('Email đã được đăng ký.');
// }
// });
// return false;
//});
//$(".btn-show-more span").on("click", function () {
// var $this = $(this);
// var $content = $this.parent().prev(".cat-desc");
// var linkText = $this.text().toUpperCase();
// if (linkText === "XEM THÊM") {
// linkText = "Thu gọn";
// $content.switchClass("shortContent", "fullContent", 400);
// } else {
// linkText = "Xem thêm";
// $content.switchClass("fullContent", "shortContent", 400);
// };
// $this.text(linkText);
//});
jQuery(document).ready(function ($) {
$('#btnsearch').off('click').on('click', function () {
searchStart(this);
});
$('#txtsearch').keypress(function (event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
searchStart('#btnsearch');
}
});
function searchStart(th) {
var lang = $(th).data('lang') == '/' ? '' : $(th).data('lang');
var mesError = $(th).data('meserror');
var endurl = $(th).data('endurl');
var search = $('#txtsearch').val();
var idcategory = $('#categorySearch').val();
if (idcategory)
idcategory = '&idcategory=' + idcategory;
else
idcategory = '';
search = search.replace(/[?&+.()].*/gi, '').trim();
if (search) {
//window.location.href = lang + "/search/cd-" + search + endurl;
//window.location.href = lang + "/search/pd-" + search + "-ci0" + endurl;
window.location.href = lang + '/search/searchproductdetail?id=' + search + idcategory + endurl;
}
else { alert(mesError); }
}
})
/* button logut start */
$(document).ready(function () {
function logoff(data) {
//$('#logoutForm').submit();
$.ajax({
type: 'Post',
url: "/Login/_LogOff",
data: { returnUrl: window.location.href },
success: function (rs) {
if (rs.status == true) {
if (window.location.href == rs.url)
window.location.reload();
else
window.location.href = rs.url;
}
}
});
}
$('.logoff').click(function () {
Swal.fire({
title: '',
iconHtml: '
',
html: $(this).data('content') ? ($(this).data('content') + '?') : 'Xác nhận đăng xuất?',
showCloseButton: true,
showCancelButton: true,
confirmButtonText: $(this).data('confirm') ? $(this).data('confirm') : 'Confirm',
cancelButtonText: $(this).data('cancel') ? $(this).data('cancel') : 'Cancel',
}).then((result) => {
if (result.isConfirmed) {
logoff();
}
})
})
$('.btn-logout-form').click(function () { logoff(); });
});
/* button logut end */