diff --git a/assets/script/global.js b/assets/script/global.js
index 4b872c8..7a2138c 100644
--- a/assets/script/global.js
+++ b/assets/script/global.js
@@ -1,65 +1,43 @@
"use strict";
const AdminFunction = (() => {
- function capNhatTrangThaiMenu(hideMenuBig) {
- if (hideMenuBig === false) {
- $('#js-admin-content-container').addClass('show-large-menu');
+ function e(e, t, n) {
+ let o = null;
+ return function (...a) {
+ const i = this,
+ r = function () {
+ o = null, !n && e.apply(i, a)
+ };
+ const c = n && !o;
+ clearTimeout(o), o = setTimeout(r, t), c && e.apply(i, a)
}
- else {
- $('#js-admin-content-container').removeClass('show-large-menu');
- }
- $('#js-menu-big').toggleClass('hidden', hideMenuBig);
- $('#js-menu-small').toggleClass('hidden', !hideMenuBig);
- $('#js-form-search').toggleClass('menu-hide', hideMenuBig);
- localStorage.setItem(hideMenuBig ? 'menu_big' : 'menu_small', 'hidden');
- localStorage.removeItem(hideMenuBig ? 'menu_small' : 'menu_big');
}
- function debounce(func, wait, immediate) {
- let timeout = null;
- return function (...args) {
- const context = this;
- const later = function () {
- timeout = null;
- if (!immediate)
- func.apply(context, args);
- };
- const callNow = immediate && !timeout;
- if (timeout !== null) {
- clearTimeout(timeout);
- }
- timeout = setTimeout(later, wait);
- if (callNow)
- func.apply(context, args);
- };
- }
- function add_product_to_category(id) {
- $('#status_' + id).html('Đang xử lý..');
- setTimeout(() => {
- $('#status_' + id).html('');
- }, 1000);
- }
- function run_search(holder) {
- $(holder).keyup(debounce(function () {
- //const inputString = $(this).val();
- $('#js-show-search').show();
- }, 300, false)); // Cast debounce to any to avoid type inference issues
- $('body').click(function () {
- $("#js-show-search").hide();
- });
- }
- function update_product_hot(id) {
- $('#js-status-hottype-' + id).html('Đang xử lý..');
- setTimeout(() => {
- $('#js-status-hottype-' + id).html('');
- }, 1000);
- }
- function searchSelect(holder) {
- $(holder).select2();
+
+ function t(e) {
+ $("#js-admin-content-container").toggleClass("show-large-menu", !e), $("#js-menu-big").toggleClass("hidden", e), $("#js-menu-small").toggleClass("hidden", !e), $("#js-form-search").toggleClass("menu-hide", e), localStorage.setItem(e ? "menu_big" : "menu_small", "hidden"), localStorage.removeItem(e ? "menu_small" : "menu_big")
}
return {
- capNhatTrangThaiMenu,
- add_product_to_category,
- run_search,
- searchSelect,
- update_product_hot
- };
-})();
\ No newline at end of file
+ capNhatTrangThaiMenu: t,
+ add_product_to_category: function (e) {
+ $("#status_" + e).html('Đang xử lý..'), setTimeout(() => {
+ $("#status_" + e).html("")
+ }, 1e3)
+ },
+ run_search: function (e) {
+ $(e).keyup(e => {
+ ! function (e) {
+ $("#js-show-search").show()
+ }(e.target)
+ }), $("body").click(() => {
+ $("#js-show-search").hide()
+ })
+ },
+ update_product_hot: function (e) {
+ $("#js-status-hottype-" + e).html('Đang xử lý..'), setTimeout(() => {
+ $("#js-status-hottype-" + e).html("")
+ }, 1e3)
+ },
+ searchSelect: function (e) {
+ $(e).select2()
+ }
+ }
+})();
diff --git a/template/theme.html b/template/theme.html
index 6fc3d4f..68382ba 100644
--- a/template/theme.html
+++ b/template/theme.html
@@ -304,7 +304,7 @@
-
+
{% include javascript/index %}