Adding link to online gateway (#42)

merge-requests/2/merge
Kcchouette 2019-03-03 03:31:03 +01:00 committed by Jamie Wilkinson
parent c5c5ab4f99
commit ab4267acfb
1 changed files with 6 additions and 1 deletions

7
app.js
View File

@ -3,12 +3,17 @@ const hashString = 'Hello from IPFS Gateway Checker'
const $results = document.querySelector('#results') const $results = document.querySelector('#results')
function returnHtmlLink (gateway) {
let gatewayTitle = gateway.split(hashToTest)[0]
return '<a title="' + gatewayTitle + '" href="' + gateway + '">' + gateway + '</a>'
}
function addNode (gateway, online, title) { function addNode (gateway, online, title) {
const para = document.createElement('div') const para = document.createElement('div')
let node let node
if (online) { if (online) {
node = document.createElement('strong') node = document.createElement('strong')
node.innerText = '✅ - Online - ' + gateway node.innerHTML = '✅ - Online - ' + returnHtmlLink(gateway)
} else { } else {
node = document.createElement('div') node = document.createElement('div')
node.innerText = '❌ - Offline - ' + gateway node.innerText = '❌ - Offline - ' + gateway