Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
fixed a missing console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Oct 11, 2011
1 parent 3760cf7 commit 37624ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
26 changes: 20 additions & 6 deletions static/js/lookups.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
function L() {
if (window.console && window.console.log)
console.log.apply(console, arguments);
}

function compareAssociativeArrays(a, b) {
function nrKeys(a) {
Expand All @@ -23,13 +27,24 @@ function compareAssociativeArrays(a, b) {


var previous = {}, incr = 0; // global

function update() {
function incr_number(key, num) {
var before = $(key).text();
if (before !== '' + num) {
// there's a change!
$(key).fadeTo(200, 0., function() {
$(this).text(num).fadeTo(300, 1.0);
});
}
}

$.getJSON(JSON_URL, function(response) {
$('#lookups-total').text(response.lookups_json + response.lookups_jsonp);
$('#lookups-json').text(response.lookups_json);
$('#lookups-jsonp').text(response.lookups_jsonp);
$('#lookups-usernames').text(response.lookups_usernames);
$('#auths').text(response.auths);
incr_number('#lookups-total', response.lookups_json + response.lookups_jsonp);
incr_number('#lookups-json', response.lookups_json);
incr_number('#lookups-jsonp', response.lookups_jsonp);
incr_number('#lookups-usernames', response.lookups_usernames);
incr_number('#auths', response.auths);
var change = !compareAssociativeArrays(response, previous);
previous = response;

Expand All @@ -41,7 +56,6 @@ function update() {
t = Math.min(3 + incr, 10);
incr += 0.1;
}
console.log(Math.ceil(t*1000));
setTimeout(update, Math.ceil(t * 1000));
});
}
Expand Down
10 changes: 5 additions & 5 deletions templates/lookups.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ <h1>Lookups</h1>
<table>
<tr>
<th>Total number of usernames looked up:</th>
<td id="lookups-usernames">{{ lookups_usernames }}</td>
<td><span id="lookups-usernames">{{ lookups_usernames }}</span></td>
</tr>
<tr>
<th>Twitter requests total:</th>
<td id="lookups-total">{{ lookups_json + lookups_jsonp }}</td>
<td><span id="lookups-total">{{ lookups_json + lookups_jsonp }}</span></td>
</tr>
<tr>
<th>Twitter requests by JSON:</th>
<td id="lookups-json">{{ lookups_json }}</td>
<td><span id="lookups-json">{{ lookups_json }}</span></td>
</tr>
<tr>
<th>Twitter requests by JSONP:</th>
<td id="lookups-jsonp">{{ lookups_jsonp }}</td>
<td><span id="lookups-jsonp">{{ lookups_jsonp }}</span></td>
</tr>
<tr>
<th>Authentications:</th>
<td id="auths">{{ auths }}</td>
<td><span id="auths">{{ auths }}</span></td>
</tr>
</table>
{% end %}
Expand Down

0 comments on commit 37624ef

Please sign in to comment.