Updated chat for mobile devices

pull/275/head
0ip 2011-12-06 18:43:30 +01:00
parent 963d4ea2d5
commit 9ad3aa0e4b
1 changed files with 16 additions and 5 deletions

View File

@ -16,6 +16,10 @@
var chat = (function() var chat = (function()
{ {
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
var isMobileSafari = ua.indexOf("mobile") > -1;
var bottomMargin = "0px";
var chatMentions = 0; var chatMentions = 0;
var title = document.title; var title = document.title;
var self = { var self = {
@ -41,7 +45,10 @@ var chat = (function()
{ {
$("#focusprotector").hide(); $("#focusprotector").hide();
$("#chatbox").css({right: "20px", bottom: "0px", left: "", top: ""}); if(isAndroid || isMobileSafari)
bottommargin = "32px";
$("#chatbox").css({right: "20px", bottom: bottomMargin, left: "", top: ""});
self.scrollDown(); self.scrollDown();
} }
@ -53,10 +60,14 @@ var chat = (function()
hide: function () hide: function ()
{ {
$("#chatcounter").text("0"); $("#chatcounter").text("0");
$("#chatbox").hide("slide", { direction: "down" }, 750, function() if(isAndroid || isMobileSafari) {
$("#chatbox").toggle();
}
else
{ {
$("#chaticon").show("slide", { direction: "down" }, 500); $("#chatbox").toggle("slide", { direction: "down" }, 625);
}); }
}, },
scrollDown: function() scrollDown: function()
{ {
@ -155,4 +166,4 @@ var chat = (function()
} }
return self; return self;
}()); }());