diff options
Diffstat (limited to 'js/yui3/node-scroll-info/node-scroll-info-min.js')
-rw-r--r-- | js/yui3/node-scroll-info/node-scroll-info-min.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/js/yui3/node-scroll-info/node-scroll-info-min.js b/js/yui3/node-scroll-info/node-scroll-info-min.js index 104319baf..92c80aaee 100644 --- a/js/yui3/node-scroll-info/node-scroll-info-min.js +++ b/js/yui3/node-scroll-info/node-scroll-info-min.js @@ -1,7 +1,8 @@ /* -YUI 3.7.3 (build 5687) -Copyright 2012 Yahoo! Inc. All rights reserved. +YUI 3.17.2 (build 9c3c78e) +Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ -YUI.add("node-scroll-info",function(e,t){var n="scroll",r="scrollDown",i="scrollLeft",s="scrollRight",o="scrollUp",u="scrollToBottom",a="scrollToLeft",f="scrollToRight",l="scrollToTop";e.Plugin.ScrollInfo=e.Base.create("scrollInfoPlugin",e.Plugin.Base,[],{initializer:function(e){this._host=e.host,this._hostIsBody=this._host.get("nodeName").toLowerCase()==="body",this._scrollDelay=this.get("scrollDelay"),this._scrollMargin=this.get("scrollMargin"),this._scrollNode=this._getScrollNode(),this.refreshDimensions(),this._lastScroll=this.getScrollInfo(),this._bind()},destructor:function(){(new e.EventHandle(this._events)).detach(),delete this._events},getOffscreenNodes:function(t,n){typeof n=="undefined"&&(n=this._scrollMargin);var r=this._lastScroll,i=this._host.all(t||"*"),s=r.scrollBottom+n,o=r.scrollLeft-n,u=r.scrollRight+n,a=r.scrollTop-n,f=this;return i.filter(function(t){var n=e.DOM.getXY(t),r=n[0]-f._left,i=n[1]-f._top,l,c;return r>=o&&r<u&&i>=a&&i<s?!1:(l=i+t.offsetHeight,c=r+t.offsetWidth,c<u&&c>=o&&l<s&&l>=a?!1:!0)})},getOnscreenNodes:function(t,n){typeof n=="undefined"&&(n=this._scrollMargin);var r=this._lastScroll,i=this._host.all(t||"*"),s=r.scrollBottom+n,o=r.scrollLeft-n,u=r.scrollRight+n,a=r.scrollTop-n,f=this;return i.filter(function(t){var n=e.DOM.getXY(t),r=n[0]-f._left,i=n[1]-f._top,l,c;return r>=o&&r<u&&i>=a&&i<s?!0:(l=i+t.offsetHeight,c=r+t.offsetWidth,c<u&&c>=o&&l<s&&l>=a?!0:!1)})},getScrollInfo:function(){var e=this._scrollNode,t=this._lastScroll,n=this._scrollMargin,r=e.scrollLeft,i=e.scrollHeight,s=e.scrollTop,o=e.scrollWidth,u=s+this._height,a=r+this._width;return{atBottom:u>i-n,atLeft:r<n,atRight:a>o-n,atTop:s<n,isScrollDown:t&&s>t.scrollTop,isScrollLeft:t&&r<t.scrollLeft,isScrollRight:t&&r>t.scrollLeft,isScrollUp:t&&s<t.scrollTop,scrollBottom:u,scrollHeight:i,scrollLeft:r,scrollRight:a,scrollTop:s,scrollWidth:o}},refreshDimensions:function(){var t=this._hostIsBody,n=t&&e.UA.ios,r=e.config.win,i;t&&e.UA.webkit?i=e.config.doc.documentElement:i=this._scrollNode,this._height=n?r.innerHeight:i.clientHeight,this._left=i.offsetLeft,this._top=i.offsetTop,this._width=n?r.innerWidth:i.clientWidth},_bind:function(){var t=e.one("win");this._events=[this.after({scrollDelayChange:this._afterScrollDelayChange,scrollMarginChange:this._afterScrollMarginChange}),t.on("windowresize",this._afterResize,this),(this._hostIsBody?t:this._host).after("scroll",this._afterScroll,this)]},_getScrollNode:function(){return this._hostIsBody&&!e.UA.webkit?e.config.doc.documentElement:e.Node.getDOMNode(this._host)},_triggerScroll:function(t){var c=this.getScrollInfo(),h=e.merge(t,c),p=this._lastScroll;this._lastScroll=c,this.fire(n,h),c.isScrollLeft?this.fire(i,h):c.isScrollRight&&this.fire(s,h),c.isScrollUp?this.fire(o,h):c.isScrollDown&&this.fire(r,h),c.atBottom&&(!p.atBottom||c.scrollHeight>p.scrollHeight)&&this.fire(u,h),c.atLeft&&!p.atLeft&&this.fire(a,h),c.atRight&&(!p.atRight||c.scrollWidth>p.scrollWidth)&&this.fire(f,h),c.atTop&&!p.atTop&&this.fire(l,h)},_afterResize:function(e){this.refreshDimensions()},_afterScroll:function(e){var t=this;clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(function(){t._triggerScroll(e)},this._scrollDelay)},_afterScrollDelayChange:function(e){this._scrollDelay=e.newVal},_afterScrollMarginChange:function(e){this._scrollMargin=e.newVal}},{NS:"scrollInfo",ATTRS:{scrollDelay:{value:50},scrollMargin:{value:50}}})},"3.7.3",{requires:["base-build","dom-screen","event-resize","node-pluginhost","plugin"]}); + +YUI.add("node-scroll-info",function(e,t){var n=e.config.doc,r=e.config.win,i="scroll",s="scrollDown",o="scrollLeft",u="scrollRight",a="scrollUp",f="scrollToBottom",l="scrollToLeft",c="scrollToRight",h="scrollToTop";e.Plugin.ScrollInfo=e.Base.create("scrollInfoPlugin",e.Plugin.Base,[],{initializer:function(e){this._host=e.host,this._hostIsBody=this._host.get("nodeName").toLowerCase()==="body",this._scrollDelay=this.get("scrollDelay"),this._scrollMargin=this.get("scrollMargin"),this._scrollNode=this._getScrollNode(),this.refreshDimensions(),this._lastScroll=this.getScrollInfo(),this._bind()},destructor:function(){(new e.EventHandle(this._events)).detach(),this._events=null},getOffscreenNodes:function(t,n){typeof n=="undefined"&&(n=this._scrollMargin);var r=e.Selector.query(t||"*",this._host._node);return new e.NodeList(e.Array.filter(r,function(e){return!this._isElementOnscreen(e,n)},this))},getOnscreenNodes:function(t,n){typeof n=="undefined"&&(n=this._scrollMargin);var r=e.Selector.query(t||"*",this._host._node);return new e.NodeList(e.Array.filter(r,function(e){return this._isElementOnscreen(e,n)},this))},getScrollInfo:function(){var e=this._scrollNode,t=this._lastScroll,n=this._scrollMargin,r=e.scrollLeft,i=e.scrollHeight,s=e.scrollTop,o=e.scrollWidth,u=s+this._height,a=r+this._width;return{atBottom:u>i-n,atLeft:r<n,atRight:a>o-n,atTop:s<n,isScrollDown:t&&s>t.scrollTop,isScrollLeft:t&&r<t.scrollLeft,isScrollRight:t&&r>t.scrollLeft,isScrollUp:t&&s<t.scrollTop,scrollBottom:u,scrollHeight:i,scrollLeft:r,scrollRight:a,scrollTop:s,scrollWidth:o}},isNodeOnscreen:function(t,n){return t=e.one(t),!!t&&!!this._isElementOnscreen(t._node,n)},refreshDimensions:function(){var t=n.documentElement;e.UA.ios||e.UA.android&&e.UA.chrome?(this._winHeight=r.innerHeight,this._winWidth=r.innerWidth):(this._winHeight=t.clientHeight,this._winWidth=t.clientWidth),this._hostIsBody?(this._height=this._winHeight,this._width=this._winWidth):(this._height=this._scrollNode.clientHeight,this._width=this._scrollNode.clientWidth),this._refreshHostBoundingRect()},_bind:function(){var t=e.one("win");this._events=[this.after({scrollDelayChange:this._afterScrollDelayChange,scrollMarginChange:this._afterScrollMarginChange}),t.on("windowresize",this._afterResize,this)],this._hostIsBody?this._events.push(t.after("scroll",this._afterHostScroll,this)):this._events.push(t.after("scroll",this._afterWindowScroll,this),this._host.after("scroll",this._afterHostScroll,this))},_getScrollNode:function(){return this._hostIsBody&&!e.UA.webkit?n.documentElement:e.Node.getDOMNode(this._host)},_isElementOnscreen:function(e,t){var n=this._hostRect,r=e.getBoundingClientRect();return typeof t=="undefined"&&(t=this._scrollMargin),!(r.top>n.bottom+t||r.bottom<n.top-t||r.right<n.left-t||r.left>n.right+t)},_refreshHostBoundingRect:function(){var e=this._winHeight,t=this._winWidth,n;this._hostIsBody?(n={bottom:e,height:e,left:0,right:t,top:0,width:t},this._isHostOnscreen=!0):n=this._scrollNode.getBoundingClientRect(),this._hostRect=n},_triggerScroll:function(t){var n=this.getScrollInfo(),r=e.merge(t,n),p=this._lastScroll;this._lastScroll=n,this.fire(i,r),n.isScrollLeft?this.fire(o,r):n.isScrollRight&&this.fire(u,r),n.isScrollUp?this.fire(a,r):n.isScrollDown&&this.fire(s,r),n.atBottom&&(!p.atBottom||n.scrollHeight>p.scrollHeight)&&this.fire(f,r),n.atLeft&&!p.atLeft&&this.fire(l,r),n.atRight&&(!p.atRight||n.scrollWidth>p.scrollWidth)&&this.fire(c,r),n.atTop&&!p.atTop&&this.fire(h,r)},_afterHostScroll:function(e){var t=this;clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(function(){t._triggerScroll(e)},this._scrollDelay)},_afterResize:function(){this.refreshDimensions()},_afterScrollDelayChange:function(e){this._scrollDelay=e.newVal},_afterScrollMarginChange:function(e){this._scrollMargin=e.newVal},_afterWindowScroll:function(){this._refreshHostBoundingRect()}},{NS:"scrollInfo",ATTRS:{scrollDelay:{value:50},scrollMargin:{value:50}}})},"3.17.2",{requires:["array-extras","base-build","event-resize","node-pluginhost","plugin","selector"]}); |