wishthis/node_modules/fomantic-ui/dist/components/sidebar.min.js

11 lines
14 KiB
JavaScript
Raw Normal View History

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