Mercurial > repos > tabletprog
changeset 127:2b25d0ce2946
Add fullscreen support and improve experience on tablet browsers by tweaking button text size and disabling zooming.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 06 Aug 2013 00:06:41 -0700 |
parents | a2d2d8e09291 |
children | 5e34563f90ae |
files | editor.css editor.js index.html src/editor.tp |
diffstat | 4 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/editor.css Mon Aug 05 23:37:17 2013 -0700 +++ b/editor.css Tue Aug 06 00:06:41 2013 -0700 @@ -4,6 +4,7 @@ width: 100%; height: 100%; margin: 0; + background-color: white; } body > div @@ -120,6 +121,7 @@ margin: 4px; min-width: 9mm; min-height: 9mm; + text-size: 4mm; cursor: pointer; }
--- a/editor.js Mon Aug 05 23:37:17 2013 -0700 +++ b/editor.js Tue Aug 06 00:06:41 2013 -0700 @@ -201,3 +201,15 @@ to[idx] = val; return to; } + +function goFullScreen() +{ + var el = q('body'); + if (el.requestFullscreen) { + el.requestFullscreen(); + } else if (el.mozRequestFullScreen) { + el.mozRequestFullScreen(); + } else { + el.webkitRequestFullscreen(); + } +}
--- a/index.html Mon Aug 05 23:37:17 2013 -0700 +++ b/index.html Tue Aug 06 00:06:41 2013 -0700 @@ -12,11 +12,14 @@ <script src="/scripttags.js"></script> <script src="/src/editor.tp" type="text/tabletprog"></script> <link rel="stylesheet" href="/editor.css"> + <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'> + </head> <body> <div id="browser"> <ul> </ul> + <input type="button" value="Go Fullscreen" id="fullscreen"> </div> <div id="editor"> <div class="controls">
--- a/src/editor.tp Mon Aug 05 23:37:17 2013 -0700 +++ b/src/editor.tp Tue Aug 06 00:06:41 2013 -0700 @@ -7,9 +7,12 @@ removeClass <- foreign: :node className {} hasClass <- foreign: :node className {} get <- foreign: :url onSuccess onFail onOther {} +newEl <- foreign: :tagname props {} + +//editor.js functions getEl <- foreign: :from idx {} setEl <- foreign: :to idx val {} -newEl <- foreign: :tagname props {} +goFullScreen <- foreign: {} //TP Parser parser <- foreign: #{ @@ -26,9 +29,6 @@ keys <- foreign: :object {} } -//kernel definitions -//import: kernel - filter <- :arr pred { output <- arr slice: 0 0 each: arr :idx el { @@ -325,6 +325,9 @@ if: (path indexOf: "/edit/") = 0 { editFile: (path substr: 5) } + (q: "#fullscreen") onclick!: :event { + goFullScreen: + } } }