From 300886da3467770077da9e50a789b9b367ba0899 Mon Sep 17 00:00:00 2001 From: Robin Date: Sun, 22 Jan 2012 00:10:06 +0100 Subject: [PATCH] Removed duplicates --- static/js/ace2_common.js | 3 ++- static/js/ace2_inner.js | 7 +------ static/js/chat.js | 5 +---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/static/js/ace2_common.js b/static/js/ace2_common.js index 1e5c415c..d08c521a 100644 --- a/static/js/ace2_common.js +++ b/static/js/ace2_common.js @@ -95,7 +95,8 @@ var browser = { opera: /opera/.test(userAgent), msie: /msie/.test(userAgent) && !/opera/.test(userAgent), mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent), - windows: /windows/.test(userAgent) // dgreensp + windows: /windows/.test(userAgent) + mobile: /mobile/.test(userAgent) || /android/.test(userAgent); }; diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 2b2d05f2..5ca25c7f 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -86,11 +86,6 @@ function OUTER(gscope) var hasLineNumbers = true; var isStyled = true; - // check for mobile os presence - var ua = navigator.userAgent.toLowerCase(); - var isAndroid = ua.indexOf("android") > -1; - var isMobileSafari = ua.indexOf("mobile") > -1; - // space around the innermost iframe element var iframePadLeft = MIN_LINEDIV_WIDTH + LINE_NUMBER_PADDING_RIGHT + EDIT_BODY_PADDING_LEFT; var iframePadTop = EDIT_BODY_PADDING_TOP; @@ -1111,7 +1106,7 @@ function OUTER(gscope) { hasLineNumbers = !! value; // disable line numbers on mobile devices - if(isAndroid || isMobileSafari) hasLineNumbers = false; + if (mobile.browser) hasLineNumbers = false; setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers); fixView(); } diff --git a/static/js/chat.js b/static/js/chat.js index 4dade69f..5cae5919 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -22,9 +22,6 @@ var chat = (function() { - var ua = navigator.userAgent.toLowerCase(); - var isAndroid = ua.indexOf("android") > -1; - var isMobileSafari = ua.indexOf("mobile") > -1; var bottomMargin = "0px"; var sDuration = 500; var hDuration = 750; @@ -57,7 +54,7 @@ var chat = (function() { $("#focusprotector").hide(); - if(isAndroid || isMobileSafari) + if(browser.mobile) bottommargin = "32px"; $("#chatbox").css({right: "20px", bottom: bottomMargin, left: "", top: ""});