Permalink
Browse files

clean up

  • Loading branch information...
1 parent 82b4f3b commit 8165866cd58b229bc67091c4b48248095beb6986 @cubiq cubiq committed Sep 22, 2011
Showing with 21 additions and 23 deletions.
  1. +2 −1 README.md
  2. +1 −1 examples/pull-to-refresh/index.html
  3. +1 −1 examples/simple/index.html
  4. +5 −7 src/iscroll-lite.js
  5. +12 −13 src/iscroll.js
View
@@ -1,4 +1,4 @@
-iScroll v4.1.9 - 2011-08-03
+iScroll v4.1.9 - 2011-09-22
===========================
The overflow:scroll for mobile webkit. Project started because webkit for iPhone does not provide a native way to scroll content inside a fixed size (width/height) div. So basically it was impossible to have a fixed header/footer and a scrolling central area. Until now. Read more at [cubiq.org](http://cubiq.org).
@@ -19,6 +19,7 @@ iScroll is evolving thank to the help of all those who sent suggestions, bug rep
In completely random order:
+- All Github [contributors](https://github.com/cubiq/iscroll/contributors)
- [beedesk](http://beedesk.com) for bug squashing in the pull to refresh feature
- [Daniel J. Pinter](http://twitter.com/#!/HeadDZombie) for continued support, bug reports and for killing zombies
- [Aseem Kishore](http://about.me/aseemk) for help with the zoom functionality
@@ -101,7 +101,7 @@
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
-document.addEventListener('DOMContentLoaded', setTimeout(function () { loaded(); }, 200), false);
+document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
</script>
<style type="text/css" media="all">
@@ -23,7 +23,7 @@
* Use this for high compatibility (iDevice + Android)
*
*/
-document.addEventListener('DOMContentLoaded', setTimeout(function () { loaded(); }, 200), false);
+document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
/*
* * * * * * * */
View
@@ -5,6 +5,7 @@
(function(){
var m = Math,
+ mround = function (r) { return r >> 0; },
vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
(/firefox/i).test(navigator.userAgent) ? 'Moz' :
'opera' in window ? 'O' : '',
@@ -143,8 +144,8 @@ iScroll.prototype = {
if (this.options.useTransform) {
this.scroller.style[vendor + 'Transform'] = trnOpen + x + 'px,' + y + 'px' + trnClose + ' scale(' + this.scale + ')';
} else {
- x = m.round(x);
- y = m.round(y);
+ x = mround(x);
+ y = mround(y);
this.scroller.style.left = x + 'px';
this.scroller.style.top = y + 'px';
}
@@ -193,9 +194,6 @@ iScroll.prototype = {
}
}
- that.absStartX = that.x; // Needed by snap threshold
- that.absStartY = that.y;
-
that.startX = that.x;
that.startY = that.y;
that.pointX = point.pageX;
@@ -322,7 +320,7 @@ iScroll.prototype = {
if (momentumX.dist || momentumY.dist) {
newDuration = m.max(m.max(momentumX.time, momentumY.time), 10);
- that.scrollTo(m.round(newPosX), m.round(newPosY), newDuration);
+ that.scrollTo(mround(newPosX), mround(newPosY), newDuration);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
@@ -456,7 +454,7 @@ iScroll.prototype = {
newDist = newDist * (dist < 0 ? -1 : 1);
newTime = speed / deceleration;
- return { dist: newDist, time: m.round(newTime) };
+ return { dist: newDist, time: mround(newTime) };
},
_offset: function (el) {
View
@@ -2,10 +2,9 @@
* iScroll v4.1.9 ~ Copyright (c) 2011 Matteo Spinelli, http://cubiq.org
* Released under MIT license, http://cubiq.org/license
*/
-
(function(){
var m = Math,
- _round = function (r) { return r >> 0; },
+ mround = function (r) { return r >> 0; },
vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
(/firefox/i).test(navigator.userAgent) ? 'Moz' :
'opera' in window ? 'O' : '',
@@ -229,13 +228,13 @@ iScroll.prototype = {
if (dir == 'h') {
that.hScrollbarSize = that.hScrollbarWrapper.clientWidth;
- that.hScrollbarIndicatorSize = m.max(_round(that.hScrollbarSize * that.hScrollbarSize / that.scrollerW), 8);
+ that.hScrollbarIndicatorSize = m.max(mround(that.hScrollbarSize * that.hScrollbarSize / that.scrollerW), 8);
that.hScrollbarIndicator.style.width = that.hScrollbarIndicatorSize + 'px';
that.hScrollbarMaxScroll = that.hScrollbarSize - that.hScrollbarIndicatorSize;
that.hScrollbarProp = that.hScrollbarMaxScroll / that.maxScrollX;
} else {
that.vScrollbarSize = that.vScrollbarWrapper.clientHeight;
- that.vScrollbarIndicatorSize = m.max(_round(that.vScrollbarSize * that.vScrollbarSize / that.scrollerH), 8);
+ that.vScrollbarIndicatorSize = m.max(mround(that.vScrollbarSize * that.vScrollbarSize / that.scrollerH), 8);
that.vScrollbarIndicator.style.height = that.vScrollbarIndicatorSize + 'px';
that.vScrollbarMaxScroll = that.vScrollbarSize - that.vScrollbarIndicatorSize;
that.vScrollbarProp = that.vScrollbarMaxScroll / that.maxScrollY;
@@ -257,8 +256,8 @@ iScroll.prototype = {
if (this.options.useTransform) {
this.scroller.style[vendor + 'Transform'] = trnOpen + x + 'px,' + y + 'px' + trnClose + ' scale(' + this.scale + ')';
} else {
- x = _round(x);
- y = _round(y);
+ x = mround(x);
+ y = mround(y);
this.scroller.style.left = x + 'px';
this.scroller.style.top = y + 'px';
}
@@ -281,14 +280,14 @@ iScroll.prototype = {
if (pos < 0) {
if (!that.options.fixedScrollbar) {
- size = that[dir + 'ScrollbarIndicatorSize'] + _round(pos * 3);
+ size = that[dir + 'ScrollbarIndicatorSize'] + mround(pos * 3);
if (size < 8) size = 8;
that[dir + 'ScrollbarIndicator'].style[dir == 'h' ? 'width' : 'height'] = size + 'px';
}
pos = 0;
} else if (pos > that[dir + 'ScrollbarMaxScroll']) {
if (!that.options.fixedScrollbar) {
- size = that[dir + 'ScrollbarIndicatorSize'] - _round((pos - that[dir + 'ScrollbarMaxScroll']) * 3);
+ size = that[dir + 'ScrollbarIndicatorSize'] - mround((pos - that[dir + 'ScrollbarMaxScroll']) * 3);
if (size < 8) size = 8;
that[dir + 'ScrollbarIndicator'].style[dir == 'h' ? 'width' : 'height'] = size + 'px';
pos = that[dir + 'ScrollbarMaxScroll'] + (that[dir + 'ScrollbarIndicatorSize'] - size);
@@ -562,7 +561,7 @@ iScroll.prototype = {
}
}
- that.scrollTo(_round(newPosX), _round(newPosY), newDuration);
+ that.scrollTo(mround(newPosX), mround(newPosY), newDuration);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
@@ -770,7 +769,7 @@ iScroll.prototype = {
newDist = newDist * (dist < 0 ? -1 : 1);
newTime = speed / deceleration;
- return { dist: newDist, time: _round(newTime) };
+ return { dist: newDist, time: mround(newTime) };
},
_offset: function (el) {
@@ -825,7 +824,7 @@ iScroll.prototype = {
that.currPageY = page;
// Snap with constant speed (proportional duration)
- time = _round(m.max(sizeX, sizeY)) || 200;
+ time = mround(m.max(sizeX, sizeY)) || 200;
return { x: x, y: y, time: time };
},
@@ -887,8 +886,8 @@ iScroll.prototype = {
that.wrapperH = that.wrapper.clientHeight || 1;
that.minScrollY = -that.options.topOffset || 0;
- that.scrollerW = _round(that.scroller.offsetWidth * that.scale);
- that.scrollerH = _round((that.scroller.offsetHeight + that.minScrollY) * that.scale);
+ that.scrollerW = mround(that.scroller.offsetWidth * that.scale);
+ that.scrollerH = mround((that.scroller.offsetHeight + that.minScrollY) * that.scale);
that.maxScrollX = that.wrapperW - that.scrollerW;
that.maxScrollY = that.wrapperH - that.scrollerH + that.minScrollY;
that.dirX = 0;

0 comments on commit 8165866

Please sign in to comment.