Skip to content
This repository
Browse code

status commit: styling overhaul

Changing to use LESScss and be pretty.

Per discussion with jrburke, losing iscroll.js in favor of using webkit's
built-in scrolling magic.
  • Loading branch information...
commit f2244e16823f94fca7c74991592b9ceb79d7a38f 1 parent a4e3154
Andrew Sutherland asutherland authored
8 clients/deps/cardsHeader.html
... ... @@ -1,8 +1,8 @@
1   -<div id="header" class="hbox">
2   - <button id="back">Back</button>
  1 +<div class="THEheader hbox">
  2 + <button class="THEback">Back</button>
3 3 <div class="boxFlex">
4   - <h1 id="headerText" class="overflow">Deuxdrop</h1>
  4 + <h1 class="THEheaderText overflow">Deuxdrop</h1>
5 5 </div>
6 6 <button class="next invisible">Info</button>
7 7 </div>
8   -<a id="notify" data-nonav="nonav">!</a>
  8 +<a class="THEnotify" data-nonav="nonav">!</a>
10 clients/deps/iscroll.README
... ... @@ -1,10 +0,0 @@
1   -iscroll was modified to fix an error on first inclusion, and to allow
2   -clicks into text area/form inputs to work.
3   -
4   -The text input fix was done looking at this pull request for iscroll:
5   -https://github.com/cubiq/iscroll/pull/38/files
6   -
7   -The change was put into the default implementation for onBeforeScrollStart.
8   -
9   -I forgot the other change I did for the startup error, do a diff against
10   -a stock 4.1.5 version of iscroll.
1,000 clients/deps/iscroll.js
... ... @@ -1,1000 +0,0 @@
1   -/*!
2   - * iScroll v4.1.5 ~ Copyright (c) 2011 Matteo Spinelli, http://cubiq.org
3   - * Released under MIT license, http://cubiq.org/license
4   - */
5   -
6   -(function(){
7   -var m = Math,
8   - vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
9   - (/firefox/i).test(navigator.userAgent) ? 'Moz' :
10   - 'opera' in window ? 'O' : '',
11   -
12   - // Browser capabilities
13   - has3d = 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(),
14   - hasTouch = 'ontouchstart' in window,
15   - hasTransform = vendor + 'Transform' in document.documentElement.style,
16   - isAndroid = (/android/gi).test(navigator.appVersion),
17   - isIDevice = (/iphone|ipad/gi).test(navigator.appVersion),
18   - isPlaybook = (/playbook/gi).test(navigator.appVersion),
19   - hasTransitionEnd = isIDevice || isPlaybook,
20   - nextFrame = (function() {
21   - return window.requestAnimationFrame
22   - || window.webkitRequestAnimationFrame
23   - || window.mozRequestAnimationFrame
24   - || window.oRequestAnimationFrame
25   - || window.msRequestAnimationFrame
26   - || function(callback) { return setTimeout(callback, 17); }
27   - })(),
28   - cancelFrame = (function () {
29   - return window.cancelRequestAnimationFrame
30   - || window.webkitCancelRequestAnimationFrame
31   - || window.mozCancelRequestAnimationFrame
32   - || window.oCancelRequestAnimationFrame
33   - || window.msCancelRequestAnimationFrame
34   - || clearTimeout
35   - })(),
36   -
37   - // Events
38   - RESIZE_EV = 'onorientationchange' in window ? 'orientationchange' : 'resize',
39   - START_EV = hasTouch ? 'touchstart' : 'mousedown',
40   - MOVE_EV = hasTouch ? 'touchmove' : 'mousemove',
41   - END_EV = hasTouch ? 'touchend' : 'mouseup',
42   - CANCEL_EV = hasTouch ? 'touchcancel' : 'mouseup',
43   - WHEEL_EV = vendor == 'Moz' ? 'DOMMouseScroll' : 'mousewheel',
44   -
45   - // Helpers
46   - trnOpen = 'translate' + (has3d ? '3d(' : '('),
47   - trnClose = has3d ? ',0)' : ')',
48   -
49   - // Constructor
50   - iScroll = function (el, options) {
51   - var that = this,
52   - doc = document,
53   - i;
54   -
55   - that.wrapper = typeof el != 'string' ? el : doc.getElementById(el);
56   - that.wrapper.style.overflow = 'hidden';
57   - that.scroller = that.wrapper.children[0];
58   -
59   - // Default options
60   - that.options = {
61   - hScroll: true,
62   - vScroll: true,
63   - bounce: true,
64   - bounceLock: false,
65   - momentum: true,
66   - lockDirection: true,
67   - useTransform: true,
68   - useTransition: false,
69   - checkDOMChanges: false, // Experimental
70   -
71   - // Scrollbar
72   - hScrollbar: true,
73   - vScrollbar: true,
74   - fixedScrollbar: isAndroid,
75   - hideScrollbar: isIDevice,
76   - fadeScrollbar: isIDevice && has3d,
77   - scrollbarClass: '',
78   -
79   - // Zoom
80   - zoom: false,
81   - zoomMin: 1,
82   - zoomMax: 4,
83   - doubleTapZoom: 2,
84   -
85   - // Snap
86   - snap: false,
87   - snapThreshold: 1,
88   -
89   - // Events
90   - onRefresh: null,
91   - onBeforeScrollStart: function (e) {
92   -
93   - if ( e.target.tagName == "SELECT" || e.target.tagName == "INPUT"
94   - || e.target.tagName == "BUTTON" || e.target.tagName == "TEXTAREA") {
95   - return true;
96   - }
97   -
98   - e.preventDefault();
99   - },
100   - onScrollStart: null,
101   - onBeforeScrollMove: null,
102   - onScrollMove: null,
103   - onBeforeScrollEnd: null,
104   - onScrollEnd: null,
105   - onTouchEnd: null,
106   - onDestroy: null,
107   - onZoomStart: null,
108   - onZoom: null,
109   - onZoomEnd: null
110   - };
111   -
112   - // User defined options
113   - for (i in options) that.options[i] = options[i];
114   -
115   - // Normalize options
116   - that.options.useTransform = hasTransform ? that.options.useTransform : false;
117   - that.options.hScrollbar = that.options.hScroll && that.options.hScrollbar;
118   - that.options.vScrollbar = that.options.vScroll && that.options.vScrollbar;
119   - that.options.zoom = that.options.useTransform && that.options.zoom;
120   - that.options.useTransition = hasTransitionEnd && that.options.useTransition;
121   -
122   - // Set some default styles
123   - that.scroller.style[vendor + 'TransitionProperty'] = that.options.useTransform ? '-' + vendor.toLowerCase() + '-transform' : 'top left';
124   - that.scroller.style[vendor + 'TransitionDuration'] = '0';
125   - that.scroller.style[vendor + 'TransformOrigin'] = '0 0';
126   - if (that.options.useTransition) that.scroller.style[vendor + 'TransitionTimingFunction'] = 'cubic-bezier(0.33,0.66,0.66,1)';
127   -
128   - if (that.options.useTransform) that.scroller.style[vendor + 'Transform'] = trnOpen + '0,0' + trnClose;
129   - else that.scroller.style.cssText += ';top:0;left:0';
130   -
131   - if (that.options.useTransition) that.options.fixedScrollbar = true;
132   -
133   - that.refresh();
134   -
135   - that._bind(RESIZE_EV, window);
136   - that._bind(START_EV);
137   - if (!hasTouch) {
138   - that._bind('mouseout', that.wrapper);
139   - that._bind(WHEEL_EV);
140   - }
141   -
142   - if (that.options.checkDOMChanges) that.checkDOMTime = setInterval(function () {
143   - that._checkDOMChanges()
144   - }, 500);
145   - };
146   -
147   -// Prototype
148   -iScroll.prototype = {
149   - enabled: true,
150   - x: 0,
151   - y: 0,
152   - steps: [],
153   - scale: 1,
154   - currPageX: 0, currPageY: 0,
155   - pagesX: [], pagesY: [],
156   - aniTime: null,
157   -
158   - handleEvent: function (e) {
159   - var that = this;
160   - switch(e.type) {
161   - case START_EV: that._start(e); break;
162   - case MOVE_EV: that._move(e); break;
163   - case END_EV:
164   - case CANCEL_EV: that._end(e); break;
165   - case RESIZE_EV: that._resize(); break;
166   - case WHEEL_EV: that._wheel(e); break;
167   - case 'mouseout': that._mouseout(e); break;
168   - case 'webkitTransitionEnd': that._transitionEnd(e); break;
169   - }
170   - },
171   -
172   - _checkDOMChanges: function () {
173   - if (this.moved || this.zoomed || this.animating ||
174   - (this.scrollerW == this.scroller.offsetWidth * this.scale && this.scrollerH == this.scroller.offsetHeight * this.scale)) return;
175   -
176   - this.refresh();
177   - },
178   -
179   - _scrollbar: function (dir) {
180   - var that = this,
181   - doc = document,
182   - bar;
183   -
184   - if (!that[dir + 'Scrollbar']) {
185   - if (that[dir + 'ScrollbarWrapper']) {
186   - if (hasTransform) that[dir + 'ScrollbarIndicator'].style[vendor + 'Transform'] = '';
187   - that[dir + 'ScrollbarWrapper'].parentNode.removeChild(that[dir + 'ScrollbarWrapper']);
188   - that[dir + 'ScrollbarWrapper'] = null;
189   - that[dir + 'ScrollbarIndicator'] = null;
190   - }
191   -
192   - return;
193   - }
194   -
195   - if (!that[dir + 'ScrollbarWrapper']) {
196   - // Create the scrollbar wrapper
197   - bar = doc.createElement('div');
198   -
199   - if (that.options.scrollbarClass) bar.className = that.options.scrollbarClass + dir.toUpperCase();
200   - else bar.style.cssText = 'position:absolute;z-index:100;' + (dir == 'h' ? 'height:7px;bottom:1px;left:2px;right:' + (that.vScrollbar ? '7' : '2') + 'px' : 'width:7px;bottom:' + (that.hScrollbar ? '7' : '2') + 'px;top:2px;right:1px');
201   -
202   - bar.style.cssText += ';pointer-events:none;-' + vendor + '-transition-property:opacity;-' + vendor + '-transition-duration:' + (that.options.fadeScrollbar ? '350ms' : '0') + ';overflow:hidden;opacity:' + (that.options.hideScrollbar ? '0' : '1');
203   -
204   - that.wrapper.appendChild(bar);
205   - that[dir + 'ScrollbarWrapper'] = bar;
206   -
207   - // Create the scrollbar indicator
208   - bar = doc.createElement('div');
209   - if (!that.options.scrollbarClass) {
210   - bar.style.cssText = 'position:absolute;z-index:100;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);-' + vendor + '-background-clip:padding-box;-' + vendor + '-box-sizing:border-box;' + (dir == 'h' ? 'height:100%' : 'width:100%') + ';-' + vendor + '-border-radius:3px;border-radius:3px';
211   - }
212   - bar.style.cssText += ';pointer-events:none;-' + vendor + '-transition-property:-' + vendor + '-transform;-' + vendor + '-transition-timing-function:cubic-bezier(0.33,0.66,0.66,1);-' + vendor + '-transition-duration:0;-' + vendor + '-transform:' + trnOpen + '0,0' + trnClose;
213   - if (that.options.useTransition) bar.style.cssText += ';-' + vendor + '-transition-timing-function:cubic-bezier(0.33,0.66,0.66,1)';
214   -
215   - that[dir + 'ScrollbarWrapper'].appendChild(bar);
216   - that[dir + 'ScrollbarIndicator'] = bar;
217   - }
218   -
219   - if (dir == 'h') {
220   - that.hScrollbarSize = that.hScrollbarWrapper.clientWidth;
221   - that.hScrollbarIndicatorSize = m.max(m.round(that.hScrollbarSize * that.hScrollbarSize / that.scrollerW), 8);
222   - that.hScrollbarIndicator.style.width = that.hScrollbarIndicatorSize + 'px';
223   - that.hScrollbarMaxScroll = that.hScrollbarSize - that.hScrollbarIndicatorSize;
224   - that.hScrollbarProp = that.hScrollbarMaxScroll / that.maxScrollX;
225   - } else {
226   - that.vScrollbarSize = that.vScrollbarWrapper.clientHeight;
227   - that.vScrollbarIndicatorSize = m.max(m.round(that.vScrollbarSize * that.vScrollbarSize / that.scrollerH), 8);
228   - that.vScrollbarIndicator.style.height = that.vScrollbarIndicatorSize + 'px';
229   - that.vScrollbarMaxScroll = that.vScrollbarSize - that.vScrollbarIndicatorSize;
230   - that.vScrollbarProp = that.vScrollbarMaxScroll / that.maxScrollY;
231   - }
232   -
233   - // Reset position
234   - that._scrollbarPos(dir, true);
235   - },
236   -
237   - _resize: function () {
238   - this.refresh();
239   - },
240   -
241   - _pos: function (x, y) {
242   - x = this.hScroll ? x : 0;
243   - y = this.vScroll ? y : 0;
244   -
245   - if (this.options.useTransform) {
246   - this.scroller.style[vendor + 'Transform'] = trnOpen + x + 'px,' + y + 'px' + trnClose + ' scale(' + this.scale + ')';
247   - } else {
248   - x = m.round(x);
249   - y = m.round(y);
250   - this.scroller.style.left = x + 'px';
251   - this.scroller.style.top = y + 'px';
252   - }
253   -
254   - this.x = x;
255   - this.y = y;
256   -
257   - this._scrollbarPos('h');
258   - this._scrollbarPos('v');
259   - },
260   -
261   - _scrollbarPos: function (dir, hidden) {
262   - var that = this,
263   - pos = dir == 'h' ? that.x : that.y,
264   - size;
265   -
266   - if (!that[dir + 'Scrollbar']) return;
267   -
268   - pos = that[dir + 'ScrollbarProp'] * pos;
269   -
270   - if (pos < 0) {
271   - if (!that.options.fixedScrollbar) {
272   - size = that[dir + 'ScrollbarIndicatorSize'] + m.round(pos * 3);
273   - if (size < 8) size = 8;
274   - that[dir + 'ScrollbarIndicator'].style[dir == 'h' ? 'width' : 'height'] = size + 'px';
275   - }
276   - pos = 0;
277   - } else if (pos > that[dir + 'ScrollbarMaxScroll']) {
278   - if (!that.options.fixedScrollbar) {
279   - size = that[dir + 'ScrollbarIndicatorSize'] - m.round((pos - that[dir + 'ScrollbarMaxScroll']) * 3);
280   - if (size < 8) size = 8;
281   - that[dir + 'ScrollbarIndicator'].style[dir == 'h' ? 'width' : 'height'] = size + 'px';
282   - pos = that[dir + 'ScrollbarMaxScroll'] + (that[dir + 'ScrollbarIndicatorSize'] - size);
283   - } else {
284   - pos = that[dir + 'ScrollbarMaxScroll'];
285   - }
286   - }
287   -
288   - that[dir + 'ScrollbarWrapper'].style[vendor + 'TransitionDelay'] = '0';
289   - that[dir + 'ScrollbarWrapper'].style.opacity = hidden && that.options.hideScrollbar ? '0' : '1';
290   - that[dir + 'ScrollbarIndicator'].style[vendor + 'Transform'] = trnOpen + (dir == 'h' ? pos + 'px,0' : '0,' + pos + 'px') + trnClose;
291   - },
292   -
293   - _start: function (e) {
294   - var that = this,
295   - point = hasTouch ? e.touches[0] : e,
296   - matrix, x, y,
297   - c1, c2, target;
298   -
299   - if (!that.enabled) return;
300   -
301   - if (that.options.onBeforeScrollStart) that.options.onBeforeScrollStart.call(that, e);
302   -
303   - if (that.options.useTransition) that._transitionTime(0);
304   -
305   - that.moved = false;
306   - that.animating = false;
307   - that.zoomed = false;
308   - that.distX = 0;
309   - that.distY = 0;
310   - that.absDistX = 0;
311   - that.absDistY = 0;
312   - that.dirX = 0;
313   - that.dirY = 0;
314   -
315   - // Gesture start
316   - if (that.options.zoom && hasTouch && e.touches.length > 1) {
317   - c1 = m.abs(e.touches[0].pageX-e.touches[1].pageX);
318   - c2 = m.abs(e.touches[0].pageY-e.touches[1].pageY);
319   - that.touchesDistStart = m.sqrt(c1 * c1 + c2 * c2);
320   -
321   - that.originX = m.abs(e.touches[0].pageX + e.touches[1].pageX - that.wrapperOffsetLeft * 2) / 2 - that.x;
322   - that.originY = m.abs(e.touches[0].pageY + e.touches[1].pageY - that.wrapperOffsetTop * 2) / 2 - that.y;
323   -
324   - if (that.options.onZoomStart) that.options.onZoomStart.call(that, e);
325   - }
326   -
327   - if (that.options.momentum) {
328   - if (that.options.useTransform) {
329   - // Very lame general purpose alternative to CSSMatrix
330   - matrix = getComputedStyle(that.scroller, null)[vendor + 'Transform'].replace(/[^0-9-.,]/g, '').split(',');
331   - x = matrix[4] * 1;
332   - y = matrix[5] * 1;
333   - } else {
334   - x = getComputedStyle(that.scroller, null).left.replace(/[^0-9-]/g, '') * 1;
335   - y = getComputedStyle(that.scroller, null).top.replace(/[^0-9-]/g, '') * 1;
336   - }
337   -
338   - if (x != that.x || y != that.y) {
339   - if (that.options.useTransition) that._unbind('webkitTransitionEnd');
340   - else cancelFrame(that.aniTime);
341   - that.steps = [];
342   - that._pos(x, y);
343   - }
344   - }
345   -
346   - that.absStartX = that.x; // Needed by snap threshold
347   - that.absStartY = that.y;
348   -
349   - that.startX = that.x;
350   - that.startY = that.y;
351   - that.pointX = point.pageX;
352   - that.pointY = point.pageY;
353   -
354   - that.startTime = e.timeStamp || (new Date()).getTime();
355   -
356   - if (that.options.onScrollStart) that.options.onScrollStart.call(that, e);
357   -
358   - that._bind(MOVE_EV);
359   - that._bind(END_EV);
360   - that._bind(CANCEL_EV);
361   - },
362   -
363   - _move: function (e) {
364   - var that = this,
365   - point = hasTouch ? e.touches[0] : e,
366   - deltaX = point.pageX - that.pointX,
367   - deltaY = point.pageY - that.pointY,
368   - newX = that.x + deltaX,
369   - newY = that.y + deltaY,
370   - c1, c2, scale,
371   - timestamp = e.timeStamp || (new Date()).getTime();
372   -
373   - if (that.options.onBeforeScrollMove) that.options.onBeforeScrollMove.call(that, e);
374   -
375   - // Zoom
376   - if (that.options.zoom && hasTouch && e.touches.length > 1) {
377   - c1 = m.abs(e.touches[0].pageX - e.touches[1].pageX);
378   - c2 = m.abs(e.touches[0].pageY - e.touches[1].pageY);
379   - that.touchesDist = m.sqrt(c1*c1+c2*c2);
380   -
381   - that.zoomed = true;
382   -
383   - scale = 1 / that.touchesDistStart * that.touchesDist * this.scale;
384   - if (scale < 0.5) scale = 0.5;
385   - else if (scale > that.options.zoomMax) scale = that.options.zoomMax;
386   - that.lastScale = scale / this.scale;
387   -
388   - newX = this.originX - this.originX * that.lastScale + this.x,
389   - newY = this.originY - this.originY * that.lastScale + this.y;
390   -
391   - this.scroller.style[vendor + 'Transform'] = trnOpen + newX + 'px,' + newY + 'px' + trnClose + ' scale(' + scale + ')';
392   -
393   - if (that.options.onZoom) that.options.onZoom.call(that, e);
394   - return;
395   - }
396   -
397   - that.pointX = point.pageX;
398   - that.pointY = point.pageY;
399   -
400   - // Slow down if outside of the boundaries
401   - if (newX > 0 || newX < that.maxScrollX) {
402   - newX = that.options.bounce ? that.x + (deltaX / 2) : newX >= 0 || that.maxScrollX >= 0 ? 0 : that.maxScrollX;
403   - }
404   - if (newY > 0 || newY < that.maxScrollY) {
405   - newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= 0 || that.maxScrollY >= 0 ? 0 : that.maxScrollY;
406   - }
407   -
408   - if (that.absDistX < 6 && that.absDistY < 6) {
409   - that.distX += deltaX;
410   - that.distY += deltaY;
411   - that.absDistX = m.abs(that.distX);
412   - that.absDistY = m.abs(that.distY);
413   -
414   - return;
415   - }
416   -
417   - // Lock direction
418   - if (that.options.lockDirection) {
419   - if (that.absDistX > that.absDistY + 5) {
420   - newY = that.y;
421   - deltaY = 0;
422   - } else if (that.absDistY > that.absDistX + 5) {
423   - newX = that.x;
424   - deltaX = 0;
425   - }
426   - }
427   -
428   - that.moved = true;
429   - that._pos(newX, newY);
430   - that.dirX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
431   - that.dirY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
432   -
433   - if (timestamp - that.startTime > 300) {
434   - that.startTime = timestamp;
435   - that.startX = that.x;
436   - that.startY = that.y;
437   - }
438   -
439   - if (that.options.onScrollMove) that.options.onScrollMove.call(that, e);
440   - },
441   -
442   - _end: function (e) {
443   - if (hasTouch && e.touches.length != 0) return;
444   -
445   - var that = this,
446   - point = hasTouch ? e.changedTouches[0] : e,
447   - target, ev,
448   - momentumX = { dist:0, time:0 },
449   - momentumY = { dist:0, time:0 },
450   - duration = (e.timeStamp || (new Date()).getTime()) - that.startTime,
451   - newPosX = that.x,
452   - newPosY = that.y,
453   - distX, distY,
454   - newDuration;
455   -
456   - that._unbind(MOVE_EV);
457   - that._unbind(END_EV);
458   - that._unbind(CANCEL_EV);
459   -
460   - if (that.options.onBeforeScrollEnd) that.options.onBeforeScrollEnd.call(that, e);
461   -
462   -
463   -
464   - if (that.zoomed) {
465   - that.scale = that.scale * that.lastScale;
466   - that.x = that.originX - that.originX * that.lastScale + that.x;
467   - that.y = that.originY - that.originY * that.lastScale + that.y;
468   -
469   - that.scroller.style.webkitTransform = trnOpen + that.x + 'px,' + that.y + 'px' + trnClose + ' scale(' + that.scale + ')';
470   -
471   - that.refresh();
472   -
473   - if (that.options.onZoomEnd) that.options.onZoomEnd.call(that, e);
474   - return;
475   - }
476   -
477   - if (!that.moved) {
478   - if (hasTouch) {
479   - if (that.doubleTapTimer && that.options.zoom) {
480   - // Double tapped
481   - clearTimeout(that.doubleTapTimer);
482   - that.doubleTapTimer = null;
483   - that.zoom(that.pointX, that.pointY, that.scale == 1 ? that.options.doubleTapZoom : 1);
484   - } else {
485   - that.doubleTapTimer = setTimeout(function () {
486   - that.doubleTapTimer = null;
487   -
488   - // Find the last touched element
489   - target = point.target;
490   - while (target.nodeType != 1) target = target.parentNode;
491   -
492   - if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
493   - ev = document.createEvent('MouseEvents');
494   - ev.initMouseEvent('click', true, true, e.view, 1,
495   - point.screenX, point.screenY, point.clientX, point.clientY,
496   - e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
497   - 0, null);
498   - ev._fake = true;
499   - target.dispatchEvent(ev);
500   - }
501   - }, that.options.zoom ? 250 : 0);
502   - }
503   - }
504   -
505   - that._resetPos(200);
506   -
507   - if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
508   - return;
509   - }
510   -
511   - if (duration < 300 && that.options.momentum) {
512   - momentumX = newPosX ? that._momentum(newPosX - that.startX, duration, -that.x, that.scrollerW - that.wrapperW + that.x, that.options.bounce ? that.wrapperW : 0) : momentumX;
513   - momentumY = newPosY ? that._momentum(newPosY - that.startY, duration, -that.y, (that.maxScrollY < 0 ? that.scrollerH - that.wrapperH + that.y : 0), that.options.bounce ? that.wrapperH : 0) : momentumY;
514   -
515   - newPosX = that.x + momentumX.dist;
516   - newPosY = that.y + momentumY.dist;
517   -
518   - if ((that.x > 0 && newPosX > 0) || (that.x < that.maxScrollX && newPosX < that.maxScrollX)) momentumX = { dist:0, time:0 };
519   - if ((that.y > 0 && newPosY > 0) || (that.y < that.maxScrollY && newPosY < that.maxScrollY)) momentumY = { dist:0, time:0 };
520   - }
521   -
522   - if (momentumX.dist || momentumY.dist) {
523   - newDuration = m.max(m.max(momentumX.time, momentumY.time), 10);
524   -
525   - // Do we need to snap?
526   - if (that.options.snap) {
527   - distX = newPosX - that.absStartX;
528   - distY = newPosY - that.absStartY;
529   - if (m.abs(distX) < that.options.snapThreshold && m.abs(distY) < that.options.snapThreshold) { that.scrollTo(that.absStartX, that.absStartY, 200); }
530   - else {
531   - snap = that._snap(newPosX, newPosY);
532   - newPosX = snap.x;
533   - newPosY = snap.y;
534   - newDuration = m.max(snap.time, newDuration);
535   - }
536   - }
537   -
538   - that.scrollTo(newPosX, newPosY, newDuration);
539   -
540   - if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
541   - return;
542   - }
543   -
544   - // Do we need to snap?
545   - if (that.options.snap) {
546   - distX = newPosX - that.absStartX;
547   - distY = newPosY - that.absStartY;
548   - if (m.abs(distX) < that.options.snapThreshold && m.abs(distY) < that.options.snapThreshold) that.scrollTo(that.absStartX, that.absStartY, 200);
549   - else {
550   - snap = that._snap(that.x, that.y);
551   - if (snap.x != that.x || snap.y != that.y) that.scrollTo(snap.x, snap.y, snap.time);
552   - }
553   -
554   - if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
555   - return;
556   - }
557   -
558   - that._resetPos(200);
559   - if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
560   - },
561   -
562   - _resetPos: function (time) {
563   - var that = this,
564   - resetX = that.x >= 0 ? 0 : that.x < that.maxScrollX ? that.maxScrollX : that.x,
565   - resetY = that.y >= 0 || that.maxScrollY > 0 ? 0 : that.y < that.maxScrollY ? that.maxScrollY : that.y;
566   -
567   - if (resetX == that.x && resetY == that.y) {
568   - if (that.moved) {
569   - that.moved = false;
570   - if (that.options.onScrollEnd) that.options.onScrollEnd.call(that); // Execute custom code on scroll end
571   - }
572   -
573   - if (that.hScrollbar && that.options.hideScrollbar) {
574   - if (vendor == 'webkit') that.hScrollbarWrapper.style[vendor + 'TransitionDelay'] = '300ms';
575   - that.hScrollbarWrapper.style.opacity = '0';
576   - }
577   - if (that.vScrollbar && that.options.hideScrollbar) {
578   - if (vendor == 'webkit') that.vScrollbarWrapper.style[vendor + 'TransitionDelay'] = '300ms';
579   - that.vScrollbarWrapper.style.opacity = '0';
580   - }
581   -
582   - return;
583   - }
584   -
585   - that.scrollTo(resetX, resetY, time || 0);
586   - },
587   -
588   - _wheel: function (e) {
589   - var that = this,
590   - deltaX, deltaY;
591   -
592   - if ('wheelDeltaX' in e) {
593   - deltaX = that.x + e.wheelDeltaX / 12,
594   - deltaY = that.y + e.wheelDeltaY / 12;
595   - } else if ('detail' in e) {
596   - deltaX = that.x - e.detail * 3,
597   - deltaY = that.y - e.detail * 3;
598   - } else {
599   - deltaX = that.x - e.wheelDelta,
600   - deltaY = that.y - e.wheelDelta;
601   - }
602   -
603   - if (deltaX > 0) deltaX = 0;
604   - else if (deltaX < that.maxScrollX) deltaX = that.maxScrollX;
605   -
606   - if (deltaY > 0) deltaY = 0;
607   - else if (deltaY < that.maxScrollY) deltaY = that.maxScrollY;
608   -
609   - that.scrollTo(deltaX, deltaY, 0);
610   - },
611   -
612   - _mouseout: function (e) {
613   - var t = e.relatedTarget;
614   -
615   - if (!t) {
616   - this._end(e);
617   - return;
618   - }
619   -
620   - while (t = t.parentNode) if (t == this.wrapper) return;
621   -
622   - this._end(e);
623   - },
624   -
625   - _transitionEnd: function (e) {
626   - var that = this;
627   -
628   - if (e.target != that.scroller) return;
629   -
630   - that._unbind('webkitTransitionEnd');
631   -
632   - that._startAni();
633   - },
634   -
635   -
636   - /**
637   - *
638   - * Utilities
639   - *
640   - */
641   - _startAni: function () {
642   - var that = this,
643   - startX = that.x, startY = that.y,
644   - startTime = (new Date).getTime(),
645   - step, easeOut;
646   -
647   - if (that.animating) return;
648   -
649   - if (!that.steps.length) {
650   - that._resetPos(400);
651   - return;
652   - }
653   -
654   - step = that.steps.shift();
655   -
656   - if (step.x == startX && step.y == startY) step.time = 0;
657   -
658   - that.animating = true;
659   - that.moved = true;
660   -
661   - if (that.options.useTransition) {
662   - that._transitionTime(step.time);
663   - that._pos(step.x, step.y);
664   - that.animating = false;
665   - if (step.time) that._bind('webkitTransitionEnd');
666   - else that._resetPos(0);
667   - return;
668   - }
669   -
670   - (function animate () {
671   - var now = (new Date).getTime(),
672   - newX, newY;
673   -
674   - if (now >= startTime + step.time) {
675   - that._pos(step.x, step.y);
676   - that.animating = false;
677   - if (that.options.onAnimationEnd) that.options.onAnimationEnd.call(that); // Execute custom code on animation end
678   - that._startAni();
679   - return;
680   - }
681   -
682   - now = (now - startTime) / step.time - 1;
683   - easeOut = m.sqrt(1 - now * now);
684   - newX = (step.x - startX) * easeOut + startX;
685   - newY = (step.y - startY) * easeOut + startY;
686   - that._pos(newX, newY);
687   - if (that.animating) that.aniTime = nextFrame(animate);
688   - })();
689   - },
690   -
691   - _transitionTime: function (time) {
692   - time += 'ms';
693   - this.scroller.style[vendor + 'TransitionDuration'] = time;
694   - if (this.hScrollbar) this.hScrollbarIndicator.style[vendor + 'TransitionDuration'] = time;
695   - if (this.vScrollbar) this.vScrollbarIndicator.style[vendor + 'TransitionDuration'] = time;
696   - },
697   -
698   - _momentum: function (dist, time, maxDistUpper, maxDistLower, size) {
699   - var deceleration = 0.0006,
700   - speed = m.abs(dist) / time,
701   - newDist = (speed * speed) / (2 * deceleration),
702   - newTime = 0, outsideDist = 0;
703   -
704   - // Proportinally reduce speed if we are outside of the boundaries
705   - if (dist > 0 && newDist > maxDistUpper) {
706   - outsideDist = size / (6 / (newDist / speed * deceleration));
707   - maxDistUpper = maxDistUpper + outsideDist;
708   - speed = speed * maxDistUpper / newDist;
709   - newDist = maxDistUpper;
710   - } else if (dist < 0 && newDist > maxDistLower) {
711   - outsideDist = size / (6 / (newDist / speed * deceleration));
712   - maxDistLower = maxDistLower + outsideDist;
713   - speed = speed * maxDistLower / newDist;
714   - newDist = maxDistLower;
715   - }
716   -
717   - newDist = newDist * (dist < 0 ? -1 : 1);
718   - newTime = speed / deceleration;
719   -
720   - return { dist: newDist, time: m.round(newTime) };
721   - },
722   -
723   - _offset: function (el) {
724   - var left = -el.offsetLeft,
725   - top = -el.offsetTop;
726   -
727   - while (el = el.offsetParent) {
728   - left -= el.offsetLeft;
729   - top -= el.offsetTop;
730   - }
731   -
732   - if (el != this.wrapper) {
733   - left *= this.scale;
734   - top *= this.scale;
735   - }
736   -
737   - return { left: left, top: top };
738   - },
739   -
740   - _snap: function (x, y) {
741   - var that = this,
742   - i, l,
743   - page, time,
744   - sizeX, sizeY;
745   -
746   - // Check page X
747   - page = that.pagesX.length - 1;
748   - for (i=0, l=that.pagesX.length; i<l; i++) {
749   - if (x >= that.pagesX[i]) {
750   - page = i;
751   - break;
752   - }
753   - }
754   - if (page == that.currPageX && page > 0 && that.dirX < 0) page--;
755   - x = that.pagesX[page];
756   - sizeX = m.abs(x - that.pagesX[that.currPageX]);
757   - sizeX = sizeX ? m.abs(that.x - x) / sizeX * 500 : 0;
758   - that.currPageX = page;
759   -
760   - // Check page Y
761   - page = that.pagesY.length-1;
762   - for (i=0; i<page; i++) {
763   - if (y >= that.pagesY[i]) {
764   - page = i;
765   - break;
766   - }
767   - }
768   - if (page == that.currPageY && page > 0 && that.dirY < 0) page--;
769   - y = that.pagesY[page];
770   - sizeY = m.abs(y - that.pagesY[that.currPageY]);
771   - sizeY = sizeY ? m.abs(that.y - y) / sizeY * 500 : 0;
772   - that.currPageY = page;
773   -
774   - // Snap with constant speed (proportional duration)
775   - time = m.round(m.max(sizeX, sizeY)) || 200;
776   -
777   - return { x: x, y: y, time: time };
778   - },
779   -
780   - _bind: function (type, el, bubble) {
781   - (el || this.scroller).addEventListener(type, this, !!bubble);
782   - },
783   -
784   - _unbind: function (type, el, bubble) {
785   - (el || this.scroller).removeEventListener(type, this, !!bubble);
786   - },
787   -
788   -
789   - /**
790   - *
791   - * Public methods
792   - *
793   - */
794   - destroy: function () {
795   - var that = this;
796   -
797   - that.scroller.style[vendor + 'Transform'] = '';
798   -
799   - // Remove the scrollbars
800   - that.hScrollbar = false;
801   - that.vScrollbar = false;
802   - that._scrollbar('h');
803   - that._scrollbar('v');
804   -
805   - // Remove the event listeners
806   - that._unbind(RESIZE_EV, window);
807   - that._unbind(START_EV);
808   - that._unbind(MOVE_EV);
809   - that._unbind(END_EV);
810   - that._unbind(CANCEL_EV);
811   -
812   - if (that.options.hasTouch) {
813   - that._unbind('mouseout', that.wrapper);
814   - that._unbind(WHEEL_EV);
815   - }
816   -
817   - if (that.options.useTransition) that._unbind('webkitTransitionEnd');
818   -
819   - if (that.options.checkDOMChanges) clearInterval(that.checkDOMTime);
820   -
821   - if (that.options.onDestroy) that.options.onDestroy.call(that);
822   - },
823   -
824   - refresh: function () {
825   - var that = this,
826   - offset,
827   - pos = 0,
828   - page = 0;
829   -
830   - if (that.scale < that.options.zoomMin) that.scale = that.options.zoomMin;
831   - that.wrapperW = that.wrapper.clientWidth || 1;
832   - that.wrapperH = that.wrapper.clientHeight || 1;
833   -
834   - that.scrollerW = m.round(that.scroller.offsetWidth * that.scale);
835   - that.scrollerH = m.round(that.scroller.offsetHeight * that.scale);
836   - that.maxScrollX = that.wrapperW - that.scrollerW;
837   - that.maxScrollY = that.wrapperH - that.scrollerH;
838   - that.dirX = 0;
839   - that.dirY = 0;
840   -
841   - that.hScroll = that.options.hScroll && that.maxScrollX < 0;
842   - that.vScroll = that.options.vScroll && (!that.options.bounceLock && !that.hScroll || that.scrollerH > that.wrapperH);
843   -
844   - that.hScrollbar = that.hScroll && that.options.hScrollbar;
845   - that.vScrollbar = that.vScroll && that.options.vScrollbar && that.scrollerH > that.wrapperH;
846   -
847   - offset = that._offset(that.wrapper);
848   - that.wrapperOffsetLeft = -offset.left;
849   - that.wrapperOffsetTop = -offset.top;
850   -
851   - // Prepare snap
852   - if (typeof that.options.snap == 'string') {
853   - that.pagesX = [];
854   - that.pagesY = [];
855   - els = that.scroller.querySelectorAll(that.options.snap);
856   - for (i=0, l=els.length; i<l; i++) {
857   - pos = that._offset(els[i]);
858   - pos.left += that.wrapperOffsetLeft;
859   - pos.top += that.wrapperOffsetTop;
860   - that.pagesX[i] = pos.left < that.maxScrollX ? that.maxScrollX : pos.left * that.scale;
861   - that.pagesY[i] = pos.top < that.maxScrollY ? that.maxScrollY : pos.top * that.scale;
862   - }
863   - } else if (that.options.snap) {
864   - that.pagesX = [];
865   - while (pos >= that.maxScrollX) {
866   - that.pagesX[page] = pos;
867   - pos = pos - that.wrapperW;
868   - page++;
869   - }
870   - if (that.maxScrollX%that.wrapperW) that.pagesX[that.pagesX.length] = that.maxScrollX - that.pagesX[that.pagesX.length-1] + that.pagesX[that.pagesX.length-1];
871   -
872   - pos = 0;
873   - page = 0;
874   - that.pagesY = [];
875   - while (pos >= that.maxScrollY) {
876   - that.pagesY[page] = pos;
877   - pos = pos - that.wrapperH;
878   - page++;
879   - }
880   - if (that.maxScrollY%that.wrapperH) that.pagesY[that.pagesY.length] = that.maxScrollY - that.pagesY[that.pagesY.length-1] + that.pagesY[that.pagesY.length-1];
881   - }
882   -
883   - // Prepare the scrollbars
884   - that._scrollbar('h');
885   - that._scrollbar('v');
886   -
887   - that.scroller.style[vendor + 'TransitionDuration'] = '0';
888   -
889   - that._resetPos(200);
890   - },
891   -
892   - scrollTo: function (x, y, time, relative) {
893   - var that = this,
894   - step = x,
895   - i, l;
896   -
897   - that.stop();
898   -
899   - if (!step.length) step = [{ x: x, y: y, time: time, relative: relative }];
900   -
901   - for (i=0, l=step.length; i<l; i++) {
902   - if (step[i].relative) { step[i].x = that.x - step[i].x; step[i].y = that.y - step[i].y; }
903   - that.steps.push({ x: step[i].x, y: step[i].y, time: step[i].time || 0 });
904   - }
905   -
906   - that._startAni();
907   - },
908   -
909   - scrollToElement: function (el, time) {
910   - var that = this, pos;
911   - el = el.nodeType ? el : that.scroller.querySelector(el);
912   - if (!el) return;
913   -
914   - pos = that._offset(el);
915   - pos.left += that.wrapperOffsetLeft;
916   - pos.top += that.wrapperOffsetTop;
917   -
918   - pos.left = pos.left > 0 ? 0 : pos.left < that.maxScrollX ? that.maxScrollX : pos.left;
919   - pos.top = pos.top > 0 ? 0 : pos.top < that.maxScrollY ? that.maxScrollY : pos.top;
920   - time = time === undefined ? m.max(m.abs(pos.left)*2, m.abs(pos.top)*2) : time;
921   -
922   - that.scrollTo(pos.left, pos.top, time);
923   - },
924   -
925   - scrollToPage: function (pageX, pageY, time) {
926   - var that = this, x, y;
927   -
928   - if (that.options.snap) {
929   - pageX = pageX == 'next' ? that.currPageX+1 : pageX == 'prev' ? that.currPageX-1 : pageX;
930   - pageY = pageY == 'next' ? that.currPageY+1 : pageY == 'prev' ? that.currPageY-1 : pageY;
931   -
932   - pageX = pageX < 0 ? 0 : pageX > that.pagesX.length-1 ? that.pagesX.length-1 : pageX;
933   - pageY = pageY < 0 ? 0 : pageY > that.pagesY.length-1 ? that.pagesY.length-1 : pageY;
934   -
935   - that.currPageX = pageX;
936   - that.currPageY = pageY;
937   - x = that.pagesX[pageX];
938   - y = that.pagesY[pageY];
939   - } else {
940   - x = -that.wrapperW * pageX;
941   - y = -that.wrapperH * pageY;
942   - if (x < that.maxScrollX) x = that.maxScrollX;
943   - if (y < that.maxScrollY) y = that.maxScrollY;
944   - }
945   -
946   - that.scrollTo(x, y, time || 400);
947   - },
948   -
949   - disable: function () {
950   - this.stop();
951   - this._resetPos(0);
952   - this.enabled = false;
953   -
954   - // If disabled after touchstart we make sure that there are no left over events
955   - this._unbind(MOVE_EV);
956   - this._unbind(END_EV);
957   - this._unbind(CANCEL_EV);
958   - },
959   -
960   - enable: function () {
961   - this.enabled = true;
962   - },
963   -
964   - stop: function () {
965   - if (this.options.useTransition) this._unbind('webkitTransitionEnd');
966   - else cancelFrame(this.aniTime);
967   - this.steps = [];
968   - this.moved = false;
969   - this.animating = false;
970   - },
971   -
972   - zoom: function (x, y, scale, time) {
973   - var that = this,
974   - relScale = scale / that.scale;
975   -
976   - if (!that.options.useTransform) return;
977   -
978   - time = (time || 200) + 'ms'
979   - x = x - that.wrapperOffsetLeft - that.x;
980   - y = y - that.wrapperOffsetTop - that.y;
981   - that.x = x - x * relScale + that.x;
982   - that.y = y - y * relScale + that.y;
983   -
984   - that.scale = scale;
985   -
986   - that.scroller.style[vendor + 'TransitionDuration'] = time;
987   - that.scroller.style[vendor + 'Transform'] = trnOpen + that.x + 'px,' + that.y + 'px' + trnClose + ' scale(' + scale + ')';
988   -
989   - that.refresh();
990   - },
991   -
992   - isReady: function () {
993   - return !this.moved && !this.zoomed && !this.animating;
994   - }
995   -};
996   -
997   -if (typeof exports !== 'undefined') exports.iScroll = iScroll;
998   -else window.iScroll = iScroll;
999   -
1000   -})();
21 clients/mobileui/index.html
@@ -4,6 +4,12 @@
4 4 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
5 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 6 <title>Deuxdrop</title>
  7 + <style type="text/css">
  8 + body {
  9 + overflow-x: hidden;
  10 + -webkit-overflow-scrolling: touch;
  11 + }
  12 + </style>
7 13 <link rel="stylesheet" type="text/css" href="style.css">
8 14 <script src="../deps/require.js"></script>
9 15 <script>
@@ -31,12 +37,10 @@
31 37
32 38 <!-- signIn: Give us your name and e-mail (via BrowserID) -->
33 39 <div data-cardid="signIn" title="Sign In" class="card noiscroll">
34   - <div class="scroller">
35   - <form class="signUpForm standardForm">
36   - <input type="text" name="name" placeholder="Enter your name">
37   - <button>Sign In With BrowserID</button>
38   - </form>
39   - </div>
  40 + <form class="signUpForm standardForm">
  41 + <input type="text" name="name" placeholder="Enter your name">
  42 + <button>Sign In With BrowserID</button>
  43 + </form>
40 44 </div>
41 45
42 46 <!-- needServer: "bad news, no server" bounce page; needs to die -->
@@ -327,9 +331,10 @@
327 331 + Add Server
328 332 </a>
329 333
330   - <a data-classimpl="serverLink" class="item" data-nonav="nonav"
  334 + <a data-classimpl="serverLink" class="ps-server" data-nonav="nonav"
331 335 href="#connectToServer">
332   - <span data-bind="displayName"></span> (<span data-bind="url"></span>)
  336 + <span data-bind="displayName" class="ps-serverName"></span>
  337 + (<span data-bind="url" class="ps-serverUrl"></span>)
333 338 </a>
334 339
335 340 <form data-classimpl="compose" class="compose">
8 clients/mobileui/js/main.js
@@ -23,7 +23,6 @@ define(function (require, exports, module) {
23 23 moda = require('modality'),
24 24 friendly = require('friendly'),
25 25 browserId = require('browserId'),
26   - IScroll = require('iscroll'),
27 26
28 27 commonNodes = {},
29 28 states = {},
@@ -33,9 +32,6 @@ define(function (require, exports, module) {
33 32
34 33 jqBody = $('body');
35 34
36   - //iScroll just defines a global, bind to it here
37   - IScroll = window.iScroll;
38   -
39 35 // Browser ID is not actually a module, get a handle on it now.
40 36 browserId = navigator.id;
41 37
@@ -198,10 +194,6 @@ define(function (require, exports, module) {
198 194
199 195 cards.adjustCardSizes();
200 196
201   - if (newMessageIScroll) {
202   - newMessageIScroll.refresh();
203   - }
204   -
205 197 // Activate new notification, but only if not already on start page.
206 198 if (cards.currentCard().attr('data-cardid') !== 'start') {
207 199 notifyDom.show();
1,087 clients/mobileui/style.less
... ... @@ -0,0 +1,1087 @@
  1 +
  2 +////////////////////////////////////////////////////////////////////////////////
  3 +// Browser Compat
  4 +
  5 +////////////////////////////////////////////////////////////////////////////////
  6 +// Common HTML styling
  7 +
  8 +* {
  9 + margin: 0;
  10 + padding: 0;
  11 +
  12 + -webkit-box-sizing: border-box;
  13 + -moz-box-sizing: border-box;
  14 + -o-box-sizing: border-box;
  15 + box-sizing: border-box;
  16 +}
  17 +
  18 +body {
  19 + font-family: "Helvetica", arial, sans-serif;
  20 + background-color: #fafafa;
  21 + color: #222;
  22 + font-size: 14px;
  23 + line-height: 18px;
  24 +}
  25 +
  26 +.hidden,
  27 +button.hidden {
  28 + display: none;
  29 +}
  30 +
  31 +/* Used by card.js to hide inputs on other cards
  32 + so that mobile firefox does not do the up/down arrow
  33 + controls over the screen.
  34 +*/
  35 +.inputHidden {
  36 + visibility: hidden;
  37 +}
  38 +
  39 +.invisible,
  40 +button.invisible {
  41 + visibility: hidden;
  42 +}
  43 +
  44 +.untrustedData {
  45 + background-color: #fee;
  46 +}
  47 +
  48 +button,
  49 +input,
  50 +textarea {
  51 + font-family: "Helvetica", arial, sans-serif;
  52 +}
  53 +
  54 +button {
  55 + cursor: pointer;
  56 +}
  57 +
  58 +button::-moz-focus-inner {
  59 + padding: 0;
  60 + border: 0
  61 +}
  62 +
  63 +::-webkit-input-placeholder {
  64 + color: #ccc;
  65 +}
  66 +:-moz-placeholder {
  67 + color: #ccc;
  68 +}
  69 +
  70 +a {
  71 + text-decoration: none;
  72 + color: #0063FF;
  73 +}
  74 +
  75 +.overflow {
  76 + overflow: hidden;
  77 + white-space: nowrap;
  78 +
  79 + -o-text-overflow: ellipsis;
  80 + text-overflow: ellipsis;
  81 +}
  82 +
  83 +.url() {
  84 + font-style: italic;
  85 +}
  86 +
  87 +button,
  88 +.subHeader button,
  89 +.compose button {
  90 + background-color: #EEEEEE;
  91 + border-width: 1px;
  92 + border-style: solid;
  93 + border-color: #708BB5 #708BB5 #516B95;
  94 + color: #FFFFFF;
  95 + font-size: 11px;
  96 + font-weight: bold;
  97 + height: 24px;
  98 + padding: 0 10px;
  99 + text-shadow: 0 -1px 0 #516B95;
  100 + margin: 0 0 0 5px;
  101 +