You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
13 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * # Semantic UI
  3. * https://github.com/Semantic-Org/Semantic-UI
  4. * http://www.semantic-ui.com/
  5. *
  6. * Copyright 2014 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. !function(e,i,t,n){"use strict";e.fn.sidebar=function(o){var r,s=e(this),a=e("head"),l=s.selector||"",c=(new Date).getTime(),u=[],d=arguments[0],f="string"==typeof d,m=[].slice.call(arguments,1),b=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(e){setTimeout(e,0)};return s.each(function(){var s,p,v,g,h=e.isPlainObject(o)?e.extend(!0,{},e.fn.sidebar.settings,o):e.extend({},e.fn.sidebar.settings),y=h.selector,x=h.className,w=h.namespace,T=h.error,k="."+w,C="module-"+w,S=e(this),A=e(h.context),P=S.children(y.sidebar),F=A.children(y.pusher),z=this,O=S.data(C);g={initialize:function(){g.debug("Initializing sidebar",o),v=g.get.transitionEvent(),(g.is.legacy()||h.legacy)&&(h.transition="overlay",h.useLegacy=!0),b(g.setup.layout),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),O=g,S.data(C,g)},destroy:function(){g.verbose("Destroying previous module for",S),g.remove.direction(),S.off(k).removeData(C)},event:{clickaway:function(i){0===e(i.target).closest(y.sidebar).size()&&(g.verbose("User clicked on dimmed page"),g.hide())},touch:function(){},containScroll:function(){z.scrollTop<=0&&(z.scrollTop=1),z.scrollTop+z.offsetHeight>=z.scrollHeight&&(z.scrollTop=z.scrollHeight-z.offsetHeight-1)},scroll:function(i){0===e(i.target).closest(y.sidebar).size()&&i.preventDefault()}},bind:{clickaway:function(){h.scrollLock&&e(i).on("DOMMouseScroll"+k,g.event.scroll),e(t).on("touchmove"+k,g.event.touch),S.on("scroll"+k,g.event.containScroll),h.closable&&A.on("click"+k,g.event.clickaway).on("touchend"+k,g.event.clickaway)}},unbind:{clickaway:function(){A.off(k),F.off(k),e(t).off(k),e(i).off(k)}},add:{bodyCSS:function(){var i,t=S.outerWidth(),n=S.outerHeight();i='<style title="'+w+'"> .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); }",g.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>",a.append(i),s=e("style[title="+w+"]"),g.debug("Adding sizing css to head",s)}},refresh:function(){g.verbose("Refreshing selector cache"),A=e(h.context),P=A.children(y.sidebar),F=A.children(y.pusher)},repaint:function(){g.verbose("Forcing repaint event"),z.style.display="none",z.offsetHeight,z.scrollTop=z.scrollTop,z.style.display=""},setup:{layout:function(){0===A.children(y.pusher).size()&&(g.debug("Adding wr