From cefb1eb87f7fb5d88182cf76f1094a1888080f28 Mon Sep 17 00:00:00 2001 From: Revertron Date: Wed, 28 Apr 2021 13:07:13 +0200 Subject: [PATCH] Rewised domains interface a lot. --- Cargo.toml | 2 +- src/webview/index.html | 106 ++++++++++++++++++++++------------------- src/webview/scripts.js | 16 +++++-- src/webview/styles.css | 22 +++++++++ 4 files changed, 93 insertions(+), 53 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7c35d92..09aa8b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alfis" -version = "0.4.32" +version = "0.4.33" authors = ["Revertron "] edition = "2018" build = "build.rs" diff --git a/src/webview/index.html b/src/webview/index.html index 3aa34c0..129fc77 100644 --- a/src/webview/index.html +++ b/src/webview/index.html @@ -75,55 +75,11 @@ - + + diff --git a/src/webview/scripts.js b/src/webview/scripts.js index 3dbc391..e5eb60b 100644 --- a/src/webview/scripts.js +++ b/src/webview/scripts.js @@ -107,15 +107,13 @@ function addMyDomain(name, timestamp, data) { } function refreshMyDomains() { - var edit_icon = ''; - var card = '

{title}

{tags}{edit}
'; + var card = '

{title}

{tags}
'; var tag = '{domain}'; var cards = ""; myDomains.forEach(function(value, index, array) { var title = value.name; var domain_data = JSON.parse(value.data); var tags = ""; - var edit = edit_icon.replace("{domain}", title); domain_data.records.forEach(function(v, i, a) { if (typeof v.domain !== 'undefined') { var buf = tag.replace("{domain}", v.domain); @@ -127,7 +125,7 @@ function refreshMyDomains() { tags = tags + buf; } }); - cards = cards + card.replace("{title}", title).replace("{tags}", tags).replace("{edit}", edit); + cards = cards + card.replace("{title}", title).replace("{domain}", title).replace("{tags}", tags); }); document.getElementById("my_domains").innerHTML = cards; } @@ -146,6 +144,7 @@ function editDomain(domain) { document.getElementById("new_domain").value = title.replace("." + domain_data.zone, ""); changeZone(domain_data.zone); refreshRecordsList(); + showNewDomainDialog(); }); } @@ -214,6 +213,14 @@ function recordOkay(okay) { } } +function showNewDomainDialog() { + document.getElementById("new_domain_dialog").className = "modal is-active"; +} + +function closeDialog(name) { + document.getElementById(name).className = "modal"; +} + function createDomain() { if (typeof currentZone == 'undefined') { showWarning("Select a domain zone first"); @@ -234,6 +241,7 @@ function createDomain() { function domainMiningStarted() { //recordsBuffer = []; //refreshRecordsList(); + document.getElementById("new_domain_dialog").className = "modal"; document.getElementById("tab_domains").disabled = true; document.getElementById("domain_records").disabled = true; document.getElementById("add_record_button").disabled = true; diff --git a/src/webview/styles.css b/src/webview/styles.css index c6bb606..a0dbf09 100644 --- a/src/webview/styles.css +++ b/src/webview/styles.css @@ -42,6 +42,28 @@ body { /* ========================================== */ +@media screen and (min-width: 769px) { + .modal-content, + .modal-card { + width: 100%; + max-width: calc(100vw - 60px); + } +} + +.modal-background { + background-color: rgba(10, 10, 10, 0.76); +} + +#new_domain_dialog_box { + min-height: 380px; +} + +.delete { + position: absolute; + top: 1.0rem; + right: 1.25rem; +} + .container { margin: 10pt; }