Skip to content

Instantly share code, notes, and snippets.

@tecnom1k3
Created June 19, 2016 02:14
Show Gist options
  • Save tecnom1k3/5631149de8ef8bfe045fd229151806f1 to your computer and use it in GitHub Desktop.
Save tecnom1k3/5631149de8ef8bfe045fd229151806f1 to your computer and use it in GitHub Desktop.
js get entropy mouse
<html>
<head>
<script language="javascript" src="js/jquery-1.5.1.min.js"></script>
<script language="javascript" src="js/jquery-ui-1.8.11.custom.min.js"></script>
<script language="javascript">
$(document).ready(function() {
var entropy='';
var charslength = 0;
var pct = 0;
var maxchars = 500;
$("#progressbar").progressbar({
value:0
});
$("#mousemove").mousemove(function(e){
if (charslength < maxchars) {
entropy += e.pageX+e.pageY;
$("#entropy").text(entropy);
charslength = entropy.length;
pct = charslength / maxchars *100;
$("#progressbar").progressbar({
value:pct
});
} else {
$("#mousemove").hide('fast');
}
});
});
</script>
<link rel="stylesheet" type="text/css" href="css/blitzer/jquery-ui-1.8.11.custom.css" />
</head>
<body>
<div id="progressbar" style="width:500px"></div>
<div id="mousemove" style="width:500px; height:200px"> mouse over me</div>
<textarea id="entropy" cols="100" rows="15"></textarea>
</body>
<html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment