mirror of
https://github.com/coolsnowwolf/luci
synced 2025-01-08 11:27:28 +08:00
luci-theme-design: Bump version to v5.5.5 (#204)
This commit is contained in:
parent
cec860d6c6
commit
a06e7b61d5
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Design Theme
|
||||
LUCI_DEPENDS:=
|
||||
PKG_VERSION:=5.4.3
|
||||
PKG_RELEASE:=20230310
|
||||
PKG_VERSION:=5.5.5
|
||||
PKG_RELEASE:=20230321
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
(function($){const global=$('head #global-scroll');const isMobile=/phone|pad|pod|iPhone|iPod|ios|iOS|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test(navigator.userAgent);function settingGlobalScroll(){if(!isMobile&&global.length===0){const style=document.createElement('style');style.id='global-scroll';style.textContent=`::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-thumb { background: var(--scrollbarColor); border-radius: 2px; }`;$('head').append(style);}else if(isMobile&&global.length>0){global.remove();}}
|
||||
document.addEventListener("DOMContentLoaded",function(){settingGlobalScroll();if(self.location.pathname.includes("status/realtime")){const nodeStatusRealtime=$('.node-status-realtime');const selectorValues=['bandwidth','wifirate','wireless'];for(let i=0;i<selectorValues.length;i++){const value=selectorValues[i];const target=nodeStatusRealtime.find(`embed[src="/luci-static/resources/${value}.svg"] + div + br + table`);if(target.length){const div=document.createElement('div');div.style.overflowX='auto';target.before(div);const newTarget=target.clone();target.remove();div.appendChild(newTarget[0]);}}}});$(window).resize(()=>{settingGlobalScroll();});})(jQuery);
|
File diff suppressed because one or more lines are too long
@ -1,291 +1,11 @@
|
||||
/**
|
||||
* Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI
|
||||
*
|
||||
* luci-theme-material
|
||||
* Copyright 2015 Lutty Yang <lutty@wcan.in>
|
||||
*
|
||||
* 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 <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
|
||||
*
|
||||
* Licensed to the public under the Apache License 2.0
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
// Fixed openclash plugin causing env(safe-area-inset-bottom) to be 0 under https
|
||||
const appleUserAgentRegex = /(iPhone|iPad|iPod|iOS|Mac|Macintosh)/i;
|
||||
var url = self.location.href;
|
||||
if (navigator.userAgent.match(appleUserAgentRegex) && url.indexOf("openclash") != -1 ) {
|
||||
var oMeta = document.createElement('meta');
|
||||
oMeta.content = 'width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover';
|
||||
oMeta.name = 'viewport';
|
||||
document.querySelector('head').appendChild(oMeta);
|
||||
}
|
||||
|
||||
|
||||
function settingGlobalScroll() {
|
||||
const global = $('head #global-scroll');
|
||||
const isMobile = /phone|pad|pod|iPhone|iPod|ios|iOS|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test(navigator.userAgent);
|
||||
|
||||
if (!isMobile && global.length === 0) {
|
||||
const style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
style.id = 'global-scroll';
|
||||
style.textContent = '::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-thumb { background: var(--scrollbarColor); border-radius: 2px; }';
|
||||
$('head').append(style);
|
||||
} else if (isMobile && global.length > 0) {
|
||||
global.remove();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
// Fixed scrollbar styles for browsers on different platforms
|
||||
settingGlobalScroll();
|
||||
// .node-status-realtime embed[src="/luci-static/resources/bandwidth.svg"] + div + br + table
|
||||
// .node-status-realtime embed[src="/luci-static/resources/wifirate.svg"] + div + br + table
|
||||
// .node-status-realtime embed[src="/luci-static/resources/wireless.svg"] + div + br + table
|
||||
if ($('.node-status-realtime').length != 0) {
|
||||
const selectorValues = ["bandwidth", "wifirate", "wireless"];
|
||||
selectorValues.forEach(value => {
|
||||
const target = $(`.node-status-realtime embed[src="/luci-static/resources/${value}.svg"] + div + br + table`);
|
||||
if (target.length) {
|
||||
const div = document.createElement("div");
|
||||
div.style.overflowX = "auto";
|
||||
target.before(div);
|
||||
const newTarget = target.clone();
|
||||
target.remove();
|
||||
div.appendChild(newTarget.get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
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;
|
||||
if (!$('body').hasClass('logged-in')) {
|
||||
luciLocation = ["Main", "Login"];
|
||||
return true;
|
||||
}
|
||||
|
||||
$(".main > .main-left > .nav > .slide > .menu").each(function () {
|
||||
var ulNode = $(this);
|
||||
ulNode.next().find("a").each(function () {
|
||||
var that = $(this);
|
||||
var href = that.attr("href");
|
||||
|
||||
if (href.indexOf(nodeUrl) != -1) {
|
||||
ulNode.click();
|
||||
ulNode.next(".slide-menu").stop(true, true);
|
||||
lastNode = that.parent();
|
||||
lastNode.addClass("active");
|
||||
ret = true;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* menu click
|
||||
*/
|
||||
$(".main > .main-left > .nav > .slide > .menu").click(function () {
|
||||
var ul = $(this).next(".slide-menu");
|
||||
var menu = $(this);
|
||||
if (!menu.hasClass("exit")) {
|
||||
$(".main > .main-left > .nav > .slide > .active").next(".slide-menu").stop(true).slideUp("fast");
|
||||
$(".main > .main-left > .nav > .slide > .menu").removeClass("active");
|
||||
if (!ul.is(":visible")) {
|
||||
menu.addClass("active");
|
||||
ul.addClass("active");
|
||||
ul.stop(true).slideDown("fast");
|
||||
} else {
|
||||
ul.stop(true).slideUp("fast", function () {
|
||||
menu.removeClass("active");
|
||||
ul.removeClass("active");
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* hook menu click and add the hash
|
||||
*/
|
||||
$(".main > .main-left > .nav > .slide > .slide-menu > li > a").click(function () {
|
||||
if (lastNode != undefined) lastNode.removeClass("active");
|
||||
$(this).parent().addClass("active");
|
||||
$(".main > .loading").fadeIn("fast");
|
||||
return true;
|
||||
});
|
||||
|
||||
/**
|
||||
* fix menu click
|
||||
*/
|
||||
$(".main > .main-left > .nav > .slide > .slide-menu > li").click(function () {
|
||||
if (lastNode != undefined) lastNode.removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$(".main > .loading").fadeIn("fast");
|
||||
window.location = $($(this).find("a")[0]).attr("href");
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* get current node and open it
|
||||
*/
|
||||
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("");
|
||||
|
||||
|
||||
/**
|
||||
* 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").stop(true).animate({
|
||||
width: "0"
|
||||
}, "fast");
|
||||
$(".main-right").css("overflow-y", "auto");
|
||||
showSide = false;
|
||||
} else {
|
||||
$(".darkMask").stop(true).fadeIn("fast");
|
||||
$(".main-left").stop(true).animate({
|
||||
width: "17rem"
|
||||
}, "fast");
|
||||
$(".main-right").css("overflow-y", "hidden");
|
||||
$(".showSide").css("display", "none");
|
||||
$("header").css("box-shadow", "17rem 2px 4px rgb(0 0 0 / 8%)")
|
||||
showSide = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(".darkMask").click(function () {
|
||||
if (showSide) {
|
||||
showSide = false;
|
||||
$(".darkMask").stop(true).fadeOut("fast");
|
||||
$(".main-left").stop(true).animate({
|
||||
width: "0"
|
||||
}, "fast");
|
||||
$(".main-right").css("overflow-y", "auto");
|
||||
$(".showSide").css("display", "");
|
||||
$("header").css("box-shadow", "0 2px 4px rgb(0 0 0 / 8%)")
|
||||
}
|
||||
});
|
||||
|
||||
$(window).resize(function () {
|
||||
// Fixed scrollbar styles for browsers on different platforms
|
||||
settingGlobalScroll();
|
||||
|
||||
if ($(window).width() > 992) {
|
||||
$(".showSide").css("display", "");
|
||||
$(".main-left").css("width", "");
|
||||
$(".darkMask").stop(true);
|
||||
$(".darkMask").css("display", "none");
|
||||
showSide = false;
|
||||
$("header").css("box-shadow", "17rem 2px 4px rgb(0 0 0 / 8%)")
|
||||
} else {
|
||||
$("header").css("box-shadow", "0 2px 4px rgb(0 0 0 / 8%)")
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* fix legend position
|
||||
*/
|
||||
$("legend").each(function () {
|
||||
var that = $(this);
|
||||
that.after("<span class='panel-title'>" + that.text() + "</span>");
|
||||
});
|
||||
|
||||
$(".main-right").focus();
|
||||
$(".main-right").blur();
|
||||
$("input").attr("size", "0");
|
||||
|
||||
if (mainNodeName != undefined) {
|
||||
console.log(mainNodeName);
|
||||
switch (mainNodeName) {
|
||||
case "node-status-system_log":
|
||||
case "node-status-kernel_log":
|
||||
$("#syslog").focus(function () {
|
||||
$("#syslog").blur();
|
||||
$(".main-right").focus();
|
||||
$(".main-right").blur();
|
||||
});
|
||||
break;
|
||||
case "node-status-firewall":
|
||||
var button = $(".node-status-firewall > .main fieldset li > a");
|
||||
button.addClass("cbi-button cbi-button-reset a-to-btn");
|
||||
break;
|
||||
case "node-system-reboot":
|
||||
var button = $(".node-system-reboot > .main > .main-right p > a");
|
||||
button.addClass("cbi-button cbi-input-reset a-to-btn");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
(function($){$(".main > .loading").fadeOut();function trimText(text){return text.replace(/[ \t\n\r]+/g," ");}
|
||||
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);function getCurrentNodeByUrl(){var ret=false;if(!$('body').hasClass('logged-in')){luciLocation=["Main","Login"];return true;}
|
||||
$(".main > .main-left > .nav > .slide > .active").next(".slide-menu").stop(true).slideUp("fast");$(".main > .main-left > .nav > .slide > .menu").removeClass("active");$(".main > .main-left > .nav > .slide > .menu").each(function(){var ulNode=$(this);ulNode.next().find("a").each(function(){var that=$(this);var href=that.attr("href");if(new RegExp(nodeUrl+"$").test(href)){ulNode.click();ulNode.next(".slide-menu").stop(true,true);lastNode=that.parent();lastNode.addClass("active");ret=true;return true;}});});return ret;}
|
||||
$(".main > .main-left > .nav > .slide > .menu").click(function(){var ul=$(this).next(".slide-menu");var menu=$(this);if(!menu.hasClass("exit")){$(".main > .main-left > .nav > .slide > .active").next(".slide-menu").stop(true).slideUp("fast");$(".main > .main-left > .nav > .slide > .menu").removeClass("active");if(!ul.is(":visible")){menu.addClass("active");ul.addClass("active");ul.stop(true).slideDown("fast");}else{ul.stop(true).slideUp("fast",function(){menu.removeClass("active");ul.removeClass("active");});}
|
||||
return false;}});if($("#cbi-dhcp-lan-ignore").length>0){observer.observe(document.getElementById("cbi-dhcp-lan-ignore"),{subtree:true,attributes:true});}
|
||||
$(".main > .main-left > .nav > .slide > .slide-menu > li > a").click(function(){if(lastNode!=undefined)
|
||||
lastNode.removeClass("active");$(this).parent().addClass("active");$(".main > .loading").fadeIn("fast");return true;});$(".main > .main-left > .nav > .slide > .slide-menu > li").click(function(){if(lastNode!=undefined)
|
||||
lastNode.removeClass("active");$(this).addClass("active");$(".main > .loading").fadeIn("fast");window.location=$($(this).find("a")[0]).attr("href");return false;});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("");$("#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;}});}});var showSide=false;$(".showSide").click(function(){if(showSide){$(".darkMask").stop(true).fadeOut("fast");$(".main-left").stop(true).animate({width:"0"},"fast");$(".main-right").css("overflow-y","auto");showSide=false;}else{$(".darkMask").stop(true).fadeIn("fast");$(".main-left").stop(true).animate({width:"17rem"},"fast");$(".main-right").css("overflow-y","hidden");$(".showSide").css("display","none");$("header").css("box-shadow","17rem 2px 4px rgb(0 0 0 / 8%)")
|
||||
showSide=true;}});$(".darkMask").click(function(){if(showSide){showSide=false;$(".darkMask").stop(true).fadeOut("fast");$(".main-left").stop(true).animate({width:"0"},"fast");$(".main-right").css("overflow-y","auto");$(".showSide").css("display","");$("header").css("box-shadow","0 2px 4px rgb(0 0 0 / 8%)")}});$(window).resize(function(){if($(window).width()>992){$(".showSide").css("display","");$(".main-left").css("width","");$(".darkMask").stop(true);$(".darkMask").css("display","none");showSide=false;$("header").css("box-shadow","17rem 2px 4px rgb(0 0 0 / 8%)")}else{$("header").css("box-shadow","0 2px 4px rgb(0 0 0 / 8%)")}});$("legend").each(function(){var that=$(this);that.after("<span class='panel-title'>"+that.text()+"</span>");});$(".main-right").focus();$(".main-right").blur();$("input").attr("size","0");if(mainNodeName!=undefined){switch(mainNodeName){case "node-status-system_log":case "node-status-kernel_log":$("#syslog").focus(function(){$("#syslog").blur();$(".main-right").focus();$(".main-right").blur();});break;case "node-status-firewall":var button=$(".node-status-firewall > .main fieldset li > a");button.addClass("cbi-button cbi-button-reset a-to-btn");break;case "node-system-reboot":var button=$(".node-system-reboot > .main > .main-right p > a");button.addClass("cbi-button cbi-input-reset a-to-btn");break;}}})(jQuery);
|
||||
|
68
themes/luci-theme-design/htdocs/luci-static/design/js/xhr.js
Normal file
68
themes/luci-theme-design/htdocs/luci-static/design/js/xhr.js
Normal file
@ -0,0 +1,68 @@
|
||||
XHR=function()
|
||||
{this.reinit=function()
|
||||
{if(window.XMLHttpRequest){this._xmlHttp=new XMLHttpRequest();}
|
||||
else if(window.ActiveXObject){this._xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
|
||||
else{alert("xhr.js: XMLHttpRequest is not supported by this browser!");}}
|
||||
this.busy=function(){if(!this._xmlHttp)
|
||||
return false;switch(this._xmlHttp.readyState)
|
||||
{case 1:case 2:case 3:return true;default:return false;}}
|
||||
this.abort=function(){if(this.busy())
|
||||
this._xmlHttp.abort();}
|
||||
this.get=function(url,data,callback)
|
||||
{this.reinit();var xhr=this._xmlHttp;var code=this._encode(data);url=location.protocol+'//'+location.host+url;if(code)
|
||||
if(url.substr(url.length-1,1)=='&')
|
||||
url+=code;else
|
||||
url+='?'+code;xhr.open('GET',url,true);xhr.onreadystatechange=function()
|
||||
{if(xhr.readyState==4){var json=null;if(xhr.getResponseHeader("Content-Type")=="application/json"){try{json=eval('('+xhr.responseText+')');}
|
||||
catch(e){json=null;}}
|
||||
callback(xhr,json);}}
|
||||
xhr.send(null);}
|
||||
this.post=function(url,data,callback)
|
||||
{this.reinit();var xhr=this._xmlHttp;var code=this._encode(data);xhr.onreadystatechange=function()
|
||||
{if(xhr.readyState==4)
|
||||
callback(xhr);}
|
||||
xhr.open('POST',url,true);xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.send(code);}
|
||||
this.cancel=function()
|
||||
{this._xmlHttp.onreadystatechange=function(){};this._xmlHttp.abort();}
|
||||
this.send_form=function(form,callback,extra_values)
|
||||
{var code='';for(var i=0;i<form.elements.length;i++)
|
||||
{var e=form.elements[i];if(e.options)
|
||||
{code+=(code?'&':'')+
|
||||
form.elements[i].name+'='+encodeURIComponent(e.options[e.selectedIndex].value);}
|
||||
else if(e.length)
|
||||
{for(var j=0;j<e.length;j++)
|
||||
if(e[j].name){code+=(code?'&':'')+
|
||||
e[j].name+'='+encodeURIComponent(e[j].value);}}
|
||||
else
|
||||
{code+=(code?'&':'')+
|
||||
e.name+'='+encodeURIComponent(e.value);}}
|
||||
if(typeof extra_values=='object')
|
||||
for(var key in extra_values)
|
||||
code+=(code?'&':'')+
|
||||
key+'='+encodeURIComponent(extra_values[key]);return((form.method=='get')?this.get(form.getAttribute('action'),code,callback):this.post(form.getAttribute('action'),code,callback));}
|
||||
this._encode=function(obj)
|
||||
{obj=obj?obj:{};obj['_']=Math.random();if(typeof obj=='object')
|
||||
{var code='';var self=this;for(var k in obj)
|
||||
code+=(code?'&':'')+
|
||||
k+'='+encodeURIComponent(obj[k]);return code;}
|
||||
return obj;}}
|
||||
XHR.get=function(url,data,callback)
|
||||
{(new XHR()).get(url,data,callback);}
|
||||
XHR.poll=function(interval,url,data,callback)
|
||||
{if(isNaN(interval)||interval<1)
|
||||
interval=5;if(!XHR._q)
|
||||
{XHR._t=0;XHR._q=[];XHR._r=function(){for(var i=0,e=XHR._q[0];i<XHR._q.length;e=XHR._q[++i])
|
||||
{if(!(XHR._t%e.interval)&&!e.xhr.busy())
|
||||
e.xhr.get(e.url,e.data,e.callback);}
|
||||
XHR._t++;};}
|
||||
XHR._q.push({interval:interval,callback:callback,url:url,data:data,xhr:new XHR()});XHR.run();}
|
||||
XHR.halt=function()
|
||||
{if(XHR._i)
|
||||
{try{document.getElementById('xhr_poll_status').style.display='';document.getElementById('xhr_poll_status_on').style.display='none';document.getElementById('xhr_poll_status_off').style.display='';document.getElementById('notice_status').style.marginRight='30px'}catch(e){}
|
||||
window.clearInterval(XHR._i);XHR._i=null;}}
|
||||
XHR.run=function()
|
||||
{if(XHR._r&&!XHR._i)
|
||||
{try{document.getElementById('xhr_poll_status').style.display='';document.getElementById('xhr_poll_status_on').style.display='';document.getElementById('xhr_poll_status_off').style.display='none';document.getElementById('notice_status').style.marginRight='30px'}catch(e){}
|
||||
XHR._r();XHR._i=window.setInterval(XHR._r,1000);}}
|
||||
XHR.running=function()
|
||||
{return!!(XHR._r&&XHR._i);}
|
@ -47,10 +47,18 @@
|
||||
</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?v=<%= ver.luciversion %>"></script>
|
||||
// thanks for Jo-Philipp Wich <jow@openwrt.org>
|
||||
var luciLocation = <%= luci.http.write_json(luci.dispatcher.context.path) %>;
|
||||
// Fixed openclash plugin causing env(safe-area-inset-bottom) to be 0 under
|
||||
const appleUserAgentRegex = /(iPhone|iPad|iPod|iOS)/i;
|
||||
var url = self.location.href;
|
||||
if (navigator.userAgent.match(appleUserAgentRegex) && url.indexOf("openclash") != -1) {
|
||||
var oMeta = document.createElement('meta');
|
||||
oMeta.content = 'width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover';
|
||||
oMeta.name = 'viewport';
|
||||
document.querySelector('head').appendChild(oMeta);
|
||||
}
|
||||
</script>
|
||||
<script src="<%=media%>/js/script.js?v=<%= ver.luciversion %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -18,9 +18,6 @@
|
||||
Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Copyright 2012 David Menting <david@nut-bolt.nl>
|
||||
|
||||
luci-theme-neobird:
|
||||
Copyright 2021 2smile <thinktip@gmail.com>
|
||||
|
||||
MUI:
|
||||
https://github.com/muicss/mui
|
||||
|
||||
@ -164,7 +161,9 @@
|
||||
<%-= css %>
|
||||
</style>
|
||||
<% end -%>
|
||||
<script src="<%=resource%>/xhr.js?<%= ver.luciversion %>"></script>
|
||||
<script src="<%=media%>/js/xhr.js?v=<%= ver.luciversion %>"></script>
|
||||
<script src="<%=media%>/js/jquery.min.js?v=<%= ver.luciversion %>"></script>
|
||||
<script src="<%=media%>/js/design.js?v=<%= ver.luciversion %>" async></script>
|
||||
<style title="text/css" id="global-scroll">
|
||||
::-webkit-scrollbar {
|
||||
width: 4px
|
||||
@ -176,21 +175,23 @@
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>">
|
||||
<body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>"
|
||||
<% if mode ~= 'normal' then %>
|
||||
data-theme = "<%= mode %>"
|
||||
<% end -%>
|
||||
>
|
||||
|
||||
<header>
|
||||
|
||||
<script>
|
||||
<% if mode == 'normal' then %>
|
||||
let color_scheme = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
document.body.setAttribute('data-theme', color_scheme.matches? 'dark' : 'light');
|
||||
window.matchMedia && color_scheme.addEventListener('change', (event) => {
|
||||
document.body.setAttribute('data-theme', event.matches? 'dark' : 'light');
|
||||
})
|
||||
<% else %>
|
||||
document.body.setAttribute('data-theme', '<%= mode %>' === 'dark' ? 'dark' : 'light');
|
||||
<script>
|
||||
function setTheme() {
|
||||
let color_scheme = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
document.body.setAttribute('data-theme', color_scheme.matches && 'dark');
|
||||
}
|
||||
setTheme();
|
||||
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', setTheme);
|
||||
</script>
|
||||
<% end -%>
|
||||
</script>
|
||||
|
||||
<% if navbar == 'display' then %>
|
||||
<style>
|
||||
@ -236,7 +237,7 @@
|
||||
end
|
||||
%>
|
||||
<% if ucichanges > 0 then %>
|
||||
<a class="label notice" href="<%=url(category, 'uci/changes')%>?redir=<%=http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/"))%>"><%=translate('Unsaved Changes')%>: <%=ucichanges%></a>
|
||||
<a id="notice_status" class="label notice" href="<%=url(category, 'uci/changes')%>?redir=<%=http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/"))%>"><%=translate('Unsaved Changes')%>: <%=ucichanges%></a>
|
||||
<% end %>
|
||||
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||
<span class="label success" id="xhr_poll_status_on"><span id="refresh_on" class="mobile-hide"></span></span>
|
||||
@ -244,11 +245,6 @@
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user