From a9a17e7360bc8047c9c95d26d5e5171f6e63e2cc Mon Sep 17 00:00:00 2001 From: 0ip Date: Sat, 31 Dec 2011 17:46:10 +0100 Subject: [PATCH] properly disables line numbers on mobile devices (fix for #304 and #305) --- static/js/ace2_inner.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 65f8ec7e7..a2abbf6e4 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -85,6 +85,11 @@ function OUTER(gscope) var doesWrap = true; 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; @@ -1105,6 +1110,8 @@ function OUTER(gscope) else if (k == "showslinenumbers") { hasLineNumbers = !! value; + // disable line numbers on mobile devices + if(isAndroid || isMobileSafari) hasLineNumbers = false; setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers); fixView(); }