-
Notifications
You must be signed in to change notification settings - Fork 1
/
deepviewctatest.html
90 lines (82 loc) · 2.83 KB
/
deepviewctatest.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<script>
// load Branch
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode autoAppIndex banner closeBanner closeJourney creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode trackCommerceEvent".split(" "), 0);
// init Branch
branch.init('key_live_mpNkmP6pUud4YmIqkpxginnnADcn7yGW');
// branch.deepview(
// {
// channel: 'test',
// data: {
// foo: 'bar',
// },
// feature: 'test',
// },
// {
// make_new_link: true,
// open_app: true
// },
// function(err) {
// console.log(err || 'no error');
//
// branch.deepviewCta(function(err) {
// if (err) {
// console.log(err);
// }
// });
// }
// );
</script>
<script type="text/javascript">
function unescapeHtml(escaped_str) {
var div = document.createElement('div');
div.innerHTML = escaped_str;
var child = div.childNodes[0];
return child ? child.nodeValue : null;
}
function validateProtocol(url) {
var parser = document.createElement('a');
parser.href = url;
var protocol = parser.protocol.toLowerCase();
if ([ 'javascript:', 'vbscript:', 'data:', 'ftp:',':' , ' '].indexOf(protocol) < 0) {
return url;
}
return null;
}
function validate(url) {
var unescaped_value = unescapeHtml(url);
if (unescaped_value && validateProtocol(unescaped_value)) {
return unescaped_value;
}
return '/';
}
var hasURI = false;
var intervalExecuted = false;
window.onload = function() {
document.getElementById("l").src = validate("adobelightroom://open?link_click_id=821473527331352265");
window.setTimeout(function() {
if (!hasURI) {
window.top.location = validate("https://lightroom.adobe.com/learn/discover?_branch_match_id=821473527331352265");
}
intervalExecuted = true;
}, 300);
};
window.onblur = function() {
hasURI = true;
};
window.onfocus = function() {
if (hasURI) {
window.top.location = validate("https://lightroom.adobe.com/learn/discover?_branch_match_id=821473527331352265");
} else if(intervalExecuted) {
window.top.location = validate("https://lightroom.adobe.com/learn/discover?_branch_match_id=821473527331352265");
}
}
</script>
</head>
<body>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
</body>
</html>