👽 adapt to api changes #7
2
ui/html/index.html
vendored
2
ui/html/index.html
vendored
@ -6,4 +6,4 @@
|
||||
<meta content="utf-8" http-equiv="encoding">
|
||||
<script src="index.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
||||
<div id="header"><button><i data-feather="globe"></i></button><button><i data-feather="sun"></i></button></div><div id="title"><h1>dns-watch<span>.org</span></h1></div><div id="search"><div id="searchbar"><div class="buttonspacer"></div><input id="dnswatch-search" type="text" placeholder="Search..." autofocus="autofocus"/><button id="dnswatch-search-submit"><i data-feather="search"></i></button><button id="help"><i data-feather="help-circle"></i></button></div><small>Try "gnu.org", "wikipedia.com", "s.to" or your own website!</small><div id="loadani"><div id="spinner"></div><span>loading...</span></div><div id="invaliddomain"><i data-feather="x"></i><span>invalid domain.</span></div></div><div id="results"></div><script src="feather.js"></script>
|
||||
<div id="header"><button><i data-feather="globe"></i></button><button><i data-feather="sun"></i></button></div><div id="title"><h1>dns-watch<span>.org</span></h1></div><div id="search"><div id="searchbar"><div class="buttonspacer"></div><input id="dnswatch-search" type="text" placeholder="Search..." autofocus="autofocus"/><button id="dnswatch-search-submit"><i data-feather="search"></i></button><button id="help"><i data-feather="help-circle"></i></button></div><small>Try "gnu.org", "wikipedia.org", "s.to" or your own website!</small><div id="loadani"><div id="spinner"></div><span>loading...</span></div><div id="invaliddomain"><i data-feather="x"></i><span>invalid domain.</span></div></div><div id="results"></div><script src="feather.js"></script>
|
||||
|
19
ui/html/index.js
vendored
19
ui/html/index.js
vendored
@ -26,25 +26,26 @@ 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 = '<table>\n';
|
||||
|
||||
//// reference dns
|
||||
response['data']['reference'].forEach(i => {
|
||||
// status
|
||||
table += '<tr>\n';
|
||||
table += '<td class="status ref">\n';
|
||||
table += `<i data-feather="${ response["data"]["reference"]["found"] ? "check" : "x" }"></i>\n`;
|
||||
table += `<i data-feather="${ i["status"] ? "check" : "x" }"></i>\n`;
|
||||
table += '</td>\n';
|
||||
// provider
|
||||
table += '<td class="icon">\n';
|
||||
table += `<img class="uncolored-svg" src="../svg/${ response["data"]["reference"]["nameserver"] }.svg">\n`;
|
||||
table += `<img class="uncolored-svg" src="${ i["icon"] }">\n`;
|
||||
table += '</td>\n'
|
||||
// name and address
|
||||
table += `<td class="name">${ response["data"]["reference"]["name"] }<small>${ response["data"]["reference"]["address"] }</small></td>\n`;
|
||||
table += `<td class="name">${ i["name"] }<small>${ i["address"] }</small></td>\n`;
|
||||
// reference info
|
||||
table += '<td class="desc ref">reference</td>\n';
|
||||
// help button
|
||||
@ -52,20 +53,20 @@ function dnswatch_search() {
|
||||
table += '<button><i data-feather="help-circle"></i></button>\n';
|
||||
table += '</td>\n';
|
||||
table += '</tr>\n'
|
||||
});
|
||||
|
||||
if (response['data']['reference']['found']) { // only if reference confirms
|
||||
if (response['data']['found']) { // only if reference confirms
|
||||
table += '<tr></tr>\n'; // spacer
|
||||
//// search rows
|
||||
response['data']['search'].forEach(i => {
|
||||
//console.log(i);
|
||||
table += '<tr>\n';
|
||||
// status
|
||||
table += `<td class="status ${ i["matching"] ? "check" : "cross" }">\n`;
|
||||
table += `<i data-feather="${ i["matching"] ? "check" : "x" }"></i>\n`;
|
||||
table += `<td class="status ${ i["status"] ? "check" : "cross" }">\n`;
|
||||
table += `<i data-feather="${ i["status"] ? "check" : "x" }"></i>\n`;
|
||||
table += '</td>\n';
|
||||
// provider icon
|
||||
table += '<td class="icon">\n';
|
||||
table += `<img class="uncolored-svg" src="../svg/${ i["nameserver"] }.svg">\n`;
|
||||
table += `<img class="uncolored-svg" src="${ i["icon"] }">\n`;
|
||||
table += '</td>\n';
|
||||
// name and address
|
||||
table += `<td class="name">${ i["name"] }<small>${ i["address"] }</small></td>\n`;
|
||||
|
Reference in New Issue
Block a user