You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openpower.foundation_sw_dev/themes/openpowerfoundation/static/lib/semantic-ui/components/sidebar.min.js

1 line
13 KiB
JavaScript

!function(e,i,n,t){"use strict";i=void 0!==i&&i.Math==Math?i:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.sidebar=function(o){var r,s=e(this),a=e(i),l=e(n),c=e("html"),d=e("head"),u=s.selector||"",f=(new Date).getTime(),b=[],h=arguments[0],m="string"==typeof h,g=[].slice.call(arguments,1),v=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(e){setTimeout(e,0)};return s.each(function(){var s,p,y,C,k,w,T=e.isPlainObject(o)?e.extend(!0,{},e.fn.sidebar.settings,o):e.extend({},e.fn.sidebar.settings),x=T.selector,S=T.className,A=T.namespace,F=T.regExp,O=T.error,P="."+A,E="module-"+A,H=e(this),M=e(T.context),D=H.children(x.sidebar),j=(M.children(x.fixed),M.children(x.pusher)),R=this,z=H.data(E);w={initialize:function(){w.debug("Initializing sidebar",o),w.create.id(),k=w.get.transitionEvent(),T.delaySetup?v(w.setup.layout):w.setup.layout(),v(function(){w.setup.cache()}),w.instantiate()},instantiate:function(){w.verbose("Storing instance of module",w),z=w,H.data(E,w)},create:{id:function(){y=(Math.random().toString(16)+"000000000").substr(2,8),p="."+y,w.verbose("Creating unique id for element",y)}},destroy:function(){w.verbose("Destroying previous module for",H),H.off(P).removeData(E),w.is.ios()&&w.remove.ios(),M.off(p),a.off(p),l.off(p)},event:{clickaway:function(e){var i=j.find(e.target).length>0||j.is(e.target),n=M.is(e.target);i&&(w.verbose("User clicked on dimmed page"),w.hide()),n&&(w.verbose("User clicked on dimmable context (scaled out page)"),w.hide())},touch:function(e){},containScroll:function(e){R.scrollTop<=0&&(R.scrollTop=1),R.scrollTop+R.offsetHeight>=R.scrollHeight&&(R.scrollTop=R.scrollHeight-R.offsetHeight-1)},scroll:function(i){0===e(i.target).closest(x.sidebar).length&&i.preventDefault()}},bind:{clickaway:function(){w.verbose("Adding clickaway events to context",M),T.closable&&M.on("click"+p,w.event.clickaway).on("touchend"+p,w.event.clickaway)},scrollLock:function(){T.scrollLock&&(w.debug("Disabling page scroll"),a.on("DOMMouseScroll"+p,w.event.scroll)),w.verbose("Adding events to contain sidebar scroll"),l.on("touchmove"+p,w.event.touch),H.on("scroll"+P,w.event.containScroll)}},unbind:{clickaway:function(){w.verbose("Removing clickaway events from context",M),M.off(p)},scrollLock:function(){w.verbose("Removing scroll lock from page"),l.off(p),a.off(p),H.off("scroll"+P)}},add:{inlineCSS:function(){var i,n=w.cache.width||H.outerWidth(),t=w.cache.height||H.outerHeight(),o=w.is.rtl(),r=w.get.direction(),a={left:n,right:-n,top:t,bottom:-t};o&&(w.verbose("RTL detected, flipping widths"),a.left=-n,a.right=n),i="<style>","left"===r||"right"===r?(w.debug("Adding CSS rules for animation distance",n),i+=" .ui.visible."+r+".sidebar ~ .fixed, .ui.visible."+r+".sidebar ~ .pusher { -webkit-transform: translate3d("+a[r]+"px, 0, 0); transform: translate3d("+a[r]+"px, 0, 0); }"):"top"!==r&&"bottom"!=r||(i+=" .ui.visible."+r+".sidebar ~ .fixed, .ui.visible."+r+".sidebar ~ .pusher { -webkit-transform: translate3d(0, "+a[r]+"px, 0); transform: translate3d(0, "+a[r]+"px, 0); }"),w.is.ie()&&("left"===r||"right"===r?(w.debug("Adding CSS rules for animation distance",n),i+=" body.pushable > .ui.visible."+r+".sidebar ~ .pusher:after { -webkit-transform: translate3d("+a[r]+"px, 0, 0); transform: translate3d("+a[r]+"px, 0, 0); }"):"top"!==r&&"bottom"!=r||(i+=" body.pushable > .ui.visible."+r+".sidebar ~ .pusher:after { -webkit-transform: translate3d(0, "+a[r]+"px, 0); transform: translate3d(0, "+a[r]+"px, 0); }"),i+=" body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); }"),s=e(i+="</style>").appendTo(d),w.debug("Adding sizing css to head",s)}},refresh:function(){w.verbose("Refreshing selector cache"),M=e(T.context),D=M.children(x.sidebar),j=M.children(x.pusher),M.children(x.fixed)