-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbridge-page-original-itms.html
199 lines (166 loc) · 5.91 KB
/
bridge-page-original-itms.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0"/>
<title>Tune-Time</title>
<style type="text/css">
body {
font-family: Helvetica, Arial, Verdana, sans-serif;
margin: 0;
padding: 5px;
text-align: center;
}
h1, img {
font-size: 28px;
font-weight: 700;
margin: 10px 0 20px;
}
.button {
border: 1px solid gray;
margin: 0 auto;
width: 200px;
font-size: 28px;
}
img {
max-width: 150px;
}
form {
margin: 0;
padding: 0;
}
div {
margin-bottom: 20px;
}
a {
text-decoration: none;
}
iframe {
border: none;
height: 1px;
width: 1px;
}
@media screen and (max-device-width:480px) {
body {
-webkit-text-size-adjust: none;
}
}
</style>
<script type="text/javascript">
var urls = ["branchsters://?mat_click_id=0a11fd405e8a47b50bb9defe29da704e-20190430-192600","itms-appss://itunes.apple.com/app/id1058959277?mat_deeplink=ubereats%3A%2F%2Fstore%2Fbrowse%3FstoreUUID&referrer=mat_click_id%3D4059968beb364beba849690615e86fe3-20190523-7336%26link_click_id%3D660240599525641322&mat_click_id=4059968beb364beba849690615e86fe3-20190523-7336"];
var redirectFn;
var isFirefoxAndroid = false;
var lastFired = new Date().getTime();
var isForceBridgePage = false;
// iOS 9+ will be served this template instead of the iOS one, so detect mobile WebKit
if (navigator.userAgent.match(/AppleWebKit.+Mobile/)) {
redirectFn = redirectWebkit;
}
else if (navigator.userAgent.match(/Android/)) {
if (navigator.userAgent.match(/Chrome/)) {
redirectFn = redirectWebkit;
} else {
isFirefoxAndroid = navigator.userAgent.match(/Firefox/);
redirectFn = redirectDefault;
}
} else if (navigator.userAgent.match(/Silk/)) {
redirectFn = redirectDefault;
} else {
redirectFn = redirectWeb;
}
function ensureLoadedThen(fn) {
if(document.readyState !== 'loading') {
fn();
} else {
window.onload = fn;
}
}
function checkAlreadyInvoked() {
var invokedCookie = "61e92f41f2669f87c7bb0b55c8b1fd19" + "_invoked";
if (document.cookie.indexOf(invokedCookie + "=") !== -1) {
return true;
} else {
document.cookie = invokedCookie + "=true; expires=" + new Date(Date.now() + 300000).toGMTString();
return false;
}
}
function invoke() {
redirect(redirectFn, [].concat(urls));
// On FF Android, if we try to invoke the app and it is not installed, it
// will not fire the 'load' event of the iframe, so we'll set a timer to trigger it
// manually
if(isFirefoxAndroid) {
setTimeout(function(){
if(!document.hidden) {
downloadApp();
}
}, 2000);
}
}
function downloadApp(evt) {
if(evt) {
evt.preventDefault();
}
var downloadUrls = [].concat(urls);
downloadUrls.shift();
// redirectFn is defined at the beginning of this script
redirect(redirectFn, downloadUrls);
}
// redirect using specified function. If only one URL, we failed invoke and markets, force move to web
function redirect(fn, urls) {
var url;
while (urls.length > 1) {
url = urls.shift();
if (url) {
return fn(url, urls);
}
}
// The last url is always a website
if (urls.length === 1) {
window.location = urls.shift();
}
}
// Webkit browsers (iOS/Chrome)
function redirectWebkit(url, urls) {
setTimeout(function() {
if (!document.webkitHidden) {
now = new Date().getTime();
if(now - lastFired < 5000) {//if it's been less than 5 seconds
redirect(redirectWebkit, urls);
}
}
}, 2000);
window.location = url;
}
// Non-webkit browser redirection
function redirectDefault(url, urls) {
var iframe = document.createElement("iframe");
iframe.style.border = "none";
iframe.style.width = "1px";
iframe.style.height = "1px";
iframe.onload = function() {
redirect(redirectDefault, urls);
};
iframe.src = url;
// If we're still loading the document, wait before doing this
ensureLoadedThen(function() {
document.body.appendChild(iframe);
});
}
function redirectWeb() {
window.location = urls[urls.length - 1];
}
if (!checkAlreadyInvoked() && !isForceBridgePage) {
invoke();
}
</script>
</head>
<body>
<div id="siteInfo">
Tune-Time
</div>
<div>
<a class="button" href="itms-appss://itunes.apple.com/app/id1058959277?mat_deeplink=ubereats%3A%2F%2Fstore%2Fbrowse%3FstoreUUID&referrer=mat_click_id%3D4059968beb364beba849690615e86fe3-20190523-7336%26link_click_id%3D660240599525641322&mat_click_id=4059968beb364beba849690615e86fe3-20190523-7336" target="_blank" onclick="downloadApp(event)">Download</a>
</div>
<div>
<a class="button" href="branchsters://?mat_click_id=0a11fd405e8a47b50bb9defe29da704e-20190430-192600" target="_blank">Open App</a>
</div>
</body></html>