|
|
/* * # 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("html"),u=e("head"),d=s.selector||"",f=(new Date).getTime(),b=[],m=arguments[0],g="string"==typeof m,p=[].slice.call(arguments,1),v=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(e){setTimeout(e,0)};return s.each(function(){var s,h,y,x,k,w,T=e.isPlainObject(o)?e.extend(!0,{},e.fn.sidebar.settings,o):e.extend({},e.fn.sidebar.settings),C=T.selector,S=T.className,P=T.namespace,A=T.regExp,F=T.error,O="."+P,z="module-"+P,E=e(this),H=e(T.context),D=E.children(C.sidebar),j=H.children(C.pusher),L=this,M=E.data(z);w={initialize:function(){w.debug("Initializing sidebar",o),w.create.id(),k=w.get.transitionEvent(),(w.is.legacy()||T.legacy)&&(T.transition="overlay",T.useLegacy=!0),w.is.ios()&&w.set.ios(),v(w.setup.layout),w.instantiate()},instantiate:function(){w.verbose("Storing instance of module",w),M=w,E.data(z,w)},create:{id:function(){w.verbose("Creating unique id for element"),y=w.get.uniqueID(),h="."+y}},destroy:function(){w.verbose("Destroying previous module for",E),w.remove.direction(),E.off(O).removeData(z),H.off(h),a.off(h),l.off(h)},event:{clickaway:function(i){0===e(i.target).closest(C.sidebar).size()&&(w.verbose("User clicked on dimmed page"),w.hide())},touch:function(){},containScroll:function(){L.scrollTop<=0&&(L.scrollTop=1),L.scrollTop+L.offsetHeight>=L.scrollHeight&&(L.scrollTop=L.scrollHeight-L.offsetHeight-1)},scroll:function(i){0===e(i.target).closest(C.sidebar).size()&&i.preventDefault()}},bind:{clickaway:function(){w.verbose("Adding clickaway events to context",H),T.closable&&H.on("click"+h,w.event.clickaway).on("touchend"+h,w.event.clickaway)},scrollLock:function(){T.scrollLock&&(w.debug("Disabling page scroll"),a.on("DOMMouseScroll"+h,w.event.scroll)),w.verbose("Adding events to contain sidebar scroll"),l.on("touchmove"+h,w.event.touch),E.on("scroll"+O,w.event.containScroll)}},unbind:{clickaway:function(){w.verbose("Removing clickaway events from context",H),H.off(h)},scrollLock:function(){w.verbose("Removing scroll lock from page"),l.off(h),a.off(h),E.off("scroll"+O)}},add:{bodyCSS:function(){var i,t=E.outerWidth(),n=E.outerHeight();i='<style title="'+P+'"> .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); }",w.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);
|