Skip to content

Instantly share code, notes, and snippets.

@jhamrick
Created August 20, 2015 16:04
Show Gist options
  • Save jhamrick/a5d9889da15174a2e690 to your computer and use it in GitHub Desktop.
Save jhamrick/a5d9889da15174a2e690 to your computer and use it in GitHub Desktop.
psiTurk default.html that generates random debug links
<!doctype html>
<html>
<head>
<title>CompCog Psychology Experiment</title>
<script src="static/lib/jquery.min.js" type="text/javascript"></script>
<script src="static/lib/bootstrap.min.js"></script>
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="static/css/general.css" media="screen" />
</head>
<body>
<div class="container-flex" id="container-ad">
<h1>psiTurk Experiment</h1>
<p>Begin by viewing the <a href="#" id="ad-href">ad</a>.</p>
<script type="text/javascript">
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 5; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var assignmentId = "debug" + makeid();
var hitId = "debug" + makeid();
var workerId = "debug" + makeid();
var href = "/ad?assignmentId=" + assignmentId + "&hitId=" + hitId + "&workerId=" + workerId + "&mode=debug"
$("#ad-href").attr("href", href);
</script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment