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

Commit

Permalink
Minor fixes for IE8.
Browse files Browse the repository at this point in the history
  • Loading branch information
seancribbs committed May 16, 2011
1 parent ed0c135 commit 04b1a14
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions yak/yakriak.js
Expand Up @@ -32,7 +32,7 @@ YakRiak.prototype._poll = function(successful, data, request){
var last_item = data[data.length - 1];
if(last_item && last_item.timestamp)
this.since = last_item.timestamp + 0.01; // Try to avoid duplicates on next poll
data.forEach(this.displayMessage.bind(this));
$.each(data, this.displayMessage.bind(this));
}
this.pollingTimeout = setTimeout(function(){ yakriak.poll(); }, this.randomInterval());
};
Expand All @@ -42,13 +42,13 @@ YakRiak.prototype.randomInterval = function(){
return Math.round((Math.random()-0.5)*this.interval/2 + this.interval);
};

YakRiak.prototype.displayMessage = function(item){
YakRiak.prototype.displayMessage = function(index, item){
if($('#' + item.key).length == 0){
var elem = $('<li id="' + item.key + '" />');
var avatar = $('<img />').attr('src', 'http://gravatar.com/avatar/' + item.gravatar + '?s=40');
var name = $('<span class="name">').html(item.name);
var message = $('<span class="message">').html(item.message);
var timestamp = $('<span class="timestamp">').text(new Date(item.timestamp).toLocaleTimeString());
var name = $('<span />').addClass('name').html(item.name);
var message = $('<span />').addClass('message').html(item.message);
var timestamp = $('<span />').addClass('timestamp').text(new Date(item.timestamp).toLocaleTimeString());
elem.append(timestamp).append(avatar).append(name).append(message);
if(item.name == this.name && item.gravatar == this.gravatar)
elem.addClass('me');
Expand All @@ -69,7 +69,7 @@ YakRiak.prototype.postMessage = function(message){
'gravatar': this.gravatar,
'timestamp': new Date().getTime()
};
object.store(function(){ yakriak.displayMessage(object.body) });
object.store(function(){ yakriak.displayMessage(null, object.body) });
}
$('form#chatbox').get(0).reset();
};
Expand Down

0 comments on commit 04b1a14

Please sign in to comment.