-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExclude.html
More file actions
executable file
·105 lines (84 loc) · 3.13 KB
/
Exclude.html
File metadata and controls
executable file
·105 lines (84 loc) · 3.13 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
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
<!DOCTYPE html>
<html>
<head>
<title>Sorry!</title>
<meta charset="utf-8"/>
<!-- Set the favicon logo -->
<link rel="icon" href="./Assets/Logo.png" type="image/x-icon" />
<!-- Import the user agent parser -->
<script src="./Assets/ua-parser.pack.js"></script>
<!-- Import the stylesheet -->
<link rel="stylesheet" href="./Assets/w3.css">
<!-- Some more styling -->
<style>
body {padding: 30px 0;}
</style>
<!-- Get participant IDs passed in from URL -->
<script src="./Assets/GetPpantIds.js"></script>
<!-- Get DateTime_Start and ClientTimeZone (and add to TaskIO) -->
<script src="./Assets/SetDateTime.js"></script>
<script>
// Define some global variables
var OsId = null;
var BrowserId = null;
var UserAgentResult;
// Function to get OS, Browser, and UserAgent (setting the above global vars)
function GetOsAndBrowser() {
var UserAgentParser = new UAParser();
UserAgentResult = UserAgentParser.getResult();
OsId = UserAgentResult.os.name + '_' + UserAgentResult.os.version;
BrowserId = UserAgentResult.browser.name + '_' + UserAgentResult.browser.version;
return new Promise(resolve => {resolve()});
}
// OnBodyLoad function
function OnBodyLoad() {
// Promise chain (GetOsAndBrowser + LogExclusion)
GetOsAndBrowser().then(function() {LogExclusion();});
// If they are using IE, prep the message to display:
try {
if (UserAgentResult.browser.name.includes('IE') || UserAgentResult.browser.name.includes('Edge')){
document.getElementById('Message').innerHTML = "<p>You are not able to run the experiment using Internet Explorer or Edge.<br /><br />Please download a newer web browser. We recommend <a href='https://www.google.com/chrome/'>Google Chrome</a>.</p>";
}
} catch(Err) {
if (UserAgentResult.browser.name == 'IE'){
document.getElementById('Message').innerHTML = "<p>You are not able to run the experiment using Internet Explorer or Edge.<br /><br />Please download a newer web browser. We recommend <a href='https://www.google.com/chrome/'>Google Chrome</a>.</p>";
}
}
// Display the main div:
document.getElementById('MainDiv').style.visibility = 'visible';
}
// LogExclusion function
function LogExclusion() {
var Args = {};
Args.PoolId = PoolId;
Args.SubjectId = SubjectId;
Args.OS = OsId;
Args.Browser = BrowserId;
// Construct the POST:
var JsonPost = {
type: "POST",
url: './ExcludeActions.php',
dataType: 'json',
data: {FunctionCall: 'LogExclusion', Args: Args},
success: function (Obj,Textstatus) {
if( !('error' in Obj) ) {
return Obj.result;
}
else {
console.log(Obj.error);
}
}
}
// Submit the POST:
Vals = jQuery.ajax(JsonPost);
return new Promise(resolve => {resolve(Vals)});
}
</script>
</head>
<body onload="OnBodyLoad()">
<div style="visibility:hidden;" id="MainDiv" class="w3-center">
<h1>Sorry! 🤷</h1>
<div id='Message'><p>You are not able to run the experiment on this device.<br>Please use a laptop or desktop computer.</p></div>
</div>
</body>
</html>