-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
128 lines (114 loc) · 4.15 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
<!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>降低陰謀論影響:對抗策略效度檢測</title>
<!-- for Facebook -->
<meta property="og:title" content="降低陰謀論影響:對抗策略效度檢測">
<meta property="og:type" content="article">
<meta property="og:image" content="https://lab.doublethinklab.org/images/cover.jpg">
<meta property="og:description" content="由台北大學犯罪學研究所沈伯洋教授主持、台灣民主實驗室協助執行的行為實驗網站。">
<!-- for twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="降低陰謀論影響:對抗策略效度檢測">
<meta name="twitter:description" content="由台北大學犯罪學研究所沈伯洋教授主持、台灣民主實驗室協助執行的行為實驗網站。">
<meta name="twitter:image" content="https://lab.doublethinklab.org/images/cover.jpg?raw=true">
<link rel="shortcut icon" href="images/favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/ismobilejs@1/dist/isMobile.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js"></script>
<script>
const generateRandomString = (num) => {
const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result1= Math.random().toString(36).substring(0,num);
return result1;
}
const urls = [
];
var assignURL;
if(!Cookies.get('visitorId') && isMobile.any != true) {
// Initialize the agent at application startup.
const fpPromise = import('https://fpcdn.io/v3/mmDukAa5wdeWdhq7aoTs')
.then(FingerprintJS => FingerprintJS.load({
region: 'ap'
}))
// Get the visitor identifier when you need it.
fpPromise
.then(fp => fp.get())
.then(result => {
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
Cookies.set('visitorId', visitorId)
const randomNum = Math.abs(hashCode(visitorId))
console.log(randomNum)
console.log(randomNum%4)
assignURL = urls[randomNum%4]
console.log(assignURL)
if(isMobile.any != true) {
// window.location.href = assignURL; //one level up
}
})
.catch(error => {
console.log('error')
console.log(error)
const visitorId = generateRandomString(7);
Cookies.set('visitorId', visitorId)
const randomNum = Math.abs(hashCode(visitorId))
console.log(randomNum)
console.log(randomNum%4)
assignURL = urls[randomNum%4]
console.log(assignURL)
if(isMobile.any != true) {
// window.location.href = assignURL; //one level up
}
})
}else{
var visitorId = Cookies.get('visitorId');
console.log(visitorId)
var randomNum = Math.abs(hashCode(visitorId))
assignURL = urls[randomNum%4]
if(isMobile.any != true) {
// window.location.href = assignURL; //one level up
}
}
function hashCode(string) {
var hash = 0, i, chr;
if (string.length === 0) return hash;
for (i = 0; i < string.length; i++) {
chr = string.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
};
console.log(visitorId);
console.log("isMobile="+isMobile.any);
</script>
<style type="text/css">
.wrapper{
width:100%;
}
img, .center{
margin:1em auto;
display:block;
}
#wrapper_id{
text-align: center;
}
</style>
</head>
<body>
<div class="wrapper">
<img class="center" src="images/cover.jpg" width="100%" style="max-width: 700px;">
<!-- <div id="wrapper_id">正在等待跳轉中,請靜待約 3 秒 ...</div> -->
<div id="wrapper_id">目前參與實驗名額已經額滿,若有任何問題請聯絡台灣民主實驗室研究員陳韻如 [email protected]</div>
</div>
<script type="text/javascript">
if(isMobile.any) {
// document.getElementById("wrapper_id").innerHTML = '請使用電腦與滑鼠參與此測驗';
}
</script>
</body>
</html>