From d06a6d93350602ec0fe14210e142fb20f75dd781 Mon Sep 17 00:00:00 2001 From: thetek <80534748+thetek42@users.noreply.github.com> Date: Sun, 4 Apr 2021 15:39:32 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BD=20adapt=20to=20api=20changes=20(#7?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✏️ fix typo * 👽 adapt to ui changes * 📦 compile html * 📦 compile jhtml --- ui/html/index.html | 2 +- ui/html/index.js | 51 ++++++++++++++++++++------------------- ui/jhtml-compat/index.js | 51 ++++++++++++++++++++------------------- ui/jhtml-compat/index.php | 2 +- ui/raw/index.js | 51 ++++++++++++++++++++------------------- ui/raw/index.pug | 2 +- 6 files changed, 81 insertions(+), 78 deletions(-) diff --git a/ui/html/index.html b/ui/html/index.html index b789f1c..a2b496c 100644 --- a/ui/html/index.html +++ b/ui/html/index.html @@ -6,4 +6,4 @@ -

dns-watch.org

+

dns-watch.org

diff --git a/ui/html/index.js b/ui/html/index.js index 26cf36d..c4d709c 100644 --- a/ui/html/index.js +++ b/ui/html/index.js @@ -26,46 +26,47 @@ function dnswatch_search() { request.onload = function() { if (request.status >= 200 && request.status < 400) { var response = JSON.parse(this.response); - //console.log(response); // TODO: CLEAN UP THIS MESS OF TABLE GENERATION CODE if (response['type'] == 'success') { // success var table = '\n'; - //// reference dns - // status - table += '\n'; - table += '\n'; - // provider - table += '\n' - // name and address - table += `\n`; - // reference info - table += '\n'; - // help button - table += '\n'; - table += '\n' - if (response['data']['reference']['found']) { // only if reference confirms + //// reference dns + response['data']['reference'].forEach(i => { + // status + table += '\n'; + table += '\n'; + // provider + table += '\n' + // name and address + table += `\n`; + // reference info + table += '\n'; + // help button + table += '\n'; + table += '\n' + }); + + if (response['data']['found']) { // only if reference confirms table += '\n'; // spacer //// search rows response['data']['search'].forEach(i => { - //console.log(i); table += '\n'; // status - table += `\n'; // provider icon table += '\n'; // name and address table += `\n`; diff --git a/ui/jhtml-compat/index.js b/ui/jhtml-compat/index.js index 30e2e8c..fafaaeb 100644 --- a/ui/jhtml-compat/index.js +++ b/ui/jhtml-compat/index.js @@ -27,46 +27,47 @@ function dnswatch_search() { request.onload = function() { if (request.status >= 200 && request.status < 400) { var response = JSON.parse(this.response); - //console.log(response); // TODO: CLEAN UP THIS MESS OF TABLE GENERATION CODE if (response['type'] == 'success') { // success var table = '
\n'; - table += `\n`; - table += '\n'; - table += `\n`; - table += '${ response["data"]["reference"]["name"] }${ response["data"]["reference"]["address"] }reference\n'; - table += '\n'; - table += '
\n'; + table += `\n`; + table += '\n'; + table += `\n`; + table += '${ i["name"] }${ i["address"] }reference\n'; + table += '\n'; + table += '
\n`; - table += `\n`; + table += `\n`; + table += `\n`; table += '\n'; - table += `\n`; + table += `\n`; table += '${ i["name"] }${ i["address"] }
\n'; - //// reference dns - // status - table += '\n'; - table += '\n'; - // provider - table += '\n' - // name and address - table += `\n`; - // reference info - table += '\n'; - // help button - table += '\n'; - table += '\n' - if (response['data']['reference']['found']) { // only if reference confirms + //// reference dns + response['data']['reference'].forEach(i => { + // status + table += '\n'; + table += '\n'; + // provider + table += '\n' + // name and address + table += `\n`; + // reference info + table += '\n'; + // help button + table += '\n'; + table += '\n' + }); + + if (response['data']['found']) { // only if reference confirms table += '\n'; // spacer //// search rows response['data']['search'].forEach(i => { - //console.log(i); table += '\n'; // status - table += `\n'; // provider icon table += '\n'; // name and address table += `\n`; diff --git a/ui/jhtml-compat/index.php b/ui/jhtml-compat/index.php index 127306e..161b38c 100644 --- a/ui/jhtml-compat/index.php +++ b/ui/jhtml-compat/index.php @@ -5,4 +5,4 @@ *js("///index.js") *js("https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js") *postjs("///feather.js") -

dns-watch.org

\ No newline at end of file +

dns-watch.org

\ No newline at end of file diff --git a/ui/raw/index.js b/ui/raw/index.js index 26cf36d..c4d709c 100644 --- a/ui/raw/index.js +++ b/ui/raw/index.js @@ -26,46 +26,47 @@ function dnswatch_search() { request.onload = function() { if (request.status >= 200 && request.status < 400) { var response = JSON.parse(this.response); - //console.log(response); // TODO: CLEAN UP THIS MESS OF TABLE GENERATION CODE if (response['type'] == 'success') { // success var table = '
\n'; - table += `\n`; - table += '\n'; - table += `\n`; - table += '${ response["data"]["reference"]["name"] }${ response["data"]["reference"]["address"] }reference\n'; - table += '\n'; - table += '
\n'; + table += `\n`; + table += '\n'; + table += `\n`; + table += '${ i["name"] }${ i["address"] }reference\n'; + table += '\n'; + table += '
\n`; - table += `\n`; + table += `\n`; + table += `\n`; table += '\n'; - table += `\n`; + table += `\n`; table += '${ i["name"] }${ i["address"] }
\n'; - //// reference dns - // status - table += '\n'; - table += '\n'; - // provider - table += '\n' - // name and address - table += `\n`; - // reference info - table += '\n'; - // help button - table += '\n'; - table += '\n' - if (response['data']['reference']['found']) { // only if reference confirms + //// reference dns + response['data']['reference'].forEach(i => { + // status + table += '\n'; + table += '\n'; + // provider + table += '\n' + // name and address + table += `\n`; + // reference info + table += '\n'; + // help button + table += '\n'; + table += '\n' + }); + + if (response['data']['found']) { // only if reference confirms table += '\n'; // spacer //// search rows response['data']['search'].forEach(i => { - //console.log(i); table += '\n'; // status - table += `\n'; // provider icon table += '\n'; // name and address table += `\n`; diff --git a/ui/raw/index.pug b/ui/raw/index.pug index 10440e5..8e1c1ec 100644 --- a/ui/raw/index.pug +++ b/ui/raw/index.pug @@ -11,7 +11,7 @@ input#dnswatch-search( type='text' placeholder='Search...' autofocus ) button#dnswatch-search-submit: i( data-feather='search' ) button#help: i( data-feather='help-circle' ) - small Try "gnu.org", "wikipedia.com", "s.to" or your own website! + small Try "gnu.org", "wikipedia.org", "s.to" or your own website! #loadani #spinner span loading...
\n'; - table += `\n`; - table += '\n'; - table += `\n`; - table += '${ response["data"]["reference"]["name"] }${ response["data"]["reference"]["address"] }reference\n'; - table += '\n'; - table += '
\n'; + table += `\n`; + table += '\n'; + table += `\n`; + table += '${ i["name"] }${ i["address"] }reference\n'; + table += '\n'; + table += '
\n`; - table += `\n`; + table += `\n`; + table += `\n`; table += '\n'; - table += `\n`; + table += `\n`; table += '${ i["name"] }${ i["address"] }