Skip to content

Commit

Permalink
重做<修复防火墙[iptables]列表加载时,导航菜单无响应的问题>
Browse files Browse the repository at this point in the history
分离script.js为menu-argon.js和styles-argon.js,这也将改进一些基于script处理主题风格的效率,
如 软件包[Software] 中 空闲空间[Free space] 的占用指示条;
合并master的footer.htm,header_login.htm,out_header_login.htm;
修复资源版本号
  • Loading branch information
SpeedPartner committed Apr 15, 2023
1 parent 5bd4a5e commit a7e51bd
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 257 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
*
* luci-theme-argon
* Copyright 2019 Jerrykuku <jerrykuku@qq.com>
* Copyright 2023 Jerrykuku <jerrykuku@qq.com>
*
* Have a bug? Please create an issue here on GitHub!
* https://github.com/jerrykuku/luci-theme-argon/issues
Expand All @@ -27,22 +27,6 @@
* Licensed to the public under the Apache License 2.0
*/

/*
* Font generate by Icomoon<icomoon.io>
*/
(function ($) {
$(".main > .loading").fadeOut();

/**
* trim text, Remove spaces, wrap
* @param text
* @returns {string}
*/
function trimText(text) {
return text.replace(/[ \t\n\r]+/g, " ");
}


var lastNode = undefined;
var mainNodeName = undefined;

Expand Down Expand Up @@ -120,21 +104,6 @@

});




// define what element should be observed by the observer
// and what types of mutations trigger the callback
const observer = new MutationObserver(() => {
console.log("callback that runs when observer is triggered");
});
if ($("#cbi-dhcp-lan-ignore").length > 0) {
observer.observe(document.getElementById("cbi-dhcp-lan-ignore"), {
subtree: true,
attributes: true
});
}

/**
* hook menu click and add the hash
*/
Expand Down Expand Up @@ -175,91 +144,6 @@
mainNodeName = mainNodeName.replace(/[ \t\n\r\/]+/g, "_").toLowerCase();
$("body").addClass(mainNodeName);
}

$(".cbi-button-up").val("");
$(".cbi-button-down").val("");


/**
* hook other "A Label" and add hash to it.
*/
$("#maincontent > .container").find("a").each(function () {
var that = $(this);
var onclick = that.attr("onclick");
if (onclick == undefined || onclick == "") {
that.click(function () {
var href = that.attr("href");
if (href.indexOf("#") == -1) {
$(".main > .loading").fadeIn("fast");
return true;
}
});
}
});

/**
* 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
*/
$("legend").each(function () {
var that = $(this);
that.after("<span class='panel-title'>" + that.text() + "</span>");
});

$(".cbi-section-table-titles, .cbi-section-table-descr, .cbi-section-descr").each(function () {
var that = $(this);
if (that.text().trim() == "") {
that.css("padding", "0px");
}
});

$(".node-main-login > .main .cbi-value.cbi-value-last .cbi-input-text").focus(function () {
//$(".node-main-login > .main > .main-right > .login-bg").addClass("blur");
});
$(".node-main-login > .main .cbi-value.cbi-value-last .cbi-input-text").blur(function () {
//$(".node-main-login > .main > .main-right > .login-bg").removeClass("blur");
});


$(".main-right").focus();
$(".main-right").blur();
$("input").attr("size", "0");

if (mainNodeName != undefined) {
console.log(mainNodeName);
Expand All @@ -281,6 +165,4 @@
button.addClass("cbi-button cbi-input-reset a-to-btn");
break;
}
}

})(jQuery);
}
139 changes: 139 additions & 0 deletions htdocs/luci-static/argon/js/styles-argon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/**
* Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
*
* luci-theme-argon
* Copyright 2023 Jerrykuku <jerrykuku@qq.com>
*
* 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 <steven@midlink.org>
* Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
* Copyright 2012 David Menting <david@nut-bolt.nl>
*
* 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
*/

/*
* Font generate by Icomoon<icomoon.io>
*/
(function ($) {
$(".main > .loading").fadeOut();

/**
* trim text, Remove spaces, wrap
* @param text
* @returns {string}
*/
function trimText(text) {
return text.replace(/[ \t\n\r]+/g, " ");
}

// define what element should be observed by the observer
// and what types of mutations trigger the callback
const observer = new MutationObserver(() => {
console.log("callback that runs when observer is triggered");
});
if ($("#cbi-dhcp-lan-ignore").length > 0) {
observer.observe(document.getElementById("cbi-dhcp-lan-ignore"), {
subtree: true,
attributes: true
});
}

$(".cbi-button-up").val("");
$(".cbi-button-down").val("");

/**
* hook other "A Label" and add hash to it.
*/
$("#maincontent > .container").find("a").each(function () {
var that = $(this);
var onclick = that.attr("onclick");
if (onclick == undefined || onclick == "") {
that.click(function () {
var href = that.attr("href");
if (href.indexOf("#") == -1) {
$(".main > .loading").fadeIn("fast");
return true;
}
});
}
});

/**
* 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
*/
$("legend").each(function () {
var that = $(this);
that.after("<span class='panel-title'>" + that.text() + "</span>");
});

$(".cbi-section-table-titles, .cbi-section-table-descr, .cbi-section-descr").each(function () {
var that = $(this);
if (that.text().trim() == "") {
that.css("padding", "0px");
}
});

$(".node-main-login > .main .cbi-value.cbi-value-last .cbi-input-text").focus(function () {
//$(".node-main-login > .main > .main-right > .login-bg").addClass("blur");
});
$(".node-main-login > .main .cbi-value.cbi-value-last .cbi-input-text").blur(function () {
//$(".node-main-login > .main > .main-right > .login-bg").removeClass("blur");
});

$(".main-right").focus();
$(".main-right").blur();
$("input").attr("size", "0");

})(jQuery);
63 changes: 17 additions & 46 deletions luasrc/view/themes/argon/footer.htm
Original file line number Diff line number Diff line change
@@ -1,62 +1,33 @@
<%#
Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material Argon Template

luci-theme-argon
Copyright 2019 Jerrykuku <jerrykuku@qq.com>
Copyright 2020 Jerrykuku <jerrykuku@qq.com>

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 <steven@midlink.org>
Copyright 2008-2016 Jo-Philipp Wich <jow@openwrt.org>
Copyright 2012 David Menting <david@nut-bolt.nl>
luci-theme-material:
Copyright 2015 Lutty Yang <lutty@wcan.in>

Agron Theme
https://demos.creative-tim.com/argon-dashboard/index.html

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/

Font generate by Icomoon
https://icomoon.io/

Licensed to the public under the Apache License 2.0
Licensed to the public under the Apache License 2.0
-%>

<%
local ver = require "luci.version"
local disp = require "luci.dispatcher"
local request = disp.context.path
local category = request[1]
local tree = disp.node()
local categories = disp.node_childs(tree)
%>
<% local ver = require "luci.version" %>
</div>
<footer>
<div class="ftc">
<a class="luci-link" href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %>
(<%= ver.luciversion %>)</a> /
<a href="https://github.com/jerrykuku/luci-theme-argon">ArgonTheme <%# vPKG_VERSION %></a> /
<%= ver.distversion %>
<% if #categories > 1 then %>
<ul class="breadcrumb pull-right" id="modemenu">
<% for i, r in ipairs(categories) do %>
<li<% if request[1] == r then %> class="active" <%end%>><a
href="<%=controller%>/<%=r%>/"><%=striptags(translate(tree.nodes[r].title))%></a> <span
class="divider">|</span></li>
<% end %>
</ul>
<% end %>
<footer class="mobile-hide">
<div>
<a class="luci-link" href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> /
<a href="https://github.com/jerrykuku/luci-theme-argon">ArgonTheme <%# vPKG_VERSION %></a> /
<%= ver.distversion %>
<ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul>
</div>
</footer>
</div>
</div>
<script src="<%=media%>/js/styles-argon.js<%# ?v=PKG_VERSION %>"></script>
</body>
</html>
</html>
Loading

0 comments on commit a7e51bd

Please sign in to comment.