Skip to content

Commit

Permalink
Run grunt.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Aug 27, 2014
1 parent 6276e76 commit cf5785c
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -3,6 +3,7 @@
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.map text eol=lf
*.md text eol=lf
*.scss text eol=lf
*.svg text eol=lf
Expand Down
2 changes: 2 additions & 0 deletions dist/css/ratchet-theme-android.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions dist/css/ratchet-theme-android.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/css/ratchet-theme-ios.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions dist/css/ratchet-theme-ios.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions dist/css/ratchet.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions dist/css/ratchet.css.map

Large diffs are not rendered by default.

27 changes: 23 additions & 4 deletions dist/js/ratchet.js
Expand Up @@ -182,7 +182,6 @@
}
cacheMapping[data.id] = JSON.stringify(data);
window.history.replaceState(data.id, data.title, data.url);
domCache[data.id] = document.body.cloneNode(true);
};

var cachePush = function () {
Expand All @@ -200,7 +199,7 @@
delete cacheMapping[cacheBackStack.shift()];
}

window.history.pushState(null, '', cacheMapping[PUSH.id].url);
window.history.pushState(null, '', getCached(PUSH.id).url);

cacheMapping.cacheForwardStack = JSON.stringify(cacheForwardStack);
cacheMapping.cacheBackStack = JSON.stringify(cacheBackStack);
Expand Down Expand Up @@ -331,7 +330,9 @@
swapContent(
(activeObj.contents || activeDom).cloneNode(true),
document.querySelector('.content'),
transition
transition, function() {
triggerStateChange();
}
);

PUSH.id = id;
Expand Down Expand Up @@ -383,6 +384,8 @@
});
}

cacheCurrentContent();

if (options.timeout) {
options._timeout = setTimeout(function () { xhr.abort('timeout'); }, options.timeout);
}
Expand All @@ -394,6 +397,10 @@
}
};

function cacheCurrentContent() {
domCache[PUSH.id] = document.body.cloneNode(true);
}


// Main XHR handlers
// =================
Expand Down Expand Up @@ -713,6 +720,7 @@
var slideNumber;
var isScrolling;
var scrollableArea;
var startedMoving;

var getSlider = function (target) {
var i;
Expand Down Expand Up @@ -773,12 +781,17 @@
return; // Exit if a pinch || no slider
}

// adjust the starting position if we just started to avoid jumpage
if (!startedMoving) {
pageX += (e.touches[0].pageX - pageX) - 1;
}

deltaX = e.touches[0].pageX - pageX;
deltaY = e.touches[0].pageY - pageY;
pageX = e.touches[0].pageX;
pageY = e.touches[0].pageY;

if (typeof isScrolling === 'undefined') {
if (typeof isScrolling === 'undefined' && startedMoving) {
isScrolling = Math.abs(deltaY) > Math.abs(deltaX);
}

Expand All @@ -794,13 +807,19 @@
slideNumber === lastSlide && deltaX < 0 ? (Math.abs(pageX) / sliderWidth) + 1.25 : 1;

slider.style.webkitTransform = 'translate3d(' + offsetX + 'px,0,0)';

// started moving
startedMoving = true;
};

var onTouchEnd = function (e) {
if (!slider || isScrolling) {
return;
}

// we're done moving
startedMoving = false;

setSlideNumber(
(+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0
);
Expand Down

0 comments on commit cf5785c

Please sign in to comment.