-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.html
129 lines (124 loc) · 3.35 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
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TrustDecisionJs</title>
<style type="text/css">
a{
text-decoration: none;
color: #ffffff;
}
#contain {
margin: 0 auto;
width: 1000px;
}
#contain div {
padding: 15px;
}
#contain header {
height: 60px;
}
#contain header a{
display: inline-block;
font-size: 0;
}
#contain header img {
font-size: 0;
height: 50px;
}
#device_id {
font-size: 30px;
}
.title {
font-size: 20px;
color: #FFF;
}
#layout {
background:#12b455;
background-image: linear-gradient(135deg, #12b455 0%, #0f1e41 100%);
border-radius: 15px;
}
#data_info_layout {
}
.data_info {
color: rgba(255, 255, 255, 0.58);
}
pre{white-space:pre-wrap;word-wrap:break-word;}
</style>
</head>
<body>
<div id="contain">
<div>
<header>
<a href=""><img src="static/image/logo_light.png" alt="TrustDecision Logo"></a>
</header>
<div id="layout">
<div class="title">Device ID:</div>
<div id="device_id" class="data_info"></div>
<div class="title">Device Risk Label:</div>
<div id="device_risk_label" class="data_info"></div>
<div class="title">User Agent:</div>
<div id="userAgent" class="data_info"></div>
<div class="title">Device Detail:</div>
<div id="data_info_layout">
<pre id="device_detail" class="data_info"></pre>
</div>
</div>
</div>
</div>
<script>
window.onload = function () {
var show = document.getElementById('device_detail')
function pretifyJson(json, pretify) {
if(pretify === undefined) {
pretify = true
}
if (typeof json !== 'string') {
if (pretify) {
json = JSON.stringify(json, undefined, 4)
} else {
json = JSON.stringify(json)
}
}
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,
function (match) {
var cls = '<span>';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = '<span class=\'key\'>'
} else {
cls = '<span class=\'string\'>'
}
} else if (/true|false/.test(match)) {
cls = '<span class=\'boolean\'>'
} else if (/null/.test(match)) {
cls = '<span class=\'null\'>'
}
return cls + match + '</span>'
}
)
};
(function () {
window._fmOpt = {
success: function (result) {
console.log('deviceId: ', result.device_id)
console.log('result: ', result)
document.getElementById('device_id').innerHTML = result.device_id
document.getElementById('device_risk_label').innerHTML = pretifyJson(result.device_risk_label, true)
document.getElementById('userAgent').innerHTML = navigator.userAgent
show.innerHTML = pretifyJson(result.device_detail, true)
}
}
var fm = document.createElement('script')
fm.type = 'text/javascript'
fm.async = true
fm.src =
'./dist/fm.js?t='
+ new Date().getTime();
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(fm, s)
})()
}
</script>
</body>
</html>