This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
49 lines (42 loc) · 1.43 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function verify () {
if (window.ipfs) return true
var a = document.createElement('a')
a.href = 'https://github.com/ipfs-shipyard/ipfs-companion#install'
a.target = '_blank'
a.style.textDecoration = 'none'
a.style.color = 'white'
a.style.lineHeight = 1.4
a.style.fontFamily = 'sans-serif'
a.style.boxShadow = '0 1px 3px rgba(11, 58, 83, 0.3)'
a.style.display = 'flex'
a.style.boxSizing = 'border-box'
a.style.alignItems = 'center'
a.style.padding = '1rem'
a.style.width = '100%'
a.style.background = '#0b3a53'
a.style.position = 'fixed'
a.style.top = 0
a.style.left = 0
a.innerHTML = `<span>It seems that this application requires IPFS Companion to be installed. Click <span style='text-decoration: underline'>here</span> to install it!</span>`
var close = document.createElement('span')
close.style.border = '1px solid rgba(255, 255, 255, 0.3)'
close.style.padding = '0.3rem'
close.style.borderRadius = '2px'
close.style.color = 'rgba(255, 255, 255, 0.8)'
close.style.fontSize = '0.8rem'
close.style.marginLeft = 'auto'
close.innerText = 'Close'
close.addEventListener('click', (event) => {
event.preventDefault()
event.stopPropagation()
document.body.removeChild(a)
})
a.appendChild(close)
document.body.appendChild(a)
return false
}
if (typeof exports !== 'undefined') {
module.exports = verify
} else {
document.addEventListener('DOMContentLoaded', () => { verify() })
}