Skip to content

Commit

Permalink
修复侧边导航菜单自动收缩(隐藏)时,且在防火墙[iptables]列表加载时,扩展按钮无响应的问题
Browse files Browse the repository at this point in the history
- 从menu-argon.js分离侧边导航菜单的脚本至sidebar-argon.js
- 导航菜单自动收缩(隐藏):移动端竖屏时/缩小浏览器窗口时
  • Loading branch information
SpeedPartner committed Apr 16, 2023
1 parent 187a7f6 commit 05be190
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 39 deletions.
4 changes: 2 additions & 2 deletions htdocs/luci-static/argon/js/menu-argon.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
window.location = $($(this).find("a")[0]).attr("href");
return false;
});

/**
* fix submenu click
*/
Expand Down Expand Up @@ -165,4 +165,4 @@
button.addClass("cbi-button cbi-input-reset a-to-btn");
break;
}
}
}
64 changes: 64 additions & 0 deletions htdocs/luci-static/argon/js/sidebar-argon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
*
* luci-theme-argon
* Copyright 2023 Jerrykuku <[email protected]>
*
* Have a bug? Please create an issue here on GitHub!
* https://github.com/jerrykuku/luci-theme-argon/issues
*
* luci-theme-bootstrap:
* Copyright 2008 Steven Barth <[email protected]>
* Copyright 2008 Jo-Philipp Wich <[email protected]>
* Copyright 2012 David Menting <[email protected]>
*
* MUI:
* https://github.com/muicss/mui
*
* luci-theme-material:
* https://github.com/LuttyYang/luci-theme-material/
*
* Argon Theme
* https://demos.creative-tim.com/argon-dashboard/index.html
*
* Login background
* https://unsplash.com/
*
* Licensed to the public under the Apache License 2.0
*/

/**
* Sidebar expand
*/
var showSide = false;
$(".showSide").click(function () {
if (showSide) {
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").width(0);
$(".main-right").css("overflow-y", "auto");
showSide = false;
} else {
$(".darkMask").stop(true).fadeIn("fast");
$(".main-left").width("15rem");
$(".main-right").css("overflow-y", "hidden");
showSide = true;
}
});

$(".darkMask").click(function () {
if (showSide) {
showSide = false;
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").width(0);
$(".main-right").css("overflow-y", "auto");
}
});

$(window).resize(function () {
if ($(window).width() > 921) {
$(".main-left").css("width", "");
$(".darkMask").stop(true);
$(".darkMask").css("display", "none");
showSide = false;
}
});
36 changes: 0 additions & 36 deletions htdocs/luci-static/argon/js/styles-argon.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,42 +74,6 @@
}
});

/**
* Sidebar expand
*/
var showSide = false;
$(".showSide").click(function () {
if (showSide) {
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").width(0);
$(".main-right").css("overflow-y", "auto");
showSide = false;
} else {
$(".darkMask").stop(true).fadeIn("fast");
$(".main-left").width("15rem");
$(".main-right").css("overflow-y", "hidden");
showSide = true;
}
});

$(".darkMask").click(function () {
if (showSide) {
showSide = false;
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").width(0);
$(".main-right").css("overflow-y", "auto");
}
});

$(window).resize(function () {
if ($(window).width() > 921) {
$(".main-left").css("width", "");
$(".darkMask").stop(true);
$(".darkMask").css("display", "none");
showSide = false;
}
});

/**
* fix legend position
*/
Expand Down
4 changes: 3 additions & 1 deletion luasrc/view/themes/argon/header.htm
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,6 @@ <h4><%:JavaScript required!%></h4>
})
</script>

<script src="<%=media%>/js/menu-argon.js<%# ?v=PKG_VERSION %>"></script>
<script src="<%=media%>/js/menu-argon.js<%# ?v=PKG_VERSION %>"></script>

<script src="<%=media%>/js/sidebar-argon.js<%# ?v=PKG_VERSION %>"></script>

0 comments on commit 05be190

Please sign in to comment.