From c332c660318f9d7916daa6855ebdc63504d02b07 Mon Sep 17 00:00:00 2001 From: Lutty Yang Date: Thu, 17 Sep 2015 16:19:48 +0800 Subject: [PATCH] Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI Signed-off-by: Lutty Yang --- .../htdocs/luci-static/material/css/style.css | 30 +++++++-- .../htdocs/luci-static/material/js/script.js | 63 ++++++++++++++++--- .../luasrc/view/themes/material/footer.htm | 23 ++++--- .../luasrc/view/themes/material/header.htm | 19 +++--- 4 files changed, 105 insertions(+), 30 deletions(-) diff --git a/themes/luci-theme-material/htdocs/luci-static/material/css/style.css b/themes/luci-theme-material/htdocs/luci-static/material/css/style.css index 9dbfcaecdd..e98ae3c691 100755 --- a/themes/luci-theme-material/htdocs/luci-static/material/css/style.css +++ b/themes/luci-theme-material/htdocs/luci-static/material/css/style.css @@ -1,3 +1,26 @@ +/** + * Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI + * + * luci-theme-material + * Copyright 2015 Lutty Yang + * + * Have a bug? Please create an issue here on GitHub! + * https://github.com/LuttyYang/luci-theme-material/issues + * + * luci-theme-bootstrap: + * Copyright 2008 Steven Barth + * Copyright 2008 Jo-Philipp Wich + * Copyright 2012 David Menting + * + * MUI: + * https://github.com/muicss/mui + * + * Licensed to the public under the Apache License 2.0 + */ + +/* + * Font generate by Icomoon + */ @font-face { font-family: 'icomoon'; src: url('../fonts/font.eot'); @@ -362,7 +385,7 @@ footer { left: 0; } -/* 进度条fix */ +/* fix progress bar */ #memfree > div, #membuff > div, #conns > div, @@ -379,7 +402,7 @@ footer { background-color: #0099CC !important; } -/* 多重table fix*/ +/* fix multiple table */ table table { border: none; @@ -397,7 +420,7 @@ td > table > tbody > tr > td { border: none; } -/* button 样式 */ +/* button style */ .cbi-button { box-sizing: border-box; @@ -714,7 +737,6 @@ td > table > tbody > tr > td { .uci-change-list var ins, .uci-change-list var del { - /*display: inline;*/ border: none; white-space: pre; font-style: normal; diff --git a/themes/luci-theme-material/htdocs/luci-static/material/js/script.js b/themes/luci-theme-material/htdocs/luci-static/material/js/script.js index 7ba9624c9c..b6e0db4740 100755 --- a/themes/luci-theme-material/htdocs/luci-static/material/js/script.js +++ b/themes/luci-theme-material/htdocs/luci-static/material/js/script.js @@ -1,5 +1,21 @@ /** - * Created by WebStorm on 15-9-13. + * Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI + * + * luci-theme-material + * Copyright 2015 Lutty Yang + * + * Have a bug? Please create an issue here on GitHub! + * https://github.com/LuttyYang/luci-theme-material/issues + * + * luci-theme-bootstrap: + * Copyright 2008 Steven Barth + * Copyright 2008 Jo-Philipp Wich + * Copyright 2012 David Menting + * + * MUI: + * https://github.com/muicss/mui + * + * Licensed to the public under the Apache License 2.0 */ (function ($) { var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", @@ -104,15 +120,24 @@ }; }(jQuery)); +(function ($) { + /** + * trim text, Remove spaces, wrap + * @param text + * @returns {string} + */ + function trimText(text) { + return text.replace(/[ \t\n\r]+/g, " "); + } -function trimText(text) { - return text.replace(/[ \t\n\r]+/g, " "); -} -(function ($) { var tree = undefined; var lastNode = undefined; + /** + * get the current node by Hash (reserve) + * @returns {boolean} success? + */ function getCurrentNodeByHash() { var ret = false; var hash = window.location.hash; @@ -138,6 +163,10 @@ function trimText(text) { return ret; } + /** + * get the current node by Burl (primary) + * @returns {boolean} success? + */ function getCurrentNodeByUrl() { var ret = false; var getUrlNode = function (href){ @@ -188,6 +217,9 @@ function trimText(text) { return ret; } + /** + * menu click + */ $(".main > .main-left > .nav > .slide > .menu").click(function () { var ul = $(this).next(".slide-menu"); var menu = $(this); @@ -203,6 +235,9 @@ function trimText(text) { } }); + /** + * hook menu click and add the hash + */ $(".main > .main-left > .nav > .slide > .slide-menu > li > a").click(function () { var href = $(this).attr("href"); var tree = trimText($(this).parent().parent().prev().data("title")) + "|" + trimText($(this).data("title")); @@ -213,11 +248,16 @@ function trimText(text) { return false; }); + /** + * fix menu click + */ $(".main > .main-left > .nav > .slide > .slide-menu > li").click(function () { $(this).find("a").click(); }); - + /** + * get current node and open it + */ if (!getCurrentNodeByUrl()){ getCurrentNodeByHash(); if (tree[0] == "Status" && tree[1] == "Overview"){ @@ -232,6 +272,9 @@ function trimText(text) { $(".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"); @@ -248,6 +291,9 @@ function trimText(text) { } }); + /** + * Sidebar expand + */ var showSide = false; $(".showSide").click(function () { if (showSide){ @@ -285,10 +331,11 @@ function trimText(text) { } }); + /** + * fix legend position + */ $("legend").each(function () { var that = $(this); that.after("" + that.text() + ""); }); - - window.scrollTo(0,1); })(jQuery); diff --git a/themes/luci-theme-material/luasrc/view/themes/material/footer.htm b/themes/luci-theme-material/luasrc/view/themes/material/footer.htm index 25a8b8cb66..5966152132 100755 --- a/themes/luci-theme-material/luasrc/view/themes/material/footer.htm +++ b/themes/luci-theme-material/luasrc/view/themes/material/footer.htm @@ -1,18 +1,21 @@ <%# -luci-theme-material is based on MUI and luci-theme-bootstrap. + Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI -luci-theme-bootstrap: -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich -Copyright 2012 David Menting + luci-theme-material + Copyright 2015 Lutty Yang -MUI: -https://github.com/muicss/mui + Have a bug? Please create an issue here on GitHub! + https://github.com/LuttyYang/luci-theme-material/issues -luci-theme-material -Copyright 2015 Lutty Yang + luci-theme-bootstrap: + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Copyright 2012 David Menting -Licensed to the public under the Apache License 2.0 + MUI: + https://github.com/muicss/mui + + Licensed to the public under the Apache License 2.0 -%> <% diff --git a/themes/luci-theme-material/luasrc/view/themes/material/header.htm b/themes/luci-theme-material/luasrc/view/themes/material/header.htm index 0fcf76f767..3a4f897ca4 100755 --- a/themes/luci-theme-material/luasrc/view/themes/material/header.htm +++ b/themes/luci-theme-material/luasrc/view/themes/material/header.htm @@ -1,16 +1,19 @@ <%# - luci-theme-material is based on MUI and luci-theme-bootstrap. + Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI + + luci-theme-material + Copyright 2015 Lutty Yang + + Have a bug? Please create an issue here on GitHub! + https://github.com/LuttyYang/luci-theme-material/issues luci-theme-bootstrap: - Copyright 2008 Steven Barth - Copyright 2008 Jo-Philipp Wich - Copyright 2012 David Menting + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Copyright 2012 David Menting MUI: - https://github.com/muicss/mui - - luci-theme-material - Copyright 2015 Lutty Yang + https://github.com/muicss/mui Licensed to the public under the Apache License 2.0 -%> -- 2.30.2