diff --git a/out/static/lookup-domain.js b/out/static/lookup-domain.js index c0a4d6c..1a1bbe6 100644 --- a/out/static/lookup-domain.js +++ b/out/static/lookup-domain.js @@ -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 = '' + sub + '. '; + src += lnk; + } + dom_sub_doms.innerHTML = src; + } else { + dom_sub_doms.innerHTML = '– None –'; + } + }); }); }); } \ No newline at end of file diff --git a/src/html_index_domains.py b/src/html_index_domains.py index d947035..9625951 100755 --- a/src/html_index_domains.py +++ b/src/html_index_domains.py @@ -89,24 +89,23 @@ def gen_html_trinity(idx_dir, app_count, json, title, symlink): mylib.symlink(symlink, mylib.path_out(idx_dir, 'data.json')) -def gen_lookup(html_dir, doms_dict, names_dict, title): - header = HTML.a_path([('All Domains', '/index/domains/all/')], - '') - HTML.write(html_dir, ''' -
Known Tracker: ?
Present in: … applications
+{ '