...
 
Commits (2)
......@@ -15,8 +15,6 @@
}
</style>
<script>
var RDAP_MEDIA_TYPE = 'application/rdap+json';
// keeps track of the elements we've created so we can assign a unique ID
var elementCounter = 123456;
......@@ -139,8 +137,6 @@
xhr.timeout = 25000;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', RDAP_MEDIA_TYPE);
xhr.ontimeout = function() {
document.getElementById('type').disabled = false;
document.getElementById('object').disabled = false;
......@@ -239,13 +235,27 @@
var card = document.createElement('div');
card.classList.add('card');
var body = document.createElement('div');
body.classList.add('card-body');
var titleText = cardTitles[object.objectClassName];
if (object.unicodeName) {
titleText += ' ' + object.unicodeName.toUpperCase();
} else if (object.ldhName) {
titleText += ' ' + object.ldhName.toUpperCase();
} else if (object.handle) {
titleText += ' ' + object.handle.toUpperCase();
}
if (object.handle) titleText += ' (' + object.handle + ')';
var title = document.createElement('div');
title.classList.add('card-header', 'font-weight-bold');
title.appendChild(document.createTextNode(cardTitles[object.objectClassName] + (object.handle ? ' ' + object.handle : '')));
card .appendChild(title);
title.appendChild(document.createTextNode(titleText));
card.appendChild(title);
var body = document.createElement('div');
body.classList.add('card-body');
body.appendChild(dl);
......@@ -365,12 +375,12 @@
var title = (links[i].title ? links[i].title : links[i].href);
var link;
if (links[i].type && 0 == links[i].type.indexOf(RDAP_MEDIA_TYPE)) {
if (links[i].type && 0 == links[i].type.indexOf('application/rdap+json')) {
link = createRDAPLink(links[i].href, title);
} else {
link = document.createElement('a');
link.rel = 'noopener';
link.rel = 'noopener';
link.title = link.href = links[i].href;
link.target = '_new';
link.appendChild(document.createTextNode(title));
......@@ -412,32 +422,30 @@
var div = document.createElement('div');
for (var i = 0 ; i < things.length ; i++) {
var tdiv = document.createElement('div');
var section = document.createElement('section');
section.classList.add('card');
div.appendChild(section);
var title = document.createElement('strong');
var title = document.createElement('header');
title.classList.add('card-header', 'font-weight-bold');
title.appendChild(document.createTextNode(things[i].title));
tdiv.appendChild(title);
tdiv.appendChild(document.createElement('br'));
tdiv.appendChild(document.createElement('br'));
if (things[i].description) {
var body = document.createElement('div');
for (var j = 0 ; j < things[i].description.length ; j++) {
body.appendChild(document.createTextNode(things[i].description[j]));
body.appendChild(document.createElement('br'));
}
tdiv.appendChild(body);
section.appendChild(title);
var body = document.createElement('div');
body.classList.add('card-body');
section.appendChild(body);
if (things[i].description) for (var j = 0 ; j < things[i].description.length ; j++) {
var p = document.createElement('p');
p.appendChild(document.createTextNode(things[i].description[j]));
body.appendChild(p);
}
if (things[i].links) {
var ldl = document.createElement('dl');
processLinks(things[i].links, ldl);
tdiv.appendChild(ldl);
body.appendChild(ldl);
}
tdiv.appendChild(document.createElement('br'));
div.appendChild(tdiv);
}
return div;
......