From 51b9b81509587a312ff36ddb94c5118ecf57aaf5 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 24 Mar 2014 08:31:38 +0200 Subject: [PATCH] Run `grunt`. --- dist/js/ratchet.js | 46 ++++++++++++++++++++++++++++------------- docs/dist/js/ratchet.js | 46 ++++++++++++++++++++++++++++------------- 2 files changed, 64 insertions(+), 28 deletions(-) diff --git a/dist/js/ratchet.js b/dist/js/ratchet.js index 85e8cfd..d865c64 100644 --- a/dist/js/ratchet.js +++ b/dist/js/ratchet.js @@ -103,8 +103,7 @@ try { popover = document.querySelector(anchor.hash); - } - catch (error) { + } catch (error) { popover = null; } @@ -370,7 +369,11 @@ clearTimeout(options._timeout); } 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); } @@ -472,7 +475,7 @@ document.body.insertBefore(swap, document.querySelector('.content')); } } else { - enter = /in$/.test(transition); + enter = /in$/.test(transition); if (transition === 'fade') { container.classList.add('in'); @@ -490,7 +493,9 @@ } if (!transition) { - complete && complete(); + if (complete) { + complete(); + } } if (transition === 'fade') { @@ -506,7 +511,9 @@ container.parentNode.removeChild(container); swap.classList.remove('fade'); swap.classList.remove('in'); - complete && complete(); + if (complete) { + complete(); + } }; container.addEventListener('webkitTransitionEnd', fadeContainerEnd); @@ -518,7 +525,9 @@ swap.classList.remove('sliding', 'sliding-in'); swap.classList.remove(swapDirection); container.parentNode.removeChild(container); - complete && complete(); + if (complete) { + complete(); + } }; container.offsetWidth; // force reflow @@ -623,7 +632,11 @@ window.addEventListener('touchstart', function () { isScrolling = false; }); window.addEventListener('touchmove', function () { isScrolling = true; }); 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.PUSH = PUSH; @@ -692,7 +705,12 @@ 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 startedMoving = false; - setSlideNumber( - (+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0 - ); + setSlideNumber((+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0); offsetX = slideNumber * sliderWidth; @@ -950,7 +966,9 @@ toggle.classList[slideOn ? 'add' : 'remove']('active'); e = new CustomEvent('toggle', { - detail: { isActive: slideOn }, + detail: { + isActive: slideOn + }, bubbles: true, cancelable: true }); diff --git a/docs/dist/js/ratchet.js b/docs/dist/js/ratchet.js index 85e8cfd..d865c64 100644 --- a/docs/dist/js/ratchet.js +++ b/docs/dist/js/ratchet.js @@ -103,8 +103,7 @@ try { popover = document.querySelector(anchor.hash); - } - catch (error) { + } catch (error) { popover = null; } @@ -370,7 +369,11 @@ clearTimeout(options._timeout); } 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); } @@ -472,7 +475,7 @@ document.body.insertBefore(swap, document.querySelector('.content')); } } else { - enter = /in$/.test(transition); + enter = /in$/.test(transition); if (transition === 'fade') { container.classList.add('in'); @@ -490,7 +493,9 @@ } if (!transition) { - complete && complete(); + if (complete) { + complete(); + } } if (transition === 'fade') { @@ -506,7 +511,9 @@ container.parentNode.removeChild(container); swap.classList.remove('fade'); swap.classList.remove('in'); - complete && complete(); + if (complete) { + complete(); + } }; container.addEventListener('webkitTransitionEnd', fadeContainerEnd); @@ -518,7 +525,9 @@ swap.classList.remove('sliding', 'sliding-in'); swap.classList.remove(swapDirection); container.parentNode.removeChild(container); - complete && complete(); + if (complete) { + complete(); + } }; container.offsetWidth; // force reflow @@ -623,7 +632,11 @@ window.addEventListener('touchstart', function () { isScrolling = false; }); window.addEventListener('touchmove', function () { isScrolling = true; }); 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.PUSH = PUSH; @@ -692,7 +705,12 @@ 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 startedMoving = false; - setSlideNumber( - (+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0 - ); + setSlideNumber((+new Date()) - startTime < 1000 && Math.abs(deltaX) > 15 ? (deltaX < 0 ? -1 : 1) : 0); offsetX = slideNumber * sliderWidth; @@ -950,7 +966,9 @@ toggle.classList[slideOn ? 'add' : 'remove']('active'); e = new CustomEvent('toggle', { - detail: { isActive: slideOn }, + detail: { + isActive: slideOn + }, bubbles: true, cancelable: true });