X-Git-Url: https://git.rvb.name/esp-clock.git/blobdiff_plain/dab14a20e37e760a82b72f50f765caa26fff556e..e1b7c70070cda97937a405a2c9e48d190b4391ef:/data/web/script.js?ds=sidebyside diff --git a/data/web/script.js b/data/web/script.js index 025339e..67c213f 100644 --- a/data/web/script.js +++ b/data/web/script.js @@ -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 = '

Контакты

' + for (const contact of contacts) { + const url = new URL(contact) + var ref + console.log(url) + switch (url.protocol) { + case 'http': + case 'https:': + ref = '⌂ '+url.hostname + break + case 'mailto:': + ref = '✉ '+url.pathname + break + default: + ref = '🖅 '+url.pathname + } + contact_list += ''+ref+'' + } + 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)