seamless-scroll-polyfill
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
(function(){'use strict';var a=function(a){function b(){D=!0,m.clearTimeout(p),p=m.setTimeout(c,q)}function c(){D=!1,m.removeEventListener("wheel",b),m.removeEventListener("touchmove",b)}function d(a,b){if(void 0!==a){if(!0===x(a))return void s.scroll.call(m,void 0===a.left?"object"==typeof a?m.scrollX||m.pageXOffset:a:a.left,void 0===a.top?void 0===b?m.scrollY||m.pageYOffset:b:a.top);var c=a,d=c.left,e=void 0===d?m.scrollX||m.pageXOffset:d,f=c.top,g=void 0===f?m.scrollY||m.pageYOffset:f;E.call(m,o.body,~~e,~~g)}}function e(a,b){return void 0===a?void 0:x(a)?void s.scrollBy.call(m,void 0===a.left?"object"==typeof a?0:a:a.left,void 0===a.top?void 0===b?0:b:a.top):void E.call(m,o.body,~~a.left+(m.scrollX||m.pageXOffset),~~a.top+(m.scrollY||m.pageYOffset))}function f(a,b){if(void 0!==a){if(!0===x(a)){if("number"==typeof a&&void 0===b)throw new SyntaxError("Value could not be converted");return void s.elementScroll.call(this,void 0===a.left?"object"==typeof a?this.scrollLeft:~~a:~~a.left,void 0===a.top?void 0===b?this.scrollTop:~~b:~~a.top)}var c=a,d=c.left,e=void 0===d?this.scrollLeft:d,f=c.top,g=void 0===f?this.scrollTop:f;E.call(this,this,~~e,~~g)}}function g(a,b){return void 0===a?void 0:!0===x(a)?void s.elementScroll.call(this,void 0===a.left?~~a+this.scrollLeft:~~a.left+this.scrollLeft,void 0===a.top?~~b+this.scrollTop:~~a.top+this.scrollTop):void this.scroll({left:~~a.left+this.scrollLeft,top:~~a.top+this.scrollTop,behavior:a.behavior})}var h=void 0===a?{}:a,i=h.force,j=h.duration,k=void 0===j?468:j,l=h.win,m=void 0===l?window:l,n=h.doc,o=void 0===n?document:n;if(!("scrollBehavior"in o.documentElement.style&&!0!==(void 0!==i&&i))){var p,q=~~k,r=function(a,b){this.scrollLeft=a,this.scrollTop=b},s={scroll:m.scroll||m.scrollTo,scrollBy:m.scrollBy,elementScroll:m.Element.prototype.scroll||r,scrollIntoView:m.Element.prototype.scrollIntoView},t=m.performance&&m.performance.now?m.performance.now.bind(m.performance):Date.now,u=function(a){return new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)},v=u(m.navigator.userAgent)?1:0,w=function(a){var b=Math.cos,c=Math.PI;return .5*(1-b(c*a))},x=function(a){if(null===a||"object"!=typeof a||void 0===a.behavior||"auto"===a.behavior)return!0;if("object"==typeof a&&"smooth"===a.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+a.behavior+" is not a valid value for enumeration ScrollBehavior.")},y=function(a,b){return"Y"===b?a.clientHeight+v<a.scrollHeight:"X"===b&&a.clientWidth+v<a.scrollWidth},z=function(a,b){var c=m.getComputedStyle(a,null)["overflow"+b];return"auto"===c||"scroll"===c},A=function(a){var b=y(a,"Y")&&z(a,"Y"),c=y(a,"X")&&z(a,"X");return b||c},B=function(a){var b=a;do b=b.parentElement;while(b!==o.body&&!1===A(b));return b},C=function(a){if(!D){var b=t(),c=(b-a.startTime)/q;c=1<c?1:c;var d=w(c),e=a.startX+(a.x-a.startX)*d,f=a.startY+(a.y-a.startY)*d;a.method.call(a.scrollable,e,f),(e!==a.x||f!==a.y)&&m.requestAnimationFrame(C.bind(m,a))}},D=!1,E=function(a,c,d){var e,f,g,h,i=t();a===o.body?(e=m,f=m.scrollX||m.pageXOffset,g=m.scrollY||m.pageYOffset,h=s.scroll):(e=a,f=a.scrollLeft,g=a.scrollTop,h=r),m.addEventListener("wheel",b,{passive:!0,once:!0}),m.addEventListener("touchmove",b,{passive:!0,once:!0}),C({scrollable:e,method:h,startTime:i,startX:f,startY:g,x:c,y:d})};m.scroll=m.scrollTo=d,m.scrollBy=e,m.Element.prototype.scroll=m.Element.prototype.scrollTo=f,m.Element.prototype.scrollBy=g;var F=function(a,b,c,d){var e=0===b&&c||1===b&&!c?a.inline:a.block;return"center"===e?1:"nearest"===e?0:"start"===e?0===b?d?5:4:2:"end"===e?0===b?d?4:5:3:c?0===b?0:2:0===b?4:0};m.Element.prototype.scrollIntoView=function(a){if(void 0===a||!0===a||!1===a||!0===x(a))return void s.scrollIntoView.call(this,void 0===a||a);var b=B(this),c=b.getBoundingClientRect(),d=this.getBoundingClientRect(),e=c.left,f=c.right,g=c.top,h=c.bottom,i=c.height,j=c.width,k=d.left,l=d.right,n=d.top,p=d.bottom,q=d.height,r=d.width,t=m.innerHeight,u=m.innerWidth,v=m.getComputedStyle(this).writingMode,w="horizontal-tb"===v,y="vertical-rl"===v,z=F(a,0,w,y),A=F(a,1,w,y),C=0,D=0,G=0,H=0,I=0,J=0;switch(z){case 4:C=k-e,I=e,G=k;break;case 1:C=k-e+r/2-j/2,I=(e+f-u)/2,G=(k+l-u)/2;break;case 5:C=l-f,I=f-u,G=l-u;break;case 0:{var K=k+C;k<=e&&r<=j||l>=f&&r>=j?(C=k-e,K=e):(k<e&&r>j||l>f&&r<j)&&(C=l-f,K=f-r),0>K&&r<=u||K+r>u&&r>u?I=K:(0>K&&r>u||K+r>=u&&r<=u)&&(I=K+r-u),G=C+I}}switch(A){case 2:D=n-g,J=g,H=n;break;case 1:D=n-g+q/2-i/2,J=(g+h-t)/2,H=(n+p-t)/2;break;case 3:D=p-h,J=h-t,H=p-t;break;case 0:{var K=n+D;n<=g&&q<=i||p>=h&&q>=i?(D=n-g,K=g):(n<g&&q>i||p>h&&q<i)&&(D=p-h,K=h-q),0>K&&q<=t||K+q>t&&q>t?J=K:(0>K&&q>t||K+q>=t&&q<=t)&&(J=K+q-t),H=D+J}}b===o.body?m.scrollBy({left:G,top:H,behavior:"smooth"}):(E.call(this,b,b.scrollLeft+C,b.scrollTop+D),"fixed"!==m.getComputedStyle(b).position&&m.scrollBy({left:I,top:J,behavior:"smooth"}))}}},b="undefined"!=typeof document&&(document.currentScript||document.querySelector("script[data-seamless]"));if(b){var c=b.dataset.polyfill,d=~~b.dataset.duration;d=0<d?d:void 0,a({force:"force"===c,duration:d})}else global.seamless=a})(); | ||
(function(){'use strict';var a=function(a){function b(){D=!0,m.clearTimeout(p),p=m.setTimeout(c,q)}function c(){D=!1,m.removeEventListener("wheel",b),m.removeEventListener("touchmove",b)}function d(a,b){if(void 0!==a){if(!0===x(a))return void s.scroll.call(m,void 0===a.left?"object"==typeof a?m.scrollX||m.pageXOffset:a:a.left,void 0===a.top?void 0===b?m.scrollY||m.pageYOffset:b:a.top);var c=a,d=c.left,e=void 0===d?m.scrollX||m.pageXOffset:d,f=c.top,g=void 0===f?m.scrollY||m.pageYOffset:f;E.call(m,o.body,~~e,~~g)}}function e(a,b){return void 0===a?void 0:x(a)?void s.scrollBy.call(m,void 0===a.left?"object"==typeof a?0:a:a.left,void 0===a.top?void 0===b?0:b:a.top):void E.call(m,o.body,~~a.left+(m.scrollX||m.pageXOffset),~~a.top+(m.scrollY||m.pageYOffset))}function f(a,b){if(void 0!==a){if(!0===x(a)){if("number"==typeof a&&void 0===b)throw new SyntaxError("Value could not be converted");return void s.elementScroll.call(this,void 0===a.left?"object"==typeof a?this.scrollLeft:~~a:~~a.left,void 0===a.top?void 0===b?this.scrollTop:~~b:~~a.top)}var c=a,d=c.left,e=void 0===d?this.scrollLeft:d,f=c.top,g=void 0===f?this.scrollTop:f;E.call(this,this,~~e,~~g)}}function g(a,b){return void 0===a?void 0:!0===x(a)?void s.elementScroll.call(this,void 0===a.left?~~a+this.scrollLeft:~~a.left+this.scrollLeft,void 0===a.top?~~b+this.scrollTop:~~a.top+this.scrollTop):void this.scroll({left:~~a.left+this.scrollLeft,top:~~a.top+this.scrollTop,behavior:a.behavior})}var h=void 0===a?{}:a,i=h.force,j=h.duration,k=void 0===j?468:j,l=h.win,m=void 0===l?window:l,n=h.doc,o=void 0===n?document:n;if(!("scrollBehavior"in o.documentElement.style&&!0!==(void 0!==i&&i))){var p,q=~~k,r=function(a,b){this.scrollLeft=a,this.scrollTop=b},s={scroll:m.scroll||m.scrollTo,scrollBy:m.scrollBy,elementScroll:m.Element.prototype.scroll||r,scrollIntoView:m.Element.prototype.scrollIntoView},t=m.performance&&m.performance.now?m.performance.now.bind(m.performance):Date.now,u=function(a){return new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)},v=u(m.navigator.userAgent)?1:0,w=function(a){var b=Math.cos,c=Math.PI;return .5*(1-b(c*a))},x=function(a){if(null===a||"object"!=typeof a||void 0===a.behavior||"auto"===a.behavior)return!0;if("object"==typeof a&&"smooth"===a.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+a.behavior+" is not a valid value for enumeration ScrollBehavior.")},y=function(a,b){return"Y"===b?a.clientHeight+v<a.scrollHeight:"X"===b&&a.clientWidth+v<a.scrollWidth},z=function(a,b){var c=m.getComputedStyle(a,null)["overflow"+b];return"auto"===c||"scroll"===c},A=function(a){var b=y(a,"Y")&&z(a,"Y"),c=y(a,"X")&&z(a,"X");return b||c},B=function(a){var b=a;do b=b.parentElement;while(b!==o.body&&!1===A(b));return b},C=function(a){if(!D){var b=t(),c=(b-a.startTime)/q;c=1<c?1:c;var d=w(c),e=a.startX+(a.x-a.startX)*d,f=a.startY+(a.y-a.startY)*d;a.method.call(a.scrollable,e,f),(e!==a.x||f!==a.y)&&m.requestAnimationFrame(C.bind(m,a))}},D=!1,E=function(a,c,d){var e,f,g,h,i=t();a===o.body?(e=m,f=m.scrollX||m.pageXOffset,g=m.scrollY||m.pageYOffset,h=s.scroll):(e=a,f=a.scrollLeft,g=a.scrollTop,h=r),m.addEventListener("wheel",b,{passive:!0,once:!0}),m.addEventListener("touchmove",b,{passive:!0,once:!0}),C({scrollable:e,method:h,startTime:i,startX:f,startY:g,x:c,y:d})};m.scroll=m.scrollTo=d,m.scrollBy=e,m.Element.prototype.scroll=m.Element.prototype.scrollTo=f,m.Element.prototype.scrollBy=g;var F=function(a,b,c,d){var e=0===b&&c||1===b&&!c?a.inline:a.block;return"center"===e?1:"nearest"===e?0:"start"===e?0===b?d?5:4:2:"end"===e?0===b?d?4:5:3:c?0===b?0:2:0===b?4:0};m.Element.prototype.scrollIntoView=function(a){if(void 0===a||!0===a||!1===a||!0===x(a))return void s.scrollIntoView.call(this,void 0===a||a);var b=B(this),c=b.getBoundingClientRect(),d=this.getBoundingClientRect(),e=c.left,f=c.right,g=c.top,h=c.bottom,i=c.height,j=c.width,k=d.left,l=d.right,n=d.top,p=d.bottom,q=d.height,r=d.width,t=m.innerHeight,u=m.innerWidth,v=m.getComputedStyle(this).writingMode,w="horizontal-tb"===v,y="vertical-rl"===v,z=F(a,0,w,y),A=F(a,1,w,y),C=0,D=0,G=0,H=0,I=0,J=0;switch(z){case 4:C=k-e,I=e,G=k;break;case 1:C=k-e+r/2-j/2,I=(e+f-u)/2,G=(k+l-u)/2;break;case 5:C=l-f,I=f-u,G=l-u;break;case 0:{var K=k+C;k<=e&&r<=j||l>=f&&r>=j?(C=k-e,K=e):(k<e&&r>j||l>f&&r<j)&&(C=l-f,K=f-r),0>K&&r<=u||K+r>u&&r>u?I=K:(0>K&&r>u||K+r>=u&&r<=u)&&(I=K+r-u),G=C+I}}switch(A){case 2:D=n-g,J=g,H=n;break;case 1:D=n-g+q/2-i/2,J=(g+h-t)/2,H=(n+p-t)/2;break;case 3:D=p-h,J=h-t,H=p-t;break;case 0:{var K=n+D;n<=g&&q<=i||p>=h&&q>=i?(D=n-g,K=g):(n<g&&q>i||p>h&&q<i)&&(D=p-h,K=h-q),0>K&&q<=t||K+q>t&&q>t?J=K:(0>K&&q>t||K+q>=t&&q<=t)&&(J=K+q-t),H=D+J}}b===o.body?m.scrollBy({left:G,top:H,behavior:"smooth"}):(E.call(this,b,b.scrollLeft+C,b.scrollTop+D),"fixed"!==m.getComputedStyle(b).position&&m.scrollBy({left:I,top:J,behavior:"smooth"}))}}},b="undefined"!=typeof document&&(document.currentScript||document.querySelector("script[data-seamless]"));if(b){var c=b.dataset.polyfill,d=~~b.dataset.duration;d=0<d?d:void 0,a({force:"force"===c,duration:d})}})(); | ||
//# sourceMappingURL=seamless.browser.min.js.map |
@@ -1,2 +0,2 @@ | ||
(function(a){"function"==typeof define&&define.amd?define(a):a()})(function(){'use strict';var a=function(a){function b(){D=!0,m.clearTimeout(p),p=m.setTimeout(c,q)}function c(){D=!1,m.removeEventListener("wheel",b),m.removeEventListener("touchmove",b)}function d(a,b){if(void 0!==a){if(!0===x(a))return void s.scroll.call(m,void 0===a.left?"object"==typeof a?m.scrollX||m.pageXOffset:a:a.left,void 0===a.top?void 0===b?m.scrollY||m.pageYOffset:b:a.top);var c=a,d=c.left,e=void 0===d?m.scrollX||m.pageXOffset:d,f=c.top,g=void 0===f?m.scrollY||m.pageYOffset:f;E.call(m,o.body,~~e,~~g)}}function e(a,b){return void 0===a?void 0:x(a)?void s.scrollBy.call(m,void 0===a.left?"object"==typeof a?0:a:a.left,void 0===a.top?void 0===b?0:b:a.top):void E.call(m,o.body,~~a.left+(m.scrollX||m.pageXOffset),~~a.top+(m.scrollY||m.pageYOffset))}function f(a,b){if(void 0!==a){if(!0===x(a)){if("number"==typeof a&&void 0===b)throw new SyntaxError("Value could not be converted");return void s.elementScroll.call(this,void 0===a.left?"object"==typeof a?this.scrollLeft:~~a:~~a.left,void 0===a.top?void 0===b?this.scrollTop:~~b:~~a.top)}var c=a,d=c.left,e=void 0===d?this.scrollLeft:d,f=c.top,g=void 0===f?this.scrollTop:f;E.call(this,this,~~e,~~g)}}function g(a,b){return void 0===a?void 0:!0===x(a)?void s.elementScroll.call(this,void 0===a.left?~~a+this.scrollLeft:~~a.left+this.scrollLeft,void 0===a.top?~~b+this.scrollTop:~~a.top+this.scrollTop):void this.scroll({left:~~a.left+this.scrollLeft,top:~~a.top+this.scrollTop,behavior:a.behavior})}var h=void 0===a?{}:a,i=h.force,j=h.duration,k=void 0===j?468:j,l=h.win,m=void 0===l?window:l,n=h.doc,o=void 0===n?document:n;if(!("scrollBehavior"in o.documentElement.style&&!0!==(void 0!==i&&i))){var p,q=~~k,r=function(a,b){this.scrollLeft=a,this.scrollTop=b},s={scroll:m.scroll||m.scrollTo,scrollBy:m.scrollBy,elementScroll:m.Element.prototype.scroll||r,scrollIntoView:m.Element.prototype.scrollIntoView},t=m.performance&&m.performance.now?m.performance.now.bind(m.performance):Date.now,u=function(a){return new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)},v=u(m.navigator.userAgent)?1:0,w=function(a){var b=Math.cos,c=Math.PI;return .5*(1-b(c*a))},x=function(a){if(null===a||"object"!=typeof a||void 0===a.behavior||"auto"===a.behavior)return!0;if("object"==typeof a&&"smooth"===a.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+a.behavior+" is not a valid value for enumeration ScrollBehavior.")},y=function(a,b){return"Y"===b?a.clientHeight+v<a.scrollHeight:"X"===b&&a.clientWidth+v<a.scrollWidth},z=function(a,b){var c=m.getComputedStyle(a,null)["overflow"+b];return"auto"===c||"scroll"===c},A=function(a){var b=y(a,"Y")&&z(a,"Y"),c=y(a,"X")&&z(a,"X");return b||c},B=function(a){var b=a;do b=b.parentElement;while(b!==o.body&&!1===A(b));return b},C=function(a){if(!D){var b=t(),c=(b-a.startTime)/q;c=1<c?1:c;var d=w(c),e=a.startX+(a.x-a.startX)*d,f=a.startY+(a.y-a.startY)*d;a.method.call(a.scrollable,e,f),(e!==a.x||f!==a.y)&&m.requestAnimationFrame(C.bind(m,a))}},D=!1,E=function(a,c,d){var e,f,g,h,i=t();a===o.body?(e=m,f=m.scrollX||m.pageXOffset,g=m.scrollY||m.pageYOffset,h=s.scroll):(e=a,f=a.scrollLeft,g=a.scrollTop,h=r),m.addEventListener("wheel",b,{passive:!0,once:!0}),m.addEventListener("touchmove",b,{passive:!0,once:!0}),C({scrollable:e,method:h,startTime:i,startX:f,startY:g,x:c,y:d})};m.scroll=m.scrollTo=d,m.scrollBy=e,m.Element.prototype.scroll=m.Element.prototype.scrollTo=f,m.Element.prototype.scrollBy=g;var F=function(a,b,c,d){var e=0===b&&c||1===b&&!c?a.inline:a.block;return"center"===e?1:"nearest"===e?0:"start"===e?0===b?d?5:4:2:"end"===e?0===b?d?4:5:3:c?0===b?0:2:0===b?4:0};m.Element.prototype.scrollIntoView=function(a){if(void 0===a||!0===a||!1===a||!0===x(a))return void s.scrollIntoView.call(this,void 0===a||a);var b=B(this),c=b.getBoundingClientRect(),d=this.getBoundingClientRect(),e=c.left,f=c.right,g=c.top,h=c.bottom,i=c.height,j=c.width,k=d.left,l=d.right,n=d.top,p=d.bottom,q=d.height,r=d.width,t=m.innerHeight,u=m.innerWidth,v=m.getComputedStyle(this).writingMode,w="horizontal-tb"===v,y="vertical-rl"===v,z=F(a,0,w,y),A=F(a,1,w,y),C=0,D=0,G=0,H=0,I=0,J=0;switch(z){case 4:C=k-e,I=e,G=k;break;case 1:C=k-e+r/2-j/2,I=(e+f-u)/2,G=(k+l-u)/2;break;case 5:C=l-f,I=f-u,G=l-u;break;case 0:{var K=k+C;k<=e&&r<=j||l>=f&&r>=j?(C=k-e,K=e):(k<e&&r>j||l>f&&r<j)&&(C=l-f,K=f-r),0>K&&r<=u||K+r>u&&r>u?I=K:(0>K&&r>u||K+r>=u&&r<=u)&&(I=K+r-u),G=C+I}}switch(A){case 2:D=n-g,J=g,H=n;break;case 1:D=n-g+q/2-i/2,J=(g+h-t)/2,H=(n+p-t)/2;break;case 3:D=p-h,J=h-t,H=p-t;break;case 0:{var K=n+D;n<=g&&q<=i||p>=h&&q>=i?(D=n-g,K=g):(n<g&&q>i||p>h&&q<i)&&(D=p-h,K=h-q),0>K&&q<=t||K+q>t&&q>t?J=K:(0>K&&q>t||K+q>=t&&q<=t)&&(J=K+q-t),H=D+J}}b===o.body?m.scrollBy({left:G,top:H,behavior:"smooth"}):(E.call(this,b,b.scrollLeft+C,b.scrollTop+D),"fixed"!==m.getComputedStyle(b).position&&m.scrollBy({left:I,top:J,behavior:"smooth"}))}}},b="undefined"!=typeof document&&(document.currentScript||document.querySelector("script[data-seamless]"));if(b){var c=b.dataset.polyfill,d=~~b.dataset.duration;d=0<d?d:void 0,a({force:"force"===c,duration:d})}else global.seamless=a}); | ||
(function(a){"function"==typeof define&&define.amd?define(a):a()})(function(){'use strict';var a=function(a){function b(){D=!0,m.clearTimeout(p),p=m.setTimeout(c,q)}function c(){D=!1,m.removeEventListener("wheel",b),m.removeEventListener("touchmove",b)}function d(a,b){if(void 0!==a){if(!0===x(a))return void s.scroll.call(m,void 0===a.left?"object"==typeof a?m.scrollX||m.pageXOffset:a:a.left,void 0===a.top?void 0===b?m.scrollY||m.pageYOffset:b:a.top);var c=a,d=c.left,e=void 0===d?m.scrollX||m.pageXOffset:d,f=c.top,g=void 0===f?m.scrollY||m.pageYOffset:f;E.call(m,o.body,~~e,~~g)}}function e(a,b){return void 0===a?void 0:x(a)?void s.scrollBy.call(m,void 0===a.left?"object"==typeof a?0:a:a.left,void 0===a.top?void 0===b?0:b:a.top):void E.call(m,o.body,~~a.left+(m.scrollX||m.pageXOffset),~~a.top+(m.scrollY||m.pageYOffset))}function f(a,b){if(void 0!==a){if(!0===x(a)){if("number"==typeof a&&void 0===b)throw new SyntaxError("Value could not be converted");return void s.elementScroll.call(this,void 0===a.left?"object"==typeof a?this.scrollLeft:~~a:~~a.left,void 0===a.top?void 0===b?this.scrollTop:~~b:~~a.top)}var c=a,d=c.left,e=void 0===d?this.scrollLeft:d,f=c.top,g=void 0===f?this.scrollTop:f;E.call(this,this,~~e,~~g)}}function g(a,b){return void 0===a?void 0:!0===x(a)?void s.elementScroll.call(this,void 0===a.left?~~a+this.scrollLeft:~~a.left+this.scrollLeft,void 0===a.top?~~b+this.scrollTop:~~a.top+this.scrollTop):void this.scroll({left:~~a.left+this.scrollLeft,top:~~a.top+this.scrollTop,behavior:a.behavior})}var h=void 0===a?{}:a,i=h.force,j=h.duration,k=void 0===j?468:j,l=h.win,m=void 0===l?window:l,n=h.doc,o=void 0===n?document:n;if(!("scrollBehavior"in o.documentElement.style&&!0!==(void 0!==i&&i))){var p,q=~~k,r=function(a,b){this.scrollLeft=a,this.scrollTop=b},s={scroll:m.scroll||m.scrollTo,scrollBy:m.scrollBy,elementScroll:m.Element.prototype.scroll||r,scrollIntoView:m.Element.prototype.scrollIntoView},t=m.performance&&m.performance.now?m.performance.now.bind(m.performance):Date.now,u=function(a){return new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)},v=u(m.navigator.userAgent)?1:0,w=function(a){var b=Math.cos,c=Math.PI;return .5*(1-b(c*a))},x=function(a){if(null===a||"object"!=typeof a||void 0===a.behavior||"auto"===a.behavior)return!0;if("object"==typeof a&&"smooth"===a.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+a.behavior+" is not a valid value for enumeration ScrollBehavior.")},y=function(a,b){return"Y"===b?a.clientHeight+v<a.scrollHeight:"X"===b&&a.clientWidth+v<a.scrollWidth},z=function(a,b){var c=m.getComputedStyle(a,null)["overflow"+b];return"auto"===c||"scroll"===c},A=function(a){var b=y(a,"Y")&&z(a,"Y"),c=y(a,"X")&&z(a,"X");return b||c},B=function(a){var b=a;do b=b.parentElement;while(b!==o.body&&!1===A(b));return b},C=function(a){if(!D){var b=t(),c=(b-a.startTime)/q;c=1<c?1:c;var d=w(c),e=a.startX+(a.x-a.startX)*d,f=a.startY+(a.y-a.startY)*d;a.method.call(a.scrollable,e,f),(e!==a.x||f!==a.y)&&m.requestAnimationFrame(C.bind(m,a))}},D=!1,E=function(a,c,d){var e,f,g,h,i=t();a===o.body?(e=m,f=m.scrollX||m.pageXOffset,g=m.scrollY||m.pageYOffset,h=s.scroll):(e=a,f=a.scrollLeft,g=a.scrollTop,h=r),m.addEventListener("wheel",b,{passive:!0,once:!0}),m.addEventListener("touchmove",b,{passive:!0,once:!0}),C({scrollable:e,method:h,startTime:i,startX:f,startY:g,x:c,y:d})};m.scroll=m.scrollTo=d,m.scrollBy=e,m.Element.prototype.scroll=m.Element.prototype.scrollTo=f,m.Element.prototype.scrollBy=g;var F=function(a,b,c,d){var e=0===b&&c||1===b&&!c?a.inline:a.block;return"center"===e?1:"nearest"===e?0:"start"===e?0===b?d?5:4:2:"end"===e?0===b?d?4:5:3:c?0===b?0:2:0===b?4:0};m.Element.prototype.scrollIntoView=function(a){if(void 0===a||!0===a||!1===a||!0===x(a))return void s.scrollIntoView.call(this,void 0===a||a);var b=B(this),c=b.getBoundingClientRect(),d=this.getBoundingClientRect(),e=c.left,f=c.right,g=c.top,h=c.bottom,i=c.height,j=c.width,k=d.left,l=d.right,n=d.top,p=d.bottom,q=d.height,r=d.width,t=m.innerHeight,u=m.innerWidth,v=m.getComputedStyle(this).writingMode,w="horizontal-tb"===v,y="vertical-rl"===v,z=F(a,0,w,y),A=F(a,1,w,y),C=0,D=0,G=0,H=0,I=0,J=0;switch(z){case 4:C=k-e,I=e,G=k;break;case 1:C=k-e+r/2-j/2,I=(e+f-u)/2,G=(k+l-u)/2;break;case 5:C=l-f,I=f-u,G=l-u;break;case 0:{var K=k+C;k<=e&&r<=j||l>=f&&r>=j?(C=k-e,K=e):(k<e&&r>j||l>f&&r<j)&&(C=l-f,K=f-r),0>K&&r<=u||K+r>u&&r>u?I=K:(0>K&&r>u||K+r>=u&&r<=u)&&(I=K+r-u),G=C+I}}switch(A){case 2:D=n-g,J=g,H=n;break;case 1:D=n-g+q/2-i/2,J=(g+h-t)/2,H=(n+p-t)/2;break;case 3:D=p-h,J=h-t,H=p-t;break;case 0:{var K=n+D;n<=g&&q<=i||p>=h&&q>=i?(D=n-g,K=g):(n<g&&q>i||p>h&&q<i)&&(D=p-h,K=h-q),0>K&&q<=t||K+q>t&&q>t?J=K:(0>K&&q>t||K+q>=t&&q<=t)&&(J=K+q-t),H=D+J}}b===o.body?m.scrollBy({left:G,top:H,behavior:"smooth"}):(E.call(this,b,b.scrollLeft+C,b.scrollTop+D),"fixed"!==m.getComputedStyle(b).position&&m.scrollBy({left:I,top:J,behavior:"smooth"}))}}},b="undefined"!=typeof document&&(document.currentScript||document.querySelector("script[data-seamless]"));if(b){var c=b.dataset.polyfill,d=~~b.dataset.duration;d=0<d?d:void 0,a({force:"force"===c,duration:d})}}); | ||
//# sourceMappingURL=seamless.es5.min.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Smooth Scroll behavior polyfill", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"author": { | ||
@@ -21,15 +21,15 @@ "name": "Dustan Kasten", | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"ava": "^1.4.1", | ||
"lodash.clonedeep": "^4.5.0", | ||
"prettier": "^1.16.4", | ||
"rollup": "^1.5.0", | ||
"rollup-plugin-babel-minify": "^7.0.0", | ||
"rollup-plugin-typescript2": "^0.19.3", | ||
"rollup": "^1.9.3", | ||
"rollup-plugin-babel-minify": "^8.0.0", | ||
"rollup-plugin-typescript2": "^0.20.1", | ||
"ts-node": "^8.0.3", | ||
"tslint": "^5.13.1", | ||
"tslint": "^5.15.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.3.3333" | ||
"typescript": "^3.4.3" | ||
}, | ||
"main": "dist/seamless.js", | ||
"main": "dist/seamless.es5.js", | ||
"umd:main": "dist/seamless.js", | ||
@@ -40,2 +40,3 @@ "jsnext:main": "dist/seamless.esm.js", | ||
"files": [ | ||
"src", | ||
"dist" | ||
@@ -42,0 +43,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21
23.53%1809
41.55%193541
-39.71%