You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/Web/Semantic-UI-CSS-master/components/sticky.min.js

1 line
12 KiB

!function(T,w,B,P){"use strict";w=void 0!==w&&w.Math==Math?w:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),T.fn.sticky=function(b){var v,e=T(this),x=e.selector||"",C=(new Date).getTime(),S=[],y=b,k="string"==typeof y,z=[].slice.call(arguments,1);return e.each(function(){var n,i,e,t,m,u=T.isPlainObject(b)?T.extend(!0,{},T.fn.sticky.settings,b):T.extend({},T.fn.sticky.settings),o=u.className,s=u.namespace,r=u.error,c="."+s,l="module-"+s,a=T(this),f=T(w),d=T(u.scrollContext),h=(a.selector,a.data(l)),g=w.requestAnimationFrame||w.mozRequestAnimationFrame||w.webkitRequestAnimationFrame||w.msRequestAnimationFrame||function(e){setTimeout(e,0)},p=this;m={initialize:function(){m.determineContainer(),m.determineContext(),m.verbose("Initializing sticky",u,n),m.save.positions(),m.checkErrors(),m.bind.events(),u.observeChanges&&m.observeChanges(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),h=m,a.data(l,m)},destroy:function(){m.verbose("Destroying previous instance"),m.reset(),e&&e.disconnect(),t&&t.disconnect(),f.off("load"+c,m.event.load).off("resize"+c,m.event.resize),d.off("scrollchange"+c,m.event.scrollchange),a.removeData(l)},observeChanges:function(){"MutationObserver"in w&&(e=new MutationObserver(m.event.documentChanged),t=new MutationObserver(m.event.changed),e.observe(B,{childList:!0,subtree:!0}),t.observe(p,{childList:!0,subtree:!0}),t.observe(i[0],{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",t))},determineContainer:function(){n=u.container?T(u.container):a.offsetParent()},determineContext:function(){0!==(i=u.context?T(u.context):n).length||m.error(r.invalidContext,u.context,a)},checkErrors:function(){if(m.is.hidden()&&m.error(r.visible,a),m.cache.element.height>m.cache.context.height)return m.reset(),void m.error(r.elementSize,a)},bind:{events:function(){f.on("load"+c,m.event.load).on("resize"+c,m.event.resize),d.off("scroll"+c).on("scroll"+c,m.event.scroll).on("scrollchange"+c,m.event.scrollchange)}},event:{changed:function(e){clearTimeout(m.timer),m.timer=setTimeout(function(){m.verbose("DOM tree modified, updating sticky menu",e),m.refresh()},100)},documentChanged:function(e){[].forEach.call(e,function(e){e.removedNodes&&[].forEach.call(e.removedNodes,function(e){(e==p||0<T(e).find(p).length)&&(m.debug("Element removed from DOM, tearing down events"),m.destroy())})})},load:function(){m.verbose("Page contents finished loading"),g(m.refresh)},resize:function(){m.verbose("Window resized"),g(m.refresh)},scroll:function(){g(function(){d.triggerHandler("scrollchange"+c,d.scrollTop())})},scrollchange:function(e,t){m.stick(t),u.onScroll.call(p)}},refresh:function(e){m.reset(),u.context||m.determineContext(),e&&m.determineContainer(),m.save.positions(),m.stick(),u.onReposition.call(p)},supports:{sticky:function(){var e=T("<div/>");e[0];return e.addClass(o.supported),e.css("position").match("sticky")}},save:{lastScroll:function(e){m.lastScroll=e},elementScroll:function(e){m.elementScroll=e},positions:function(){var e={height:d.height()},t={margin:{top:parseInt(a.css("margin-top"),10),bottom:parseInt(a.css("margin-bottom"),10)},offset:a.offset(),width:a.outerWidth(),height:a.outerHeight()},o={offset:i.offset(),height:i.outerHeight()};n.outerHeight();m.is.standardScroll()||(m.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=d.scrollTop(),e.left=d.scrollLeft(),t.offset.top+=e.top,o.offset.top+=e.top,t.offset.left+=e.left,o.offset.left+=e.left),m.cache={fits:t.height+u.offset<=e.height,sameHeight:t.height==o.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},m.set.containerSize(),m.stick(),m.debug("Caching element positions",m.cache)}},get:{direction:function(e){var t="down";return e=e||d.scrollTop(),m.lastScroll!==P&&(m.lastScroll<e?t="down":m.lastScroll>e&&(t="up")),t},scrollChange:function(e){return e=e||d.scrollTop(),m.lastS