Browse Source

Run `grunt`.

pull/521/head
XhmikosR 11 years ago committed by XhmikosR
parent
commit
51b9b81509
  1. 44
      dist/js/ratchet.js
  2. 44
      docs/dist/js/ratchet.js

44
dist/js/ratchet.js vendored

@ -103,8 +103,7 @@
try { try {
popover = document.querySelector(anchor.hash); popover = document.querySelector(anchor.hash);
} } catch (error) {
catch (error) {
popover = null; popover = null;
} }
@ -370,7 +369,11 @@
clearTimeout(options._timeout); clearTimeout(options._timeout);
} }
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
xhr.status === 200 ? success(xhr, options) : failure(options.url); if (xhr.status === 200) {
success(xhr, options);
} else {
failure(options.url);
}
} }
}; };
@ -397,7 +400,7 @@
} }
}; };
function cacheCurrentContent() { function cacheCurrentContent () {
domCache[PUSH.id] = document.body.cloneNode(true); domCache[PUSH.id] = document.body.cloneNode(true);
} }
@ -490,7 +493,9 @@
} }
if (!transition) { if (!transition) {
complete && complete(); if (complete) {
complete();
}
} }
if (transition === 'fade') { if (transition === 'fade') {
@ -506,7 +511,9 @@
container.parentNode.removeChild(container); container.parentNode.removeChild(container);
swap.classList.remove('fade'); swap.classList.remove('fade');
swap.classList.remove('in'); swap.classList.remove('in');
complete && complete(); if (complete) {
complete();
}
}; };
container.addEventListener('webkitTransitionEnd', fadeContainerEnd); container.addEventListener('webkitTransitionEnd', fadeContainerEnd);
@ -518,7 +525,9 @@
swap.classList.remove('sliding', 'sliding-in'); swap.classList.remove('sliding', 'sliding-in');
swap.classList.remove(swapDirection); swap.classList.remove(swapDirection);
container.parentNode.removeChild(container); container.parentNode.removeChild(container);
complete && complete(); if (complete) {
complete();
}
}; };
container.offsetWidth; // force reflow container.offsetWidth; // force reflow
@ -623,7 +632,11 @@
window.addEventListener('touchstart', function () { isScrolling = false; }); window.addEventListener('touchstart', function () { isScrolling = false; });
window.addEventListener('touchmove', function () { isScrolling = true; }); window.addEventListener('touchmove', function () { isScrolling = true; });
window.addEventListener('touchend', touchend); window.addEventListener('touchend', touchend);
window.addEventListener('click', function (e) { if (getTarget(e)) {e.preventDefault();} }); window.addEventListener('click', function (e) {
if (getTarget(e)) {
e.preventDefault();
}
});
window.addEventListener('popstate', popstate); window.addEventListener('popstate', popstate);
window.PUSH = PUSH; window.PUSH = PUSH;
@ -692,7 +705,12 @@
targetBody.classList.add(className); targetBody.classList.add(className);
}); });
window.addEventListener('click', function (e) { if (getTarget(e.target)) {e.preventDefault();} }); window.addEventListener('click', function (e) {
if (getTarget(e.target)) {
e.preventDefault();
}
});
}()); }());
/* ======================================================================== /* ========================================================================
@ -820,9 +838,7 @@
// we're done moving // we're done moving
startedMoving = false; startedMoving = false;
setSlideNumber( setSlideNumber((+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0);
(+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0
);
offsetX = slideNumber * sliderWidth; offsetX = slideNumber * sliderWidth;
@ -950,7 +966,9 @@
toggle.classList[slideOn ? 'add' : 'remove']('active'); toggle.classList[slideOn ? 'add' : 'remove']('active');
e = new CustomEvent('toggle', { e = new CustomEvent('toggle', {
detail: { isActive: slideOn }, detail: {
isActive: slideOn
},
bubbles: true, bubbles: true,
cancelable: true cancelable: true
}); });

44
docs/dist/js/ratchet.js vendored

@ -103,8 +103,7 @@
try { try {
popover = document.querySelector(anchor.hash); popover = document.querySelector(anchor.hash);
} } catch (error) {
catch (error) {
popover = null; popover = null;
} }
@ -370,7 +369,11 @@
clearTimeout(options._timeout); clearTimeout(options._timeout);
} }
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
xhr.status === 200 ? success(xhr, options) : failure(options.url); if (xhr.status === 200) {
success(xhr, options);
} else {
failure(options.url);
}
} }
}; };
@ -397,7 +400,7 @@
} }
}; };
function cacheCurrentContent() { function cacheCurrentContent () {
domCache[PUSH.id] = document.body.cloneNode(true); domCache[PUSH.id] = document.body.cloneNode(true);
} }
@ -490,7 +493,9 @@
} }
if (!transition) { if (!transition) {
complete && complete(); if (complete) {
complete();
}
} }
if (transition === 'fade') { if (transition === 'fade') {
@ -506,7 +511,9 @@
container.parentNode.removeChild(container); container.parentNode.removeChild(container);
swap.classList.remove('fade'); swap.classList.remove('fade');
swap.classList.remove('in'); swap.classList.remove('in');
complete && complete(); if (complete) {
complete();
}
}; };
container.addEventListener('webkitTransitionEnd', fadeContainerEnd); container.addEventListener('webkitTransitionEnd', fadeContainerEnd);
@ -518,7 +525,9 @@
swap.classList.remove('sliding', 'sliding-in'); swap.classList.remove('sliding', 'sliding-in');
swap.classList.remove(swapDirection); swap.classList.remove(swapDirection);
container.parentNode.removeChild(container); container.parentNode.removeChild(container);
complete && complete(); if (complete) {
complete();
}
}; };
container.offsetWidth; // force reflow container.offsetWidth; // force reflow
@ -623,7 +632,11 @@
window.addEventListener('touchstart', function () { isScrolling = false; }); window.addEventListener('touchstart', function () { isScrolling = false; });
window.addEventListener('touchmove', function () { isScrolling = true; }); window.addEventListener('touchmove', function () { isScrolling = true; });
window.addEventListener('touchend', touchend); window.addEventListener('touchend', touchend);
window.addEventListener('click', function (e) { if (getTarget(e)) {e.preventDefault();} }); window.addEventListener('click', function (e) {
if (getTarget(e)) {
e.preventDefault();
}
});
window.addEventListener('popstate', popstate); window.addEventListener('popstate', popstate);
window.PUSH = PUSH; window.PUSH = PUSH;
@ -692,7 +705,12 @@
targetBody.classList.add(className); targetBody.classList.add(className);
}); });
window.addEventListener('click', function (e) { if (getTarget(e.target)) {e.preventDefault();} }); window.addEventListener('click', function (e) {
if (getTarget(e.target)) {
e.preventDefault();
}
});
}()); }());
/* ======================================================================== /* ========================================================================
@ -820,9 +838,7 @@
// we're done moving // we're done moving
startedMoving = false; startedMoving = false;
setSlideNumber( setSlideNumber((+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0);
(+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0
);
offsetX = slideNumber * sliderWidth; offsetX = slideNumber * sliderWidth;
@ -950,7 +966,9 @@
toggle.classList[slideOn ? 'add' : 'remove']('active'); toggle.classList[slideOn ? 'add' : 'remove']('active');
e = new CustomEvent('toggle', { e = new CustomEvent('toggle', {
detail: { isActive: slideOn }, detail: {
isActive: slideOn
},
bubbles: true, bubbles: true,
cancelable: true cancelable: true
}); });

Loading…
Cancel
Save