<%#
	Edge is a clean HTML5 theme for LuCI. It is based on luci-theme-material edge Template

	luci-theme-Edge
	Copyright 2020 Kiddin'

	Have a bug? Please create an issue here on GitHub!
	https://github.com/kiddin9/luci-theme-edge/issues 

	luci-theme-Argon: 
	Copyright 2019 Jerrykuku <jerrykuku@qq.com>
	
	Edge Theme
	https://demos.creative-tim.com/edge-dashboard/index.html 

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

<%
    local sys  = require "luci.sys"
	local util = require "luci.util"
	local http = require "luci.http"
	local disp = require "luci.dispatcher"

	local boardinfo = util.ubus("system", "board")

	local node = disp.context.dispatched
    
    local fs	= require "nixio.fs"
	local nutil = require "nixio.util"
    
    
    
	-- send as HTML5
	http.prepare_content("text/html")
    
    math.randomseed(os.time())
    

-%>
<!DOCTYPE html>
<html lang="<%=luci.i18n.context.lang%>">

<head>
	<meta charset="utf-8">
	<title>
		<%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %>
		- LuCI</title>
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="theme-color" content="#09c">
	<meta name="msapplication-tap-highlight" content="no">
	<meta name="msapplication-TileColor" content="#09c">
	<meta name="application-name" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI">
	<meta name="apple-mobile-web-app-title" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI">
	<meta name="msapplication-TileImage" content="<%=media%>/logo.png" />
	<link rel="icon" href="<%=media%>/logo.png" sizes="144x144">
	<link rel="apple-touch-icon-precomposed" href="<%=media%>/logo.png" sizes="144x144">
	<link rel="stylesheet" href="<%=media%>/landscape.css">
	<link rel="stylesheet" href="<%=media%>/waves.css">
	<link rel="stylesheet" href="<%=media%>/cascade.css">
	<link rel="shortcut icon" href="<%=media%>/favicon.ico">
	<% if node and node.css then %>
	<link rel="stylesheet" href="<%=resource%>/<%=node.css%>">
	<% end -%>
	<% if css then %>
	<style title="text/css">
		<%=css %>
	</style>
	<% end -%>
	<script src="<%=url('admin/translations', luci.i18n.context.lang)%>"></script>
	<script src="<%=resource%>/cbi.js"></script>
	<script src="<%=resource%>/luci.js"></script>
	<script src="<%=media%>/js/jquery.min.js"></script>
	<script type="text/javascript">//<![CDATA[
		(function () {
			function get_children(node) {
				var children = [];

				for (var k in node.children) {
					if (!node.children.hasOwnProperty(k))
						continue;

					if (!node.children[k].satisfied)
						continue;

					if (!node.children[k].hasOwnProperty('title'))
						continue;

					children.push(Object.assign(node.children[k], { name: k }));
				}

				return children.sort(function (a, b) {
					return ((a.order || 1000) - (b.order || 1000));
				});
			}

		document.addEventListener('luci-loaded', function (ev) {
			var tree = <%= luci.http.write_json(luci.dispatcher.menu_json() or { }) %>,
			node = tree,
			url = '';

		if (L.env.dispatchpath.length >= 3) {
			for (var i = 0; i < 3 && node; i++) {
				node = node.children[L.env.dispatchpath[i]];
				url = url + (url ? '/' : '') + L.env.dispatchpath[i];
			}

		}
		});
		}) ();
	//]]></script>
</head>

<body
	class="lang_<%=luci.i18n.context.lang%> <% if node then %><%= striptags( node.title ) %><% end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>"
	data-page="<%= table.concat(disp.context.requestpath, "-") %>">

<p class="chromeframe">您使用的浏览器过于老旧,
请使用<a href="https://www.microsoft.com/zh-cn/edge"> Edge </a>, <a href="https://www.mozilla.org/zh-CN/firefox/new/"> Firefox </a>等高级浏览器.</a></p>
