Created
August 30, 2012 13:50
-
-
Save scosman/3528930 to your computer and use it in GitHub Desktop.
Kobo stats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script> | |
<script type='text/javascript'> | |
$(function() | |
{ | |
$('#goBtn').click(function() | |
{ | |
getStats(); | |
setInterval(getStats, 300000); // 5 mins | |
}); | |
}); | |
var getStats = function() | |
{ | |
var password = $('#pass').val(); | |
$.ajax({ | |
url:"https://secure.shoeboxapp.com/dashboard_stats?password=" + password, | |
dataType: 'jsonp', | |
success: function(data) | |
{ | |
$('#count').html(numberWithCommas(data.count)); | |
$('#peruser').html(numberWithCommas(data.count_per_user)); | |
$('#signin').hide(); | |
}, | |
}); | |
} | |
var numberWithCommas = function(x) { | |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
} | |
</script> | |
</head> | |
<body> | |
<div id="signin"> | |
<input id="pass" type="password"> | |
<button id="goBtn">go</button> | |
</div> | |
<h1 id="count" style="font-size:60px"></h1> | |
<h1 id="peruser" style="font-size:60px"></h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment