diff --git a/LICENSE b/LICENSE index aa96201..cd2067f 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ Copyright 2011 Joe Hewitt Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software diff --git a/scrollability.js b/scrollability.js index 2b8feef..9145951 100644 --- a/scrollability.js +++ b/scrollability.js @@ -80,7 +80,7 @@ exports.flashIndicators = function() { // var scrollables = document.querySelectorAll('.scrollable.vertical'); // for (var i = 0; i < scrollables.length; ++i) { // exports.scrollTo(scrollables[i], 0, 0, 20, true); - // } + // } } function onLoad() { @@ -119,7 +119,7 @@ function onTouchStart(event) { document.addEventListener(isTouch ? 'touchend' : 'mouseup', onTouchEnd, false); // if (D) event.preventDefault(); - + function onTouchMove(event) { event.preventDefault(); touchMoved = true; @@ -162,15 +162,15 @@ function onTouchStart(event) { function onTouchEnd(event) { // Simulate a click event when releasing the finger if (touched) { - var evt = document.createEvent('MouseEvents'); + var evt = document.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, window, 1); - touched[0].dispatchEvent(evt); + touched[0].dispatchEvent(evt); releaseTouched(touched); } document.removeEventListener(isTouch ? 'touchmove' : 'mousemove', onTouchMove, false); document.removeEventListener(isTouch ? 'touchend' : 'mouseup', onTouchEnd, false); - + touchAnimators.forEach(function(animator) { animator.takeoff(); }); @@ -228,7 +228,7 @@ function wrapAnimator(animator, startX, startY, startTime) { if (scrollbar) { addTracker(scrollbar, trackScrollbar); if (!scrollbar.parentNode) { - node.parentNode.appendChild(scrollbar); + node.parentNode.appendChild(scrollbar); } } @@ -242,13 +242,13 @@ function wrapAnimator(animator, startX, startY, startTime) { update(position); } - + animator.reposition = update; animator.track = track; animator.takeoff = takeoff; animator.terminate = terminate; return animator; - + function addTracker(node, callback) { tracked.push({node: node, callback: callback, keyframes: []}); } @@ -274,7 +274,7 @@ function wrapAnimator(animator, startX, startY, startTime) { velocity = touch - lastTouch; lastTouch = touch; - + if (Math.abs(velocity) >= kStoppedThreshold) { if (stopped) { --stopped; @@ -360,7 +360,7 @@ function wrapAnimator(animator, startX, startY, startTime) { if (node.cleanup) { node.cleanup(); - } + } globalStyleSheet.insertRule(timeline.css, 0); @@ -387,7 +387,7 @@ function wrapAnimator(animator, startX, startY, startTime) { } node.addEventListener("webkitAnimationEnd", node.normalEnd, false); - + play(node, timeline.name, timeline.time); tracked.forEach(function(item) { @@ -485,7 +485,7 @@ function wrapAnimator(animator, startX, startY, startTime) { position += velocity; } - saveKeyframe(!continues); + saveKeyframe(!continues); time += kAnimationStep; } @@ -554,19 +554,19 @@ function wrapAnimator(animator, startX, startY, startTime) { fadeIn(scrollbar); } else { scrollbar.style.opacity = '0'; - scrollbar.style.webkitTransition = 'opacity 0.33s linear'; + scrollbar.style.webkitTransition = 'opacity 0.33s linear'; } } - node.removeEventListener("webkitAnimationEnd", node.normalEnd, false); + node.removeEventListener("webkitAnimationEnd", node.normalEnd, false); delete node.earlyEnd; delete node.normalEnd; - + if (!animator.mute) { dispatch("scrollability-end", node); } - + } function terminate() { @@ -578,7 +578,7 @@ function wrapAnimator(animator, startX, startY, startTime) { function getTouchAnimators(node, touchX, touchY, startTime) { var animators = []; - + // Get universally scrollable elements var candidates = document.querySelectorAll('.scrollable.universal'); for (var j = 0; j < candidates.length; ++j) { @@ -609,7 +609,7 @@ function findAnimators(element, animators, touchX, touchY, startTime) { if (!exists) { animator = wrapAnimator(animator, touchX, touchY, startTime); if (animator) { - animators.push(animator); + animators.push(animator); } } } @@ -622,7 +622,7 @@ function createAnimatorForElement(element, touchX, touchY, startTime) { var classes = element.className.split(' '); if (classes.indexOf("scrollable") == -1) return; - + for (var i = 0; i < classes.length; ++i) { var name = classes[i]; if (directions[name]) { @@ -648,7 +648,7 @@ function generateCSSKeyframes(animator, keyframes, name, time, offset) { lines.push('}'); - return lines.join('\n'); + return lines.join('\n'); } function setTouched(target) { @@ -702,9 +702,9 @@ function createXDirection(node) { viewport: parent.offsetWidth, bounce: parent.offsetWidth * kBounceLimit, constrained: true, - + filter: function(x, y) { - return x; + return x; }, disable: function (x, y, startX, startY) { @@ -743,11 +743,11 @@ function createYDirection(node) { viewport: parent.offsetHeight, bounce: parent.offsetHeight * kBounceLimit, constrained: true, - + filter: function(x, y) { return y; }, - + disable: function(x, y, startX, startY) { var dx = Math.abs(x - startX); var dy = Math.abs(y - startY); @@ -755,11 +755,11 @@ function createYDirection(node) { return true; } }, - + update: function(position) { return 'translate3d(0, ' + Math.round(position) + 'px, 0)'; } - }; + }; } function play(node, name, time) { diff --git a/static/examples/pages.html b/static/examples/pages.html index 3e19730..7f7dddb 100644 --- a/static/examples/pages.html +++ b/static/examples/pages.html @@ -1,20 +1,20 @@ - - - - -Scrollability - - - - - - + + - +
diff --git a/static/examples/tableview.html b/static/examples/tableview.html index f8ded9c..d369f5e 100644 --- a/static/examples/tableview.html +++ b/static/examples/tableview.html @@ -5,8 +5,8 @@ Scrollability - - + +