0
0

👽 adapt to ui changes

This commit is contained in:
thetek 2021-04-04 15:32:23 +02:00
parent 8b1d05bb73
commit b1ba9d9026

View File

@ -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 = '<table>\n';
//// reference dns
// status
table += '<tr>\n';
table += '<td class="status ref">\n';
table += `<i data-feather="${ response["data"]["reference"]["found"] ? "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 += '</td>\n'
// name and address
table += `<td class="name">${ response["data"]["reference"]["name"] }<small>${ response["data"]["reference"]["address"] }</small></td>\n`;
// reference info
table += '<td class="desc ref">reference</td>\n';
// help button
table += '<td class="help">\n';
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
//// reference dns
response['data']['reference'].forEach(i => {
// status
table += '<tr>\n';
table += '<td class="status ref">\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="${ i["icon"] }">\n`;
table += '</td>\n'
// name and address
table += `<td class="name">${ i["name"] }<small>${ i["address"] }</small></td>\n`;
// reference info
table += '<td class="desc ref">reference</td>\n';
// help button
table += '<td class="help">\n';
table += '<button><i data-feather="help-circle"></i></button>\n';
table += '</td>\n';
table += '</tr>\n'
});
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`;