|
|
!function(a,b,c,d){a.fn.sidebar=function(b){var e,f=a(this),g=a("body"),h=a("head"),i=f.selector||"",j=(new Date).getTime(),k=[],l=arguments[0],m="string"==typeof l,n=[].slice.call(arguments,1);return f.each(function(){var o,p=a.isPlainObject(b)?a.extend(!0,{},a.fn.sidebar.settings,b):a.extend({},a.fn.sidebar.settings),q=p.selector,r=p.className,s=p.namespace,t=p.error,u="."+s,v="module-"+s,w=a(this),x=a("style[title="+s+"]"),y=this,z=w.data(v);o={initialize:function(){o.debug("Initializing sidebar",w),o.instantiate()},instantiate:function(){o.verbose("Storing instance of module",o),z=o,w.data(v,o)},destroy:function(){o.verbose("Destroying previous module for",w),w.off(u).removeData(v)},refresh:function(){o.verbose("Refreshing selector cache"),x=a("style[title="+s+"]")},attachEvents:function(b,c){var d=a(b);c=a.isFunction(o[c])?o[c]:o.toggle,d.size()>0?(o.debug("Attaching sidebar events to element",b,c),d.off(u).on("click"+u,c)):o.error(t.notFound)},show:function(b){b=a.isFunction(b)?b:function(){},o.debug("Showing sidebar",b),o.is.closed()?(p.overlay||(p.exclusive&&o.hideAll(),o.pushPage()),o.set.active(),b(),a.proxy(p.onChange,y)(),a.proxy(p.onShow,y)()):o.debug("Sidebar is already visible")},hide:function(b){b=a.isFunction(b)?b:function(){},o.debug("Hiding sidebar",b),o.is.open()&&(p.overlay||(o.pullPage(),o.remove.pushed()),o.remove.active(),b(),a.proxy(p.onChange,y)(),a.proxy(p.onHide,y)())},hideAll:function(){a(q.sidebar).filter(":visible").sidebar("hide")},toggle:function(){o.is.closed()?o.show():o.hide()},pushPage:function(){var a=o.get.direction(),b=o.is.vertical()?w.outerHeight():w.outerWidth();p.useCSS?(o.debug("Using CSS to animate body"),o.add.bodyCSS(a,b),o.set.pushed()):o.animatePage(a,b,o.set.pushed)},pullPage:function(){var a=o.get.direction();p.useCSS?(o.debug("Resetting body position css"),o.remove.bodyCSS()):(o.debug("Resetting body position using javascript"),o.animatePage(a,0)),o.remove.pushed()},animatePage:function(a,b){var c={};c["padding-"+a]=b,o.debug("Using javascript to animate body",c),g.animate(c,p.duration,o.set.pushed)},add:{bodyCSS:function(a,b){var c;a!==r.bottom&&(c='<style title="'+s+'">'+"body.pushed {"+" margin-"+a+": "+b+"px !important;"+"}"+"</style>"),h.append(c),o.debug("Adding body css to head",x)}},remove:{bodyCSS:function(){o.debug("Removing body css styles",x),o.refresh(),x.remove()},active:function(){w.removeClass(r.active)},pushed:function(){o.verbose("Removing body push state",o.get.direction()),g.removeClass(r[o.get.direction()]).removeClass(r.pushed)}},set:{active:function(){w.addClass(r.active)},pushed:function(){o.verbose("Adding body push state",o.get.direction()),g.addClass(r[o.get.direction()]).addClass(r.pushed)}},get:{direction:function(){return w.hasClass(r.top)?r.top:w.hasClass(r.right)?r.right:w.hasClass(r.bottom)?r.bottom:r.left},transitionEvent:function(){var a,b=c.createElement("element"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in e)if(b.style[a]!==d)return e[a]}},is:{open:function(){return w.is(":animated")||w.hasClass(r.active)},closed:function(){return!o.is.open()},vertical:function(){return w.hasClass(r.top)}},setting:function(b,c){if(a.isPlainObject(b))a.extend(!0,p,b);else{if(c===d)return p[b];p[b]=c}},internal:function(b,c){if(a.isPlainObject(b))a.extend(!0,o,b);else{if(c===d)return o[b];o[b]=c}},debug:function(){p.debug&&(p.performance?o.performance.log(arguments):(o.debug=Function.prototype.bind.call(console.info,console,p.name+":"),o.debug.apply(console,arguments)))},verbose:function(){p.verbose&&p.debug&&(p.performance?o.performance.log(arguments):(o.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),o.verbose.apply(console,arguments)))},error:function(){o.error=Function.prototype.bind.call(console.error,console,p.name+":"),o.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;p.performance&&(b=(new Date).getTime(),d=j||b,c=b-d,j=b,k.push({Element:y,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),
|