-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
34 lines (31 loc) · 1.32 KB
/
main.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
document.getElementById("share-button").addEventListener("click", toggleQRCode);
document.getElementById("modal-button").addEventListener("click", hideModal);
function toggleQRCode() {
if (document.getElementById("profile-pic").style.display === "none") {
document.getElementById("profile-pic").style.display = "block";
document.getElementById("qr-code").style.display = "none";
} else {
document.getElementById("profile-pic").style.display = "none";
document.getElementById("qr-code").style.display = "block";
}
}
window.onload = function() {
console.log(document.referrer)
console.log(navigator.platform.toLowerCase())
console.log(!window.navigator.standalone)
if (document.referrer === "https://github.com/andylamgot/digital-namecard/" || document.referrer === "https://github.com/andylamgot/digital-namecard"){
console.log('true1')
if (navigator.platform.toLowerCase() === "iphone" || navigator.platform.toLowerCase() === "ipad") {
console.log('true2')
if (!window.navigator.standalone) {
console.log('true3')
document.getElementById("opaque-background").style.display = "block";
document.getElementById("modal").style.display = "block";
}
}
}
};
function hideModal() {
document.getElementById("opaque-background").style.display = "none";
document.getElementById("modal").style.display = "none";
}