Commit 9ef94886 authored by JC Brand's avatar JC Brand

IE8 fixes. Also avoid ajax call when opening chatroom

parent f968f56e
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
var msg = xmppchat.storage.getLastMessage(this.model.get('jid')); var msg = xmppchat.storage.getLastMessage(this.model.get('jid'));
if (typeof msg !== 'undefined') { if (typeof msg !== 'undefined') {
var prev_date = new Date(Date.parse(msg.split(' ', 2)[0])); var prev_date = new Date(Date(msg.split(' ', 2)[0]));
if (this.isDifferentDay(prev_date, now)) { if (this.isDifferentDay(prev_date, now)) {
$chat_content.append($('<div class="chat-date">&nbsp;</div>')); $chat_content.append($('<div class="chat-date">&nbsp;</div>'));
$chat_content.append($('<div class="chat-date"></div>').text(now.toString().substring(0,15))); $chat_content.append($('<div class="chat-date"></div>').text(now.toString().substring(0,15)));
...@@ -383,13 +383,13 @@ ...@@ -383,13 +383,13 @@
date = msg_array[0]; date = msg_array[0];
if (i === 0) { if (i === 0) {
this_date = new Date(Date.parse(date)); this_date = new Date(Date(date));
if (this.isDifferentDay(this_date, new Date())) { if (this.isDifferentDay(this_date, new Date())) {
$content.append($('<div class="chat-date"></div>').text(this_date.toString().substring(0,15))); $content.append($('<div class="chat-date"></div>').text(this_date.toString().substring(0,15)));
} }
} else { } else {
prev_date = this_date; prev_date = this_date;
this_date = new Date(Date.parse(date)); this_date = new Date(Date(date));
if (this.isDifferentDay(prev_date, this_date)) { if (this.isDifferentDay(prev_date, this_date)) {
$content.append($('<div class="chat-date">&nbsp;</div>')); $content.append($('<div class="chat-date">&nbsp;</div>'));
$content.append($('<div class="chat-date"></div>').text(this_date.toString().substring(0,15))); $content.append($('<div class="chat-date"></div>').text(this_date.toString().substring(0,15)));
...@@ -988,9 +988,7 @@ ...@@ -988,9 +988,7 @@
show: function () { show: function () {
this.$el.css({'opacity': 0}); this.$el.css({'opacity': 0});
this.$el.css({'display': 'inline'}); this.$el.css({'display': 'inline'});
this.$el.animate({ this.$el.animate({opacity: '1'}, 200);
opacity: '1'
}, 200);
return this; return this;
}, },
...@@ -1062,14 +1060,17 @@ ...@@ -1062,14 +1060,17 @@
}, },
openChat: function (jid) { openChat: function (jid) {
var view;
jid = Strophe.getBareJidFromJid(jid); jid = Strophe.getBareJidFromJid(jid);
if (!this.model.get(jid)) { if (this.model.get(jid)) {
this.showChat(jid);
} else if (this.isChatRoom(jid)) {
view = this.createChatBox(jid);
} else {
$.getJSON(portal_url + "/xmpp-userinfo?user_id=" + Strophe.getNodeFromJid(jid), $.proxy(function (data) { $.getJSON(portal_url + "/xmpp-userinfo?user_id=" + Strophe.getNodeFromJid(jid), $.proxy(function (data) {
view = this.createChatBox(jid, data); view = this.createChatBox(jid, data);
}, this)); }, this));
} else { }
this.showChat(jid);
}
}, },
showChat: function (jid) { showChat: function (jid) {
...@@ -1607,7 +1608,7 @@ ...@@ -1607,7 +1608,7 @@
initialize: function () { initialize: function () {
this.set({ this.set({
'status' : this.getStatus(), 'status' : this.getStatus(),
'status_message' : this.getStatusMessage(), 'status_message' : this.getStatusMessage()
}); });
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment