2023-08-17 09:47:40 +00:00
|
|
|
!function(D,R,I){"use strict";function V(e){return"function"==typeof e&&"number"!=typeof e.nodeType}R=void 0!==R&&R.Math===Math?R:globalThis,D.fn.sidebar=function(T){var k,e=D(this),w=D(R),A=D(I),F=D("body"),O=D("html"),P=D("head"),E=e.selector||"",B=Date.now(),H=[],M=T,L="string"==typeof M,j=[].slice.call(arguments,1);return e.each(function(){var t,r,e,s,a=D.isPlainObject(T)?D.extend(!0,{},D.fn.sidebar.settings,T):D.extend({},D.fn.sidebar.settings),i=a.selector,l=a.className,n=a.namespace,o=a.regExp,c=a.error,d="."+n,u="module-"+n,f=D(this),h=[R,I].indexOf(a.context)<0?A.find(a.context):F,b=h[0]===F[0],g=f.children(i.sidebar),m=(h.children(i.fixed),h.children(i.pusher)),v=this,p=f.data(u),y="",x="",S=!1,C={initialize:function(){C.debug("Initializing sidebar",T),C.create.id(),a.delaySetup?requestAnimationFrame(C.setup.layout):C.setup.layout(),requestAnimationFrame(function(){C.setup.cache()}),C.instantiate()},instantiate:function(){C.verbose("Storing instance of module",C),p=C,f.data(u,C)},create:{id:function(){e=(Math.random().toString(16)+"000000000").slice(2,10),r="."+e,C.verbose("Creating unique id for element",e)}},destroy:function(){C.verbose("Destroying previous module for",f),f.off(d).removeData(u),C.is.ios()&&C.remove.ios(),h.off(r),w.off(r),A.off(r)},event:{clickaway:function(e){var i;a.closable&&(i=0<m.find(e.target).length||m.is(e.target),e=h.is(e.target),i&&(C.verbose("User clicked on dimmed page"),C.hide()),e)&&(C.verbose("User clicked on dimmable context (scaled out page)"),C.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(i.sidebar).length&&e.preventDefault()}},bind:{clickaway:function(){C.verbose("Adding clickaway events to context",h),h.on("click"+r,C.event.clickaway).on("touchend"+r,C.event.clickaway)},scrollLock:function(){a.scrollLock&&(C.debug("Disabling page scroll"),(S=C.has.scrollbar())&&(C.save.bodyMargin(),C.set.bodyMargin()),h.addClass(l.locked)),C.verbose("Adding events to contain sidebar scroll"),A.on("touchmove"+r,C.event.touch),f.on("scroll"+d,C.event.containScroll)}},unbind:{clickaway:function(){C.verbose("Removing clickaway events from context",h),h.off(r)},scrollLock:function(){C.verbose("Removing scroll lock from page"),S&&C.restore.bodyMargin(),h.removeClass(l.locked),A.off(r),f.off("scroll"+d)}},add:{inlineCSS:function(){var e=C.cache.width||f.outerWidth(),i=C.cache.height||f.outerHeight(),n=C.is.rtl(),o=C.get.direction(),i={left:e,right:-e,top:i,bottom:-i};n&&(C.verbose("RTL detected, flipping widths"),i.left=-e,i.right=e),n="<style>","left"===o||"right"===o?(C.debug("Adding CSS rules for animation distance",e),n+=" .ui.visible."+o+".sidebar ~ .fixed, .ui.visible."+o+".sidebar ~ .pusher { transform: translate3d("+i[o]+"px, 0, 0); }"):"top"!==o&&"bottom"!==o||(n+=" .ui.visible."+o+".sidebar ~ .fixed, .ui.visible."+o+".sidebar ~ .pusher { transform: translate3d(0, "+i[o]+"px, 0); }"),C.is.ie()&&("left"===o||"right"===o?(C.debug("Adding CSS rules for animation distance",e),n+=" body.pushable > .ui.visible."+o+".sidebar ~ .pusher::after { transform: translate3d("+i[o]+"px, 0, 0); }"):"top"!==o&&"bottom"!==o||(n+=" body.pushable > .ui.visible."+o+".sidebar ~ .pusher::after { transform: translate3d(0, "+i[o]+"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 { transform: translate3d(0, 0, 0); }"),t=D(n+="</style>").appendTo(P),C.debug("Adding sizing css to head",t)}},refresh:function(){C.verbose("Refreshing selector cache"),h=[R,I].indexOf(a.context)<0?A.find(a.context):F,C.refreshSidebars(),m=h.children(i.pusher),h.children(i.fixed),C.clear.cache()},refreshSidebars:function(){C.verbose("Refreshing other sidebars"),g=h.children(i.sidebar)},repaint:function(){C.verbose("Forcing repaint event"),v.style.display="none";v.offsetHeight;v
|