From 9ad3aa0e4b85c09cac40c32754675025b8fa7ee2 Mon Sep 17 00:00:00 2001 From: 0ip Date: Tue, 6 Dec 2011 18:43:30 +0100 Subject: [PATCH] Updated chat for mobile devices --- static/js/chat.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/static/js/chat.js b/static/js/chat.js index 0dd2b3c1e..bda5786de 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -16,6 +16,10 @@ 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 title = document.title; var self = { @@ -41,7 +45,10 @@ var chat = (function() { $("#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(); } @@ -53,10 +60,14 @@ var chat = (function() hide: function () { $("#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() { @@ -155,4 +166,4 @@ var chat = (function() } return self; -}()); +}()); \ No newline at end of file