summaryrefslogtreecommitdiff
path: root/index.html
blob: 513d5ec58d80beb1885c4bb8da9aee899b2d437c (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!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"><span>☰</span> Меню</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>
                <noscript>Не</noscript>
                Зарежда...
                <noscript>JavaScript не е включен .</noscript>
              </p>
            </div>
        </div>
      </section>
    </main>
  </div>
  <script src="ka.js"></script>
  <script>
      const waiting = app.children[0];
      let isLoading = 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(
          isLoading ? waiting
          : table(
            tr(
              td("IP"),
              td(input("text").$value("127.0.0.1")),
            )
          ).$cls("network"),
        ),
        "/config": () => {
          isLoading = 1;
          setTimeout(() => {
            isLoading = 0;
            app.reload();
          }, 10000);
          return 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>