Repository navigation
Expand file tree
/
Copy path404.html
More file actions
55 lines (46 loc) · 1.97 KB
/
Copy path404.html
File metadata and controls
55 lines (46 loc) · 1.97 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Call To</title>
<link id="style" rel="stylesheet" href="/trigger-call-link/index.css">
</head>
<body class="p-8 text-center container mx-auto max-w-2xl">
<div id="valid" class="block">
<h1 class="uppercase text-gray-500">Number</h1>
<a id="number" href="#" class="block text-3xl text-purple-800 font-bold my-4"></a>
<a id="button" href="#" class="block text-2xl bg-purple-900 text-white py-5 font-bold my-10">Call Number</a>
</div>
<div id="invalid" class="hidden text-xl uppercase text-gray-500">
No number has been provided in the URL.
</div>
<script>
function numberOnly(string) {
return string.replace(/[^\+\d]/ig, '');
}
function renderCall() {
var query = window.location.search;
var path = window.location.pathname;
var number = numberOnly(query) || numberOnly(path) || null;
if (!number) {
document.getElementById('valid').classList.add('hidden');
document.getElementById('valid').classList.remove('block');
document.getElementById('invalid').classList.remove('hidden');
} else {
document.getElementById('number').innerText = number;
document.getElementById('number').setAttribute('href', "tel:" + number)
document.getElementById('button').setAttribute('href', "tel:" + number)
}
if ((query + path).indexOf('autocall') >= 0) {
window.location.href = 'tel:' + number;
}
}
renderCall();
if (window.location.hostname.indexOf('localhost') >= 0) {
document.getElementById('style').setAttribute('href', '/index.css');
}
</script>
</body>
</html>