Index: trunk/mockups/athena/index.html |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | <body> |
15 | 15 | |
16 | 16 | <div id="top" class="bar-wrapper"> |
17 | | - <div id="top-bar" class="bar"> |
| 17 | + <div id="top-bar" class="bar bar-float"> |
18 | 18 | <button class="button-main">Main</button> |
19 | 19 | <span class="search-box" class="stretch"> |
20 | 20 | <input class="search" placeholder="Search Wikipedia"> |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | <div id="page-content"></div> |
29 | 29 | |
30 | 30 | <div id="bottom" class="bar-wrapper"> |
31 | | - <div id="bottom-bar" class="bar"> |
| 31 | + <div id="bottom-bar" class="bar bar-float"> |
32 | 32 | <button class="button-article">Article</button> |
33 | 33 | <span class="detail stretch"> |
34 | 34 | <button class="button-history">History</button> |
Index: trunk/mockups/athena/athena.js |
— | — | @@ -81,8 +81,25 @@ |
82 | 82 | document.location = data.url; |
83 | 83 | } |
84 | 84 | }); |
| 85 | + |
| 86 | + // Fancy footwork to rebind a position-fixed footer bar when scrolling to bottom |
| 87 | + $(window).bind('scroll', function() { |
| 88 | + var viewportTop = $(document).scrollTop(), |
| 89 | + windowHeight = $(window).height(), |
| 90 | + viewportBottom = viewportTop + windowHeight, |
| 91 | + barHeight = $('#bottom-bar').height(), |
| 92 | + barTop = $('#bottom').position().top; |
| 93 | + |
| 94 | + if (viewportBottom - barHeight >= barTop) { |
| 95 | + $('#bottom-bar').addClass('inplace'); |
| 96 | + } else { |
| 97 | + $('#bottom-bar').removeClass('inplace'); |
| 98 | + } |
| 99 | + }); |
| 100 | + |
85 | 101 | $embed.bind('embed:resize', function(event, data) { |
86 | 102 | $embed.height(data.height); |
| 103 | + $(window).trigger('scroll'); |
87 | 104 | }); |
88 | 105 | $embed.bind('embed:click', function(event, data) { |
89 | 106 | // toggle the floating state |
— | — | @@ -118,50 +135,11 @@ |
119 | 136 | $('.bar').toggleClass('bar-float'); |
120 | 137 | }); |
121 | 138 | |
122 | | - // Fancy footwork to rebind a position-fixed footer bar when scrolling to bottom |
123 | | - $(window).bind('scroll', function() { |
124 | | - var viewportTop = $(document).scrollTop(), |
125 | | - windowHeight = $(window).height(), |
126 | | - viewportBottom = viewportTop + windowHeight, |
127 | | - barHeight = $('#bottom-bar').height(), |
128 | | - barTop = $('#bottom').position().top; |
129 | | - |
130 | | - if (viewportBottom - barHeight >= barTop) { |
131 | | - console.log('should unfix'); |
132 | | - $('#bottom-bar').addClass('inplace'); |
133 | | - } else { |
134 | | - $('#bottom-bar').removeClass('inplace'); |
135 | | - } |
136 | | - }); |
137 | | - |
138 | 139 | app.loadPage('While My Guitar Gently Weeps'); |
139 | 140 | }, |
140 | 141 | |
141 | 142 | loadPage: function(title) { |
142 | 143 | ui.startSpinner(); |
143 | | - /* |
144 | | - wiki.api({ |
145 | | - action: 'query', |
146 | | - prop: 'revisions', |
147 | | - titles: title, |
148 | | - rvprop: 'timestamp|content', |
149 | | - rvparse: 1 |
150 | | - }).then(function(data) { |
151 | | - console.log('page!', data); |
152 | | - var pageId, page; |
153 | | - $.each(data.query.pages, function() { |
154 | | - pageId = this.id; |
155 | | - page = this; |
156 | | - }); |
157 | | - var revId, rev; |
158 | | - $.each(page.revisions, function() { |
159 | | - revId = this.revid; |
160 | | - rev = this; |
161 | | - }); |
162 | | - ui.showPage(page.title, rev['*']); |
163 | | - ui.stopSpinner(); |
164 | | - }); |
165 | | - */ |
166 | 144 | embed.loadPage(title).then(function() { |
167 | 145 | ui.stopSpinner(); |
168 | 146 | }); |
Index: trunk/mockups/athena/frame-inner.js |
— | — | @@ -76,11 +76,15 @@ |
77 | 77 | |
78 | 78 | // Send generic unhandled taps up to parent |
79 | 79 | // May need to show/hide toolbars etc |
80 | | -document.addEventListener('click', function(event) { |
| 80 | +/* |
| 81 | +// doesn't trigger on generic background bits, haven't got it working with touch events yet |
| 82 | +// also triggers when clicking buttons and sections which is wrong! |
| 83 | +document.documentElement.addEventListener('click', function(event) { |
81 | 84 | messageParent({ |
82 | 85 | event: 'click' |
83 | 86 | }); |
84 | 87 | }, false); |
| 88 | +*/ |
85 | 89 | |
86 | 90 | })(); |
87 | 91 | |