Index: trunk/mockups/athena/README |
— | — | @@ -1 +1,35 @@ |
2 | 2 | See https://www.mediawiki.org/wiki/Athena |
| 3 | + |
| 4 | + |
| 5 | +Implementation notes on this mockup: |
| 6 | + |
| 7 | +== Data source == |
| 8 | + |
| 9 | +Pages are loaded in an <iframe> from http://en.wikipedia.org using ?useformat=mobile. |
| 10 | +They are currently loaded through a local .php proxy which hides the mobile-view header/footer and injects a script to modify behavior to cooperate with the parent frame. |
| 11 | + |
| 12 | +This frame embedding (using HTML5 postMessage) style, if integrated into the regular raw views, could make it easier for mockups and alternate UI tools to hook in without modification in future, without exposing direct XSS vectors between the two sides... |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +== Screen size == |
| 17 | + |
| 18 | +CSS media queries are used to check the screen. If 640px or wider, we enable the 'tablet' mode with wider buttons, more visible entries on the top bar. |
| 19 | + |
| 20 | +If smaller, we use the 'mobile' mode with more compact buttons, things folded etc. |
| 21 | + |
| 22 | + |
| 23 | +== Scrolling == |
| 24 | + |
| 25 | +The embedding iframe is sized to match its content, so the outer document as a whole scrolls. |
| 26 | + |
| 27 | +Top & bottom toolbars float using position: fixed (warning: limited browser support!), with |
| 28 | +automatic switching to inline in the page layout when you reach the footer. |
| 29 | + |
| 30 | + |
| 31 | +== Known issues == |
| 32 | + |
| 33 | +* position: fixed elements don't work on iOS 4.3 (ok on 5.0) |
| 34 | +* on iOS, bottom bar doesn't switch between position:fixed and inline in the footer during scrolling; event isn't called until scroll finishes |
| 35 | +* hash links like references and 'jump back a section' don't appear to be working |
| 36 | + |
Index: trunk/mockups/athena/frame-inner.js |
— | — | @@ -38,12 +38,18 @@ |
39 | 39 | window.addEventListener('click', function(event) { |
40 | 40 | var target = event.target; |
41 | 41 | if (target.nodeName.toLowerCase() == 'a') { |
42 | | - event.stopPropagation(); |
43 | | - event.preventDefault(); |
44 | | - messageParent({ |
45 | | - event: 'navigate', |
46 | | - url: target.getAttribute('href') |
47 | | - }); |
| 42 | + var href = target.getAttribute('href'); |
| 43 | + if (href.substr(0, 1) == '#') { |
| 44 | + // Allow local #hashlinks |
| 45 | + } else { |
| 46 | + // Send any actual |
| 47 | + event.stopPropagation(); |
| 48 | + event.preventDefault(); |
| 49 | + messageParent({ |
| 50 | + event: 'navigate', |
| 51 | + url: href |
| 52 | + }); |
| 53 | + } |
48 | 54 | } |
49 | 55 | }, true ); |
50 | 56 | |