Skip to content
Browse files

fixed a missing console.log

  • Loading branch information...
1 parent 3760cf7 commit 37624ef8c85daaeccbb1bde5fcd4b97b41b94c93 @peterbe committed Oct 11, 2011
Showing with 25 additions and 11 deletions.
  1. +20 −6 static/js/lookups.js
  2. +5 −5 templates/lookups.html
View
26 static/js/lookups.js
@@ -1,3 +1,7 @@
+function L() {
+ if (window.console && window.console.log)
+ console.log.apply(console, arguments);
+}
function compareAssociativeArrays(a, b) {
function nrKeys(a) {
@@ -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;
@@ -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));
});
}
View
10 templates/lookups.html
@@ -17,23 +17,23 @@
<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 %}

0 comments on commit 37624ef

Please sign in to comment.
Something went wrong with that request. Please try again.