Контакты в веб-интерфейсе
authorRoman Bazalevskiy <rvb@rvb.name>
Thu, 17 Nov 2022 07:36:41 +0000 (10:36 +0300)
committerRoman Bazalevskiy <rvb@rvb.name>
Thu, 17 Nov 2022 07:36:41 +0000 (10:36 +0300)
data/web/index.html
data/web/script.js
data/web/style.css
ui.yml

index a464c920a7cde6b44b290c9cf0bdcc1d5839d904..2170b0810be2d94b3cd5269a3c96a0de3f2a37b6 100644 (file)
@@ -24,6 +24,8 @@
             <ul id="_ui_menu_list" class="pure-menu-list">
             </ul>
         </div>
+        <footer id="_ui_contacts">
+        </footer>
     </div>
 
     <div id="main">
index 025339e5251315647bbf54428e85f2855360ad04..67c213ffc792a5bd1f39884038100372e3414c53 100644 (file)
@@ -359,10 +359,10 @@ function DrawPage(id) {
   var page_content = document.getElementById("_ui_page_content");
   var content = ''
   for (const element of pages[idx].elements) {
-    content = content + ElementHTML(element)
+    content = content + ElementHTML(element) + '\n'
   }
   page_content.innerHTML = content
-  window.location.hash = '#'+id
+  window.location.hash = id
 }
 
 function DrawNavigator(project, pages) {
@@ -376,10 +376,35 @@ function DrawNavigator(project, pages) {
   menu.innerHTML = list
 }
 
+function DrawContacts(contacts) {
+  if (!contacts) return;
+  var contact_list = '<hr><h4 class="pure-u1">Контакты</h4>'
+  for (const contact of contacts) {
+    const url = new URL(contact)
+    var ref
+    console.log(url)
+    switch (url.protocol) {
+      case 'http':
+      case 'https:':
+        ref = '&#8962; '+url.hostname
+        break
+      case 'mailto:':
+        ref = '&#9993; '+url.pathname
+        break
+      default:
+        ref = '&#128389; '+url.pathname
+    }
+    contact_list += '<a href="'+contact+'">'+ref+'</a>'
+  }
+  var footer = document.getElementById('_ui_contacts');
+  footer.innerHTML = contact_list
+}
+
 function DrawUI(ui) {
   DrawHeader(ui.project)
   pages = ui.pages
   DrawNavigator(ui.project, pages)
+  DrawContacts(ui.project.contacts)
   var anchor = getAnchor()
   if (anchor) {
     DrawPage(anchor)
index c83b6842c619fcd41bed2f951b17a616f93f550c..2cbe74b96b118dfb8d11207b652c7e58a7b37194 100644 (file)
@@ -1237,7 +1237,14 @@ input[type=range]:focus::-ms-fill-upper {
  display:none
 }
 footer {
- text-align:center
+ text-align:center;
+ position: absolute;
+ bottom: 1rem;
+ width: 100%
+}
+footer a {
+ display: inline-block;
+ text-decoration: none
 }
 .notification {
   float: right;
diff --git a/ui.yml b/ui.yml
index 090fa56c7b8537f8208fc8fedaa29df8a3f73388..a07d6fc621d4c36c68896edfc1d50154024ba131 100644 (file)
--- a/ui.yml
+++ b/ui.yml
@@ -2,9 +2,10 @@ project:
   name: WiFi Clock
   version: 0.1.1
   contacts:
-    email: rvb@rvb.name
-    tg: rvbglas
-    site: https://git.rvb.name
+    - mailto:rvb@rvb.name
+    - tg:rvbglas
+    - https://git.rvb.name
+    - xmpp:rvb@rvb.name
 pages:
   - id: main
     title: Главная
@@ -45,6 +46,8 @@ pages:
   - id: clock
     title: Часы
     elements:
+      - type: text
+        value: Внешний вид
       - id: panel_font
         label: Шрифт часов
         type: select
@@ -72,12 +75,13 @@ pages:
         type: checkbox
       - id: panel_speed
         label: Скорость        
-        type: number
+        type: range
         min: 1
         max: 20
         step: 1
       - type: hr
-      - type: hr
+      - type: text
+        value: Яркость
       - id: day_from
         label: Дневной режим с
         type: number
@@ -105,9 +109,11 @@ pages:
   - id: alarm
     title: Будильник
     elements:
+      - type: text
+        value: Будильник
       - id: enable_alarm
         type: checkbox
-        label: Включить будильник
+        label: Включить
       - id: alarm_hour
         label: Час
         type: number
@@ -146,9 +152,11 @@ pages:
         min: 100
         max: 2000
       - type: hr
+      - type: text
+        value: Сигнал каждый час
       - id: enable_hourly
         type: checkbox
-        label: Ð¡Ð¸Ð³Ð½Ð°Ð» ÐºÐ°Ð¶Ð´Ñ\8bй Ñ\87аÑ\81
+        label: Ð\92клÑ\8eÑ\87иÑ\82Ñ\8c
       - id: hourly_night
         label: В том числе ночью
         type: checkbox
@@ -273,7 +281,7 @@ pages:
           - value: 1
             text: "TX*"
       - id: button_inversed
-        label: "Кнопка на размыкание"
+        label: Кнопка на размыкание
         type: checkbox
       - type: hr
       - type: text
@@ -308,7 +316,7 @@ pages:
           - value: 1
             text: "TX*"
       - id: buzzer_passive
-        label: "Пассивный зуммер"
+        label: Пассивный зуммер
         type: checkbox
       - type: hr 
       - type: text