properly disables line numbers on mobile devices (fix for #304 and #305)

pull/306/head
0ip 2011-12-31 17:46:10 +01:00
parent ddf1cd345c
commit a9a17e7360
1 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,11 @@ function OUTER(gscope)
var hasLineNumbers = true; var hasLineNumbers = true;
var isStyled = 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 // space around the innermost iframe element
var iframePadLeft = MIN_LINEDIV_WIDTH + LINE_NUMBER_PADDING_RIGHT + EDIT_BODY_PADDING_LEFT; var iframePadLeft = MIN_LINEDIV_WIDTH + LINE_NUMBER_PADDING_RIGHT + EDIT_BODY_PADDING_LEFT;
var iframePadTop = EDIT_BODY_PADDING_TOP; var iframePadTop = EDIT_BODY_PADDING_TOP;
@ -1105,6 +1110,8 @@ function OUTER(gscope)
else if (k == "showslinenumbers") else if (k == "showslinenumbers")
{ {
hasLineNumbers = !! value; hasLineNumbers = !! value;
// disable line numbers on mobile devices
if(isAndroid || isMobileSafari) hasLineNumbers = false;
setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers); setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers);
fixView(); fixView();
} }