1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebIF 2.0</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<header><big>🛠️ WebIF 2.0</big></header>
<main>
<nav>
<label for="showmenu"><big>≡ Меню</big></label>
<input type="checkbox" id="showmenu" />
<a class="active" href="#">Данни</a>
<a href="#/network">Мрежа</a>
<a href="#/config">Настройки</a>
<a href="#/tools">Инструменти</a>
<a href="#/waiting">Пуйчи</a>
</nav>
<section id="app">
<div class="grid center middle">
<div>
<div class="loadspin"></div>
<p>Зарежда...</p>
</div>
</div>
</section>
</main>
</div>
<script src="ka.js"></script>
<script>
const waiting = app.children[0];
const routes = {
"/": () => div(
h2("Lorem Ipsum"),
p("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "),
p("Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."),
h2("Ipsum Lorem"),
p("Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."),
p("Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."),
p("Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."),
p("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "),
),
//"/network": () => div(),
//"/config": () => div(),
"/waiting": () => waiting,
"": () => div(
h1("Несъществуваща страница"),
p("Страницата не е намерена.")
),
};
const onchange = () => {
doc.querySelectorAll('nav a').forEach(x => x.setAttribute('class',(location.href===x.href)?"active":""));
};
router(app, routes, onchange);
</script>
</body>
</html>
|