summaryrefslogtreecommitdiffhomepage
path: root/themes/luci-theme-material
diff options
context:
space:
mode:
Diffstat (limited to 'themes/luci-theme-material')
-rwxr-xr-xthemes/luci-theme-material/htdocs/luci-static/material/css/style.css40
-rwxr-xr-xthemes/luci-theme-material/htdocs/luci-static/material/js/script.js187
-rwxr-xr-xthemes/luci-theme-material/luasrc/view/themes/material/footer.htm4
3 files changed, 58 insertions, 173 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 734e300547..6b5a0bae31 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
@@ -1096,7 +1096,7 @@ header > .container > .pull-right > * {
white-space: normal;
}
-.node-status-firewall > .main div > .cbi-map > form {
+.node-status-iptables > .main div > .cbi-map > form {
margin: 2rem 2rem 0 0;
}
@@ -1108,34 +1108,34 @@ header > .container > .pull-right > * {
}
/* fix Services Network Shares*/
-.node-services-network_shares > .main .cbi-tabcontainer:nth-child(3) .cbi-value-title {
+.node-services-samba > .main .cbi-tabcontainer:nth-child(3) .cbi-value-title {
margin-bottom: 1rem;
}
-.node-services-network_shares > .main .cbi-tabcontainer:nth-child(3) .cbi-value-field {
+.node-services-samba > .main .cbi-tabcontainer:nth-child(3) .cbi-value-field {
display: list-item;
}
-.node-services-network_shares > .main .cbi-tabcontainer:nth-child(3) .cbi-value-description {
+.node-services-samba > .main .cbi-tabcontainer:nth-child(3) .cbi-value-description {
padding-top: 1rem;
}
/* fix System Software*/
-.node-system-software > .main table tr td:nth-child(1) {
+.node-system-packages > .main table tr td:nth-child(1) {
width: auto !important;
}
-.node-system-software > .main table tr td:nth-last-child(1) {
+.node-system-packages > .main table tr td:nth-last-child(1) {
white-space: normal;
font-size: small;
color: #404040;
}
-.node-system-software > .main .cbi-tabmenu > li > a, .tabs > li > a {
+.node-system-packages > .main .cbi-tabmenu > li > a, .tabs > li > a {
padding: 0.5rem 1rem;
}
-.node-system-software > .main .cbi-value > pre {
+.node-system-packages > .main .cbi-value > pre {
background-color: #eee;
padding: 0.5rem;
overflow: auto;
@@ -1150,15 +1150,15 @@ header > .container > .pull-right > * {
min-width: 4rem;
}
-.node-status-firewall fieldset,
-.node-system-software fieldset,
-.node-system-backup_flash_firmware fieldset {
+.node-status-iptables fieldset,
+.node-system-packages fieldset,
+.node-system-flashops fieldset {
margin-top: 0;
}
-.node-status-firewall .cbi-tabmenu,
-.node-system-software .cbi-tabmenu,
-.node-system-backup_flash_firmware .cbi-tabmenu {
+.node-status-iptables .cbi-tabmenu,
+.node-system-packages .cbi-tabmenu,
+.node-system-flashops .cbi-tabmenu {
border: none;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .16), 0 0 2px 0 rgba(0, 0, 0, .12);
}
@@ -1223,7 +1223,7 @@ body.lang_pl.node-main-login .cbi-value-title {
font-size: smaller;
}
- .node-status-firewall > .main fieldset li > a {
+ .node-status-iptables > .main fieldset li > a {
padding: 0.3rem 0.6rem;
}
}
@@ -1434,15 +1434,15 @@ body.lang_pl.node-main-login .cbi-value-title {
padding-bottom: 1rem;
}
- .node-system-software > .main .cbi-value.cbi-value-last > div {
+ .node-system-packages > .main .cbi-value.cbi-value-last > div {
width: 100% !important;
}
- .node-system-software > .main .cbi-value .cbi-value-field input {
+ .node-system-packages > .main .cbi-value .cbi-value-field input {
width: 100%;
}
- .node-status-firewall > .main div > .cbi-map > form {
+ .node-status-iptables > .main div > .cbi-map > form {
position: static !important;
margin: 0 0 2rem 0;
padding: 2rem;
@@ -1460,12 +1460,12 @@ body.lang_pl.node-main-login .cbi-value-title {
-webkit-overflow-scrolling: touch;
}
- .node-status-firewall > .main div > .cbi-map > form input[type="submit"]{
+ .node-status-iptables > .main div > .cbi-map > form input[type="submit"]{
width: 100% !important;
margin: 0;
}
- .node-status-firewall > .main div > .cbi-map > form input[type="submit"] + input[type="submit"]{
+ .node-status-iptables > .main div > .cbi-map > form input[type="submit"] + input[type="submit"]{
margin-top: 1rem;
}
}
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 b19274fa73..d402728e55 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
@@ -18,109 +18,6 @@
* Licensed to the public under the Apache License 2.0
*/
(function ($) {
- var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
- a256 = '',
- r64 = [256],
- r256 = [256],
- i = 0;
- var UTF8 = {
- /**
- * Encode multi-byte Unicode string into utf-8 multiple single-byte characters
- * (BMP / basic multilingual plane only)
- *
- * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars
- *
- * @param {String} strUni Unicode string to be encoded as UTF-8
- * @returns {String} encoded string
- */
- encode: function (strUni) {
- // use regular expressions & String.replace callback function for better efficiency
- // than procedural approaches
- var strUtf = strUni.replace(/[\u0080-\u07ff]/g, // U+0080 - U+07FF => 2 bytes 110yyyyy, 10zzzzzz
- function (c) {
- var cc = c.charCodeAt(0);
- return String.fromCharCode(0xc0 | cc >> 6, 0x80 | cc & 0x3f);
- })
- .replace(/[\u0800-\uffff]/g, // U+0800 - U+FFFF => 3 bytes 1110xxxx, 10yyyyyy, 10zzzzzz
- function (c) {
- var cc = c.charCodeAt(0);
- return String.fromCharCode(0xe0 | cc >> 12, 0x80 | cc >> 6 & 0x3F, 0x80 | cc & 0x3f);
- });
- return strUtf;
- },
- /**
- * Decode utf-8 encoded string back into multi-byte Unicode characters
- *
- * @param {String} strUtf UTF-8 string to be decoded back to Unicode
- * @returns {String} decoded string
- */
- decode: function (strUtf) {
- // note: decode 3-byte chars first as decoded 2-byte strings could appear to be 3-byte char!
- var strUni = strUtf.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars
- function (c) { // (note parentheses for precence)
- var cc = ((c.charCodeAt(0) & 0x0f) << 12) | ((c.charCodeAt(1) & 0x3f) << 6) | (c.charCodeAt(2) & 0x3f);
- return String.fromCharCode(cc);
- })
- .replace(/[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars
- function (c) { // (note parentheses for precence)
- var cc = (c.charCodeAt(0) & 0x1f) << 6 | c.charCodeAt(1) & 0x3f;
- return String.fromCharCode(cc);
- });
- return strUni;
- }
- };
- while (i < 256) {
- var c = String.fromCharCode(i);
- a256 += c;
- r256[i] = i;
- r64[i] = b64.indexOf(c);
- ++i;
- }
- function code(s, discard, alpha, beta, w1, w2) {
- s = String(s);
- var buffer = 0,
- i = 0,
- length = s.length,
- result = '',
- bitsInBuffer = 0;
- while (i < length) {
- var c = s.charCodeAt(i);
- c = c < 256 ? alpha[c] : -1;
- buffer = (buffer << w1) + c;
- bitsInBuffer += w1;
- while (bitsInBuffer >= w2) {
- bitsInBuffer -= w2;
- var tmp = buffer >> bitsInBuffer;
- result += beta.charAt(tmp);
- buffer ^= tmp << bitsInBuffer;
- }
- ++i;
- }
- if (!discard && bitsInBuffer > 0) result += beta.charAt(buffer << (w2 - bitsInBuffer));
- return result;
- }
-
- var Plugin = $.base64 = function (dir, input, encode) {
- return input ? Plugin[dir](input, encode) : dir ? null : this;
- };
- Plugin.btoa = Plugin.encode = function (plain, utf8encode) {
- plain = Plugin.raw === false || Plugin.utf8encode || utf8encode ? UTF8.encode(plain) : plain;
- plain = code(plain, false, r256, b64, 8, 6);
- return plain + '===='.slice((plain.length % 4) || 4);
- };
- Plugin.atob = Plugin.decode = function (coded, utf8decode) {
- coded = String(coded).split('=');
- var i = coded.length;
- do {
- --i;
- coded[i] = code(coded[i], true, r64, a256, 6, 8);
- } while (i > 0);
- coded = coded.join('');
- return Plugin.raw === false || Plugin.utf8decode || utf8decode ? UTF8.decode(coded) : coded;
- };
-}(jQuery));
-
-(function ($) {
$(".main > .loading").fadeOut();
/**
@@ -133,40 +30,33 @@
}
- var tree = undefined;
var lastNode = undefined;
var mainNodeName = undefined;
+ var nodeUrl = "";
+ (function(node){
+ if (node[0] == "admin"){
+ luciLocation = [node[1], node[2]];
+ }else{
+ luciLocation = node;
+ }
+
+ for(var i in luciLocation){
+ nodeUrl += luciLocation[i];
+ if (i != luciLocation.length - 1){
+ nodeUrl += "/";
+ }
+ }
+ })(luciLocation);
+
/**
* get the current node by Burl (primary)
* @returns {boolean} success?
*/
function getCurrentNodeByUrl() {
var ret = false;
- var getUrlNode = function (href){
- if (!$('body').hasClass('logged-in')){
- return "login";
- }else{
- if (href == "/cgi-bin/luci/"){
- return "overview";
- }else{
- var link = href.substr(href.indexOf("admin/"));
- if (link == "/")
- return "overview";
- else
- return link;
- }
- }
- };
-
- var currentNode = getUrlNode(window.location.pathname);
-
- if (currentNode == "login"){
- tree = ["Main", "Login"];
- return false;
- }else if(currentNode == "overview"){
- tree = ["Status", "Overview"];
- lastNode = $($($(".main > .main-left > .nav > .slide > .menu")[0]).next().find("a")[0]).parent();
+ if (!$('body').hasClass('logged-in')) {
+ luciLocation = ["Main", "Login"];
return false;
}
@@ -176,11 +66,10 @@
var that = $(this);
var href = that.attr("href");
- if (currentNode.indexOf(getUrlNode(href)) != -1){
+ if (href.indexOf(nodeUrl) != -1) {
ulNode.click();
- ulNode.next(".slide-menu").stop(true,true);
+ ulNode.next(".slide-menu").stop(true, true);
lastNode = that.parent();
- tree = [trimText(ulNode.data("title")), trimText(that.data("title"))];
lastNode.addClass("active");
ret = true;
return true;
@@ -232,18 +121,10 @@
/**
* get current node and open it
*/
- if (!getCurrentNodeByUrl()){
- if (tree != undefined && tree[0] == "Status" && tree[1] == "Overview"){
- //overview
- lastNode.addClass("active");
- $($(".main > .main-left > .nav > .slide > .menu")[0]).click();
- }
- }
- if (tree != undefined){
- mainNodeName = "node-"+ tree[0] + "-" + tree[1];
- mainNodeName = mainNodeName.replace(/[ \t\n\r\/]+/g,"_").toLowerCase();
+ if (getCurrentNodeByUrl()) {
+ mainNodeName = "node-" + luciLocation[0] + "-" + luciLocation[1];
+ mainNodeName = mainNodeName.replace(/[ \t\n\r\/]+/g, "_").toLowerCase();
$("body").addClass(mainNodeName);
-
}
$(".cbi-button-up").val("");
$(".cbi-button-down").val("");
@@ -255,10 +136,10 @@
$("#maincontent > .container").find("a").each(function () {
var that = $(this);
var onclick = that.attr("onclick");
- if (onclick == undefined || onclick == ""){
+ if (onclick == undefined || onclick == "") {
that.click(function () {
var href = that.attr("href");
- if (href.indexOf("#") == -1){
+ if (href.indexOf("#") == -1) {
$(".main > .loading").fadeIn("fast");
return true;
}
@@ -271,18 +152,18 @@
*/
var showSide = false;
$(".showSide").click(function () {
- if (showSide){
+ if (showSide) {
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").stop(true).animate({
width: "0"
- },"fast");
+ }, "fast");
$(".main-right").css("overflow-y", "auto");
showSide = false;
- }else{
+ } else {
$(".darkMask").stop(true).fadeIn("fast");
$(".main-left").stop(true).animate({
width: "15rem"
- },"fast");
+ }, "fast");
$(".main-right").css("overflow-y", "hidden");
showSide = true;
}
@@ -290,17 +171,17 @@
$(".darkMask").click(function () {
- if (showSide){
+ if (showSide) {
showSide = false;
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").stop(true).animate({
width: "0"
- },"fast");
+ }, "fast");
$(".main-right").css("overflow-y", "auto");
}
});
- $(window).resize(function() {
+ $(window).resize(function () {
if ($(window).width() > 921) {
$(".main-left").css("width", "");
$(".darkMask").stop(true);
@@ -322,9 +203,9 @@
$(".main-right").blur();
$("input").attr("size", "0");
- if (mainNodeName != undefined){
+ if (mainNodeName != undefined) {
console.log(mainNodeName);
- switch (mainNodeName){
+ switch (mainNodeName) {
case "node-status-system_log":
case "node-status-kernel_log":
$("#syslog").focus(function () {
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 5cb74ce1e4..edf85dcdb0 100755
--- a/themes/luci-theme-material/luasrc/view/themes/material/footer.htm
+++ b/themes/luci-theme-material/luasrc/view/themes/material/footer.htm
@@ -41,6 +41,10 @@
</div>
</div>
+ <script>
+ // thanks for Jo-Philipp Wich <jow@openwrt.org>
+ var luciLocation = <%= luci.http.write_json(luci.dispatcher.context.path) %>;
+ </script>
<script src="<%=media%>/js/jquery.min.js"></script>
<script src="<%=media%>/js/script.js"></script>
</body>