Merge pull request #306 from 0ip/patch-7

Disables line numbers on mobile devices (fix for #304 and #305)
This commit is contained in:
John McLear 2012-01-08 06:49:56 -08:00
commit 7232dff6db
2 changed files with 10 additions and 8 deletions

View File

@ -1178,7 +1178,7 @@ label[for=readonlyinput] {
} }
} }
@media only screen and (min-device-width: 320px) and (max-device-width: 600px) { @media only screen and (min-device-width: 320px) and (max-device-width: 720px) {
#editbar ul li { #editbar ul li {
padding: 4px 3px; padding: 4px 3px;
} }
@ -1190,12 +1190,10 @@ label[for=readonlyinput] {
opacity: .8; opacity: .8;
} }
#users { #users {
right: none; right: 4px;
left: 30px;
} }
#mycolorpicker { #mycolorpicker {
right: 0; left: -72px; /* #mycolorpicker:width - #users:width */
left: 0 !important;
} }
#editorcontainer { #editorcontainer {
margin-bottom: 33px; margin-bottom: 33px;
@ -1246,9 +1244,6 @@ label[for=readonlyinput] {
#usericonback { #usericonback {
margin-top: 4px; margin-top: 4px;
} }
#sidediv {
display:none;
}
} }
.rtl{ .rtl{
direction:RTL; direction:RTL;

View File

@ -85,6 +85,11 @@ function OUTER(gscope)
var doesWrap = true; var doesWrap = true;
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;
@ -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();
} }