-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
117 lines (107 loc) · 4.22 KB
/
index.html
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE HTML>
<html>
<head>
<title>Home Page</title>
<link rel="manifest" href="manifest.json">
<link rel="icon" href="icon.png">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="app-title" content="Sample App Title">
<script type="text/javascript" src="matrixtext.js"></script>
<style>
@font-face {
font-family: 'MatrixCode';
src: url("matrix code nfi.otf") format("opentype");
}
html,
body {
background: #000;
margin: 0;
padding: 0;
overflow-x: hidden;
overflow-y: hidden;
}
canvas {
font-family: 'MatrixCode';
}
p {
font-family: 'MatrixCode';
color: #fff;
}
</style>
<script>
// This is the "Offline page" service worker
// Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
// Check compatibility for the browser we're running this in
if ("serviceWorker" in navigator) {
if (navigator.serviceWorker.controller) {
console.log("[PWA Builder] active service worker found, no need to register");
} else {
// Register the service worker
navigator.serviceWorker
.register("pwabuilder-sw.js", {
scope: "./"
})
.then(function (reg) {
console.log("[PWA Builder] Service worker has been registered for scope: " + reg.scope);
});
}
}
</script>
</head>
<body onload="init();">
<p id="params"></p>
<div>
<a href="sample.html">Image test page</a>
<a href="test.html">Test page</a>
<a href="offline.html" target="_blank">Offline page</a>
<button id="install_button">Install</button>
</div>
<canvas id="theMatrix" width="1280" height="800">
<p>Your browser doesn't support canvas.</p>
<p>Source: https://github.com/syropian/HTML5-Matrix-Code-Rain</p>
</canvas>
<script>
// mailto://[email protected]&subject=Message Title&body=file:///C:/Users/TDPUser/Pictures/Camera Roll/2222.jpg
var mailto = 'mailto%3A';
if (document.URL.indexOf(mailto) > 0) {
// var mailto_str = document.URL.substring(document.URL.indexOf(mailto)+mailto.length);
// const params = new URLSearchParams(mailto_str);
// var params_str = "Params found on page: EMAIL = " + params.get('email') + " SUBJECT = " + params.get('subject') + " BODY = " + params.get('body');
var pairs = document.URL.split('?')
.pop()
.split('&');
var params_str = "Params found on page: ";
for (var i = 0, p; i < pairs.length; i++) {
params_str += pairs[i] + "; ";
}
document.getElementById('params').innerText = params_str;
}
let deferredPrompt;
const btnAdd = document.getElementById('install_button');
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
// Update UI notify the user they can add to home screen
btnAdd.style.display = 'block';
});
btnAdd.addEventListener('click', (e) => {
// hide our user interface that shows our A2HS button
btnAdd.style.display = 'none';
// Show the prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
deferredPrompt.userChoice
.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
console.log('User accepted the A2HS prompt');
} else {
console.log('User dismissed the A2HS prompt');
}
deferredPrompt = null;
});
});
</script>
</body>
</html>