-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathad.html
126 lines (105 loc) · 5.97 KB
/
ad.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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<link href="https://s3.amazonaws.com/mturk-public/bs30/css/bootstrap.min.css" rel="stylesheet" />
<section class="container" id="SurveyLink" style="margin-bottom:15px; padding: 10px 10px; font-family: Verdana, Geneva, sans-serif; color:#333333; font-size:0.9em;">
<div class="row col-xs-12 col-md-12">
<!-- Instructions -->
<div class="panel panel-primary">
<div class="panel-heading"><strong>Instructions</strong></div>
<div class="panel-body">
<p>You will play a browser-based card game with some (friendly) monsters. The study will last
approximately 20 minutes. You will be paid a compensation of 2.00$ for your participation and can
earn a performance-based bonus.<br />
<br />
Please note that we can only pay you if you complete the study and if you read everything
carefully. We will ask you to answer some simple questions about the instructions, which you need
to answer correctly in order to participate and be paid.</p>
<p>At the end of the game, you will receive a code to paste into the box below to receive credit for
participating.</p>
<p><strong>Make sure to leave this window open as you complete the game. </strong> When you are
finished, you will return to this page to paste the code into the box.</p>
<!-- <p style="font-size: 0.9em; font-style:italic; background-color:#eeeeee; padding:10px;"><strong>Template
note for Requesters </strong>- To verify that Workers actually complete your survey, require
each Worker to enter a <span style="text-decoration:underline;">unique</span> survey completion
code to your HIT. Consult with your survey service provider on how to generate this code at the end
of your survey.</p> -->
</div>
</div>
<!-- End Instruction -->
<div class="alert alert-warning"><b>Warning</b>: Please disable pop-up blockers before continuing.</div>
<table>
<tbody>
<tr>
<td><strong>Experiment link:</strong></td>
<td>
<div id="myelementLink" style="display: inline; font-family: Verdana;">URL not shown
because there is an error with Javascript on your computer. To perform this HIT, you
must have Javascript and cookies enabled on your browser.</div>
<div class="link" id="linkDiv"> </div>
</td>
</tr>
<tr>
<td><strong>Provide the completion code here:</strong></td>
<td style="vertical-align: middle;"><input class="form-control" id="surveycode" name="surveycode" placeholder="e.g. 123456"
type="text" /></td>
</tr>
</tbody>
</table>
</div>
</section>
<script type="text/javascript" language="JavaScript">
var hash = CryptoJS.MD5("Message").toString();
console.log('Hash of message', hash);
var assignment_id_field = document.getElementById('myelementLink');
var paramstr = window.location.search.substring(1);
var parampairs = paramstr.split("&");
var workerId = "";
var assignmentId = "";
var hitId = "";
var isMturk = window.location.origin.includes('mturk') ? 1 : 0;
var isSandbox = window.location.origin.includes('sandbox') ? 1 : 0;
for (i in parampairs) {
var pair = parampairs[i].split("=");
if (pair[0] == "workerId") { workerId = pair[1]; }
if (pair[0] == "assignmentId") { assignmentId = pair[1]; }
if (pair[0] == "hitId") { hitId = pair[1]; }
}
var expUrl = 'https://static.isearchlab.org/mturk/mtt?workerId=' + workerId + '&assignmentId=' + assignmentId + '&hitId=' + hitId + '&isMturk=' + isMturk + '&isSandbox=' + isSandbox + '&lang=en';
function openExperimentPopup() {
popup = window.open(expUrl, 'Popup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + 1024 + ',height=' + 768 + '');
}
if (workerId == "") {
assignment_id_field.innerHTML = '<tt>The link will appear here only if you accept this HIT.</tt>';
}
else {
assignment_id_field.innerHTML = '<a onclick="openExperimentPopup()"><h1><span style="color: rgb(255, 0, 0);"><span><b>Click here to start the game (in a popup)</b></span></span></h1></a>';
}
$.get("https://mtt-api.isearchlab.org/api/forbiddenWorkers/" + workerId, function(res) {
console.log('res2', res);
if (res['forbidden'] == true) {
assignment_id_field.innerHTML = '<h3 style="color:red;">Unfortunately it seems that you have already played a version of this game before. You can not play it again.</h3>';
}
});
// function zpa() {
// var a = CryptoJS.MD5(hitId).toString();
// var b = CryptoJS.MD5(assignmentId + a).toString();
// var c = CryptoJS.MD5(workerId + b).toString()
// return c.slice(0, 6).toUpperCase();
// }
// document.getElementById('mturk_form').addEventListener('submit', function(e) {
// if (document.getElementById('surveycode').value != zpa()) {
// e.preventDefault();
// alert('Wrong completion code!');
// }
// });
var _0x2080=['toUpperCase','getElementById','mturk_form','addEventListener','surveycode','value','preventDefault','Wrong\x20completion\x20code!','MD5','toString'];(function(_0x2f4cfe,_0x2bd686){var _0x406496=function(_0xa4b640){while(--_0xa4b640){_0x2f4cfe['push'](_0x2f4cfe['shift']());}};_0x406496(++_0x2bd686);}(_0x2080,0x1ac));var _0x48bc=function(_0x2699a9,_0x501e82){_0x2699a9=_0x2699a9-0x0;var _0x5b6c40=_0x2080[_0x2699a9];return _0x5b6c40;};function zpa(){var _0x355801=CryptoJS[_0x48bc('0x0')](hitId)[_0x48bc('0x1')]();var _0x6ff2bd=CryptoJS[_0x48bc('0x0')](assignmentId+_0x355801)['toString']();var _0x17e25f=CryptoJS[_0x48bc('0x0')](workerId+_0x6ff2bd)['toString']();return _0x17e25f['slice'](0x0,0x6)[_0x48bc('0x2')]();}document[_0x48bc('0x3')](_0x48bc('0x4'))[_0x48bc('0x5')]('submit',function(_0x4bd0f2){if(document[_0x48bc('0x3')](_0x48bc('0x6'))[_0x48bc('0x7')]!=zpa()){_0x4bd0f2[_0x48bc('0x8')]();alert(_0x48bc('0x9'));}});
</script>
<!-- close container section -->
<style type="text/css">
td {
font-size: 1.0em;
padding: 5px 5px;
}
</style>