Parent domain incl subdomains
This commit is contained in:
@@ -1,22 +1,30 @@
|
||||
function lookup_domain_js(fname_a, fname_b, id1, id2, id3) {
|
||||
let dom = window.location.hash.substr(1);
|
||||
document.getElementById(id1).innerHTML = dom; // domain name
|
||||
let dom_app_list = document.getElementById(id3); // apps list
|
||||
function lookup_domain_js(fname_doms, fname_apps, fname_subs) {
|
||||
let dom = window.location.hash.substr(1); // domain name
|
||||
document.getElementById('name').innerHTML = dom;
|
||||
let dom_num_apps = document.getElementById('num-apps');
|
||||
let dom_app_list = document.getElementById('app-toc');
|
||||
let dom_sub_doms = document.getElementById('subdoms');
|
||||
let dom_known_trkr = document.getElementById('known');
|
||||
let template = dom_app_list.firstElementChild;
|
||||
dom_app_list.innerHTML = 'loading…';
|
||||
|
||||
// load reverse domains json
|
||||
loadJSON(fname_a, function(response) {
|
||||
loadJSON(fname_doms, function(response) {
|
||||
let elem = JSON.parse(response)[dom];
|
||||
if (!elem || elem.length == 0) {
|
||||
document.getElementById(id2).innerHTML = '0 applications';
|
||||
let count = elem.length - 1;
|
||||
if (!elem || count < 1) {
|
||||
dom_num_apps.innerHTML = '0 applications';
|
||||
dom_app_list.innerHTML = '– None –';
|
||||
return;
|
||||
} else if (count == 1) {
|
||||
dom_num_apps.innerHTML = '1 application';
|
||||
} else {
|
||||
dom_num_apps.innerHTML = elem.length - 1 + ' applications';
|
||||
}
|
||||
document.getElementById(id2).innerHTML = elem.length + ' applications';
|
||||
dom_known_trkr.innerHTML = elem[0] ? 'Yes' : 'No';
|
||||
|
||||
// load app name json
|
||||
loadJSON(fname_b, function(response) {
|
||||
loadJSON(fname_apps, function(response) {
|
||||
let name_list = JSON.parse(response);
|
||||
var apps = [];
|
||||
for (var i = elem.length - 1; i >= 0; i--) {
|
||||
@@ -39,6 +47,23 @@ function lookup_domain_js(fname_a, fname_b, id1, id2, id3) {
|
||||
dom_app_list.appendChild(item);
|
||||
}
|
||||
const observer = lozad(); observer.observe();
|
||||
|
||||
if (!dom_sub_doms) { return }
|
||||
loadJSON(fname_subs, function(response) {
|
||||
let subdomains_list = JSON.parse(response)[dom];
|
||||
if (subdomains_list) {
|
||||
var src = '';
|
||||
for (var i = 0; i < subdomains_list.length; i++) {
|
||||
let sub = subdomains_list[i];
|
||||
let full = sub ? sub + '.' + dom : dom;
|
||||
let lnk = '<a href="/subdomain/#' + full + '">' + sub + '.</a> ';
|
||||
src += lnk;
|
||||
}
|
||||
dom_sub_doms.innerHTML = src;
|
||||
} else {
|
||||
dom_sub_doms.innerHTML = '– None –';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user