blue-twilight/public/semantic-ui/components/sidebar.min.js

10 lines
14 KiB
JavaScript
Raw Normal View History

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