|
|
/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI
* http://www.semantic-ui.com/
* * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT
* */ !function(e,i,t,n){"use strict";e.fn.sidebar=function(o){var r,s=e(this),a=e(i),l=e(t),c=e("head"),u=s.selector||"",d=(new Date).getTime(),f=[],b=arguments[0],m="string"==typeof b,p=[].slice.call(arguments,1),g=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(e){setTimeout(e,0)};return s.each(function(){var s,v,h,y,x,k,w=e.isPlainObject(o)?e.extend(!0,{},e.fn.sidebar.settings,o):e.extend({},e.fn.sidebar.settings),T=w.selector,C=w.className,S=w.namespace,P=w.error,F="."+S,A="module-"+S,z=e(this),O=e(w.context),E=z.children(T.sidebar),H=O.children(T.pusher),D=this,j=z.data(A);k={initialize:function(){k.debug("Initializing sidebar",o),x=k.get.transitionEvent(),(k.is.legacy()||w.legacy)&&(w.transition="overlay",w.useLegacy=!0),h=k.get.uniqueID(),v="."+h,g(k.setup.layout),k.instantiate()},instantiate:function(){k.verbose("Storing instance of module",k),j=k,z.data(A,k)},destroy:function(){k.verbose("Destroying previous module for",z),k.remove.direction(),z.off(F).removeData(A),O.off(v),a.off(v),l.off(v)},event:{clickaway:function(i){0===e(i.target).closest(T.sidebar).size()&&(k.verbose("User clicked on dimmed page"),k.hide())},touch:function(){},containScroll:function(){D.scrollTop<=0&&(D.scrollTop=1),D.scrollTop+D.offsetHeight>=D.scrollHeight&&(D.scrollTop=D.scrollHeight-D.offsetHeight-1)},scroll:function(i){0===e(i.target).closest(T.sidebar).size()&&i.preventDefault()}},bind:{clickaway:function(){k.verbose("Adding clickaway events to context",O),w.closable&&O.on("click"+v,k.event.clickaway).on("touchend"+v,k.event.clickaway)},scrollLock:function(){w.scrollLock&&(k.debug("Disabling page scroll"),a.on("DOMMouseScroll"+v,k.event.scroll)),k.verbose("Adding events to contain sidebar scroll"),l.on("touchmove"+v,k.event.touch),z.on("scroll"+F,k.event.containScroll)}},unbind:{clickaway:function(){k.verbose("Removing clickaway events from context",O),O.off(v)},scrollLock:function(){k.verbose("Removing scroll lock from page"),l.off(v),a.off(v),z.off("scroll"+F)}},add:{bodyCSS:function(){var i,t=z.outerWidth(),n=z.outerHeight();i='<style title="'+S+'"> .ui.visible.left.sidebar ~ .fixed, .ui.visible.left.sidebar ~ .pusher { -webkit-transform: translate3d('+t+"px, 0, 0); transform: translate3d("+t+"px, 0, 0); } .ui.visible.right.sidebar ~ .fixed, .ui.visible.right.sidebar ~ .pusher { -webkit-transform: translate3d(-"+t+"px, 0, 0); transform: translate3d(-"+t+"px, 0, 0); } .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .fixed, .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher, .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .fixed, .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); } .ui.visible.top.sidebar ~ .fixed, .ui.visible.top.sidebar ~ .pusher { -webkit-transform: translate3d(0, "+n+"px, 0); transform: translate3d(0, "+n+"px, 0); } .ui.visible.bottom.sidebar ~ .fixed, .ui.visible.bottom.sidebar ~ .pusher { -webkit-transform: translate3d(0, -"+n+"px, 0); transform: translate3d(0, -"+n+"px, 0); }",k.is.ie()&&(i+=" .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d("+t+"px, 0, 0); transform: translate3d("+t+"px, 0, 0); } .ui.visible.right.sidebar ~ .pusher:after { -webkit-transform: translate3d(-"+t+"px, 0, 0); transform: translate3d(-"+t+"px, 0, 0); } .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); } .ui.visible.top.sidebar ~ .pusher:after { -webkit-transform: translate3d(0, "+n+"px, 0); transform: translate3d(0, "+n+"px, 0); } .ui.visible.bottom.sidebar ~ .pusher:after { -webkit-transform: translate3d(0, -"+n+"px, 0); transform: translate3d(0, -"+n+"px, 0); }"),i+="</style>",c.append(i),s=e("style[title="+S+"]"),k.debug("Adding sizing c
|