/* * # Semantic UI - 1.7.0 * 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,n,t){"use strict";e.fn.sidebar=function(o){var r,s=e(this),a=e(i),l=e(n),c=e("html"),u=e("head"),d=s.selector||"",f=(new Date).getTime(),m=[],g=arguments[0],b="string"==typeof g,v=[].slice.call(arguments,1),h=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||i.msRequestAnimationFrame||function(e){setTimeout(e,0)};return s.each(function(){var s,p,y,w,k,T,C=e.isPlainObject(o)?e.extend(!0,{},e.fn.sidebar.settings,o):e.extend({},e.fn.sidebar.settings),x=C.selector,S=C.className,A=C.namespace,P=C.regExp,F=C.error,O="."+A,E="module-"+A,H=e(this),L=e(C.context),D=H.children(x.sidebar),j=L.children(x.pusher),z=this,M=H.data(E);T={initialize:function(){T.debug("Initializing sidebar",o),T.create.id(),k=T.get.transitionEvent(),("auto"==C.useLegacy&&T.is.legacy()||C.useLegacy===!0)&&(C.transition="overlay",C.useLegacy=!0),T.is.ios()&&T.set.ios(),h(T.setup.layout),T.instantiate()},instantiate:function(){T.verbose("Storing instance of module",T),M=T,H.data(E,T)},create:{id:function(){T.verbose("Creating unique id for element"),y=T.get.uniqueID(),p="."+y}},destroy:function(){T.verbose("Destroying previous module for",H),T.remove.direction(),H.off(O).removeData(E),L.off(p),a.off(p),l.off(p)},event:{clickaway:function(i){0===e(i.target).closest(x.sidebar).length&&(T.verbose("User clicked on dimmed page"),T.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(x.sidebar).length&&i.preventDefault()}},bind:{clickaway:function(){T.verbose("Adding clickaway events to context",L),C.closable&&L.on("click"+p,T.event.clickaway).on("touchend"+p,T.event.clickaway)},scrollLock:function(){C.scrollLock&&(T.debug("Disabling page scroll"),a.on("DOMMouseScroll"+p,T.event.scroll)),T.verbose("Adding events to contain sidebar scroll"),l.on("touchmove"+p,T.event.touch),H.on("scroll"+O,T.event.containScroll)}},unbind:{clickaway:function(){T.verbose("Removing clickaway events from context",L),L.off(p)},scrollLock:function(){T.verbose("Removing scroll lock from page"),l.off(p),a.off(p),H.off("scroll"+O)}},add:{bodyCSS:function(){var i,n=H.outerWidth(),t=H.outerHeight(),o=T.get.direction(),r={left:n,right:-n,top:t,bottom:-t};T.is.rtl()&&(T.verbose("RTL detected, flipping widths"),r.left=-n,r.right=n),i='",u.append(i),s=e("style[title="+A+"]"),T.debug("Adding sizing css to head",s)}},refresh:function(){T.verbose("Refreshing selector cache"),L=e(C.context),D=L.children(x.sidebar),j=L.children(x.pusher)},refreshSidebars:function(){T.verbose("Refreshing other sidebars"),D=L.children(x.sidebar)},repaint:function(){T.verbose("Forcing repaint event"),z.style.display="none",z.offsetHeight,z.scrollTop=z.scrollTop,z.style.display=""},setup:{layout:function(){0===L.children(x.pusher).length&&(T.debug("Adding wrapper element for sidebar"),T.error(F.pusher),j=e('
'),L.children().not(x.omitted).not(D).wrapAll(j),T.refresh()),(0===H.nextAll(x.pusher).length||H.nextAll(x.pusher)[0]!==j[0])&&(T.debug("Moved sidebar to correct parent element"),T.error(F.movedSidebar,z),H.detach().prependTo(L),T.refresh()),T.set.pushable(),T.set.direction()}},attachEvents:function(i,n){var t=e(i);n=e.isFunction(T[n])?T[n]:T.toggle,t.length>0?(T.debug("Attaching sidebar events to element",i,n),t.on("click"+O,n)):T.error(F.notFound,i)},show:function(i){var n=C.useLegacy===!0?T.legacyPushPage:T.pushPage;i=e.isFunction(i)?i:function(){},T.is.hidden()?(T.refreshSidebars(),C.overlay&&(T.error(F.overlay),C.transition="overlay"),T.refresh(),T.othersActive()&&"overlay"!==T.get.transition()&&(T.debug("Other sidebars currently visible"),C.transition="overlay",C.exclusive&&T.hideOthers()),n(function(){i.call(z),C.onShow.call(z)}),C.onChange.call(z),C.onVisible.call(z)):T.debug("Sidebar is already visible")},hide:function(i){var n=C.useLegacy===!0?T.legacyPullPage:T.pullPage;i=e.isFunction(i)?i:function(){},(T.is.visible()||T.is.animating())&&(T.debug("Hiding sidebar",i),T.refreshSidebars(),n(function(){i.call(z),C.onHidden.call(z)}),C.onChange.call(z),C.onHide.call(z))},othersAnimating:function(){return D.not(H).filter("."+S.animating).length>0},othersVisible:function(){return D.not(H).filter("."+S.visible).length>0},othersActive:function(){return T.othersVisible()||T.othersAnimating()},hideOthers:function(e){var i=D.not(H).filter("."+S.visible),n=i.length,t=0;e=e||function(){},i.sidebar("hide",function(){t++,t==n&&e()})},toggle:function(){T.verbose("Determining toggled direction"),T.is.hidden()?T.show():T.hide()},pushPage:function(i){var n,t,o=T.get.transition(),r="safe"==o?L:"overlay"===o||T.othersActive()?H:j;i=e.isFunction(i)?i:function(){},"scale down"==C.transition&&T.scrollToTop(),T.set.transition(),T.repaint(),n=function(){T.bind.clickaway(),T.add.bodyCSS(),T.set.animating(),T.set.visible(),T.othersVisible()||C.dimPage&&j.addClass(S.dimmed)},t=function(e){e.target==r[0]&&(r.off(k+p,t),T.remove.animating(),T.bind.scrollLock(),i.call(z))},r.off(k+p),r.on(k+p,t),h(n)},pullPage:function(i){var n,t,o=T.get.transition(),r="safe"==o?L:"overlay"==o||T.othersActive()?H:j;i=e.isFunction(i)?i:function(){},T.verbose("Removing context push state",T.get.direction()),T.set.transition(),T.unbind.clickaway(),T.unbind.scrollLock(),n=function(){T.set.animating(),T.remove.visible(),C.dimPage&&!T.othersVisible()&&j.removeClass(S.dimmed)},t=function(e){e.target==r[0]&&(r.off(k+p,t),T.remove.animating(),T.remove.transition(),T.remove.bodyCSS(),("scale down"==o||C.returnScroll&&T.is.mobile())&&T.scrollBack(),i.call(z))},r.off(k+p),r.on(k+p,t),h(n)},legacyPushPage:function(i){var n=H.width(),t=T.get.direction(),o={};n=n||H.width(),i=e.isFunction(i)?i:function(){},o[t]=n,T.debug("Using javascript to push context",o),T.set.visible(),T.set.transition(),T.set.animating(),C.dimPage&&j.addClass(S.dimmed),L.css("position","relative").animate(o,C.duration,C.easing,function(){T.remove.animating(),T.bind.clickaway(),i.call(z)})},legacyPullPage:function(i){var n=0,t=T.get.direction(),o={};n=n||H.width(),i=e.isFunction(i)?i:function(){},o[t]="0px",T.debug("Using javascript to pull context",o),T.unbind.clickaway(),T.set.animating(),T.remove.visible(),C.dimPage&&!T.othersActive()&&j.removeClass(S.dimmed),L.css("position","relative").animate(o,C.duration,C.easing,function(){T.remove.animating(),i.call(z)})},scrollToTop:function(){T.verbose("Scrolling to top of page to avoid animation issues"),w=e(i).scrollTop(),H.scrollTop(0),i.scrollTo(0,0)},scrollBack:function(){T.verbose("Scrolling back to original page position"),i.scrollTo(0,w)},set:{ios:function(){c.addClass(S.ios)},pushed:function(){L.addClass(S.pushed)},pushable:function(){L.addClass(S.pushable)},active:function(){H.addClass(S.active)},animating:function(){H.addClass(S.animating)},transition:function(e){e=e||T.get.transition(),H.addClass(e)},direction:function(e){e=e||T.get.direction(),H.addClass(S[e])},visible:function(){H.addClass(S.visible)},overlay:function(){H.addClass(S.overlay)}},remove:{bodyCSS:function(){T.debug("Removing body css styles",s),s&&s.length>0&&s.remove()},pushed:function(){L.removeClass(S.pushed)},pushable:function(){L.removeClass(S.pushable)},active:function(){H.removeClass(S.active)},animating:function(){H.removeClass(S.animating)},transition:function(e){e=e||T.get.transition(),H.removeClass(e)},direction:function(e){e=e||T.get.direction(),H.removeClass(S[e])},visible:function(){H.removeClass(S.visible)},overlay:function(){H.removeClass(S.overlay)}},get:{direction:function(){return H.hasClass(S.top)?S.top:H.hasClass(S.right)?S.right:H.hasClass(S.bottom)?S.bottom:S.left},transition:function(){var e=T.get.direction();return T.is.mobile()?"auto"==C.mobileTransition?C.defaultTransition.mobile[e]:C.mobileTransition:"auto"==C.transition?C.defaultTransition.computer[e]:C.transition},transitionEvent:function(){var e,i=n.createElement("element"),o={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in o)if(i.style[e]!==t)return o[e]},uniqueID:function(){return(Math.random().toString(16)+"000000000").substr(2,8)}},is:{ie:function(){var e=!i.ActiveXObject&&"ActiveXObject"in i,n="ActiveXObject"in i;return e||n},legacy:function(){var e,o=n.createElement("div"),r={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};n.body.insertBefore(o,null);for(var s in r)o.style[s]!==t&&(o.style[s]="translate3d(1px,1px,1px)",e=i.getComputedStyle(o).getPropertyValue(r[s]));return n.body.removeChild(o),!(e!==t&&e.length>0&&"none"!==e)},ios:function(){var e=navigator.userAgent,i=P.ios.test(e);return i?(T.verbose("Browser was found to be iOS",e),!0):!1},mobile:function(){var e=navigator.userAgent,i=P.mobile.test(e);return i?(T.verbose("Browser was found to be mobile",e),!0):(T.verbose("Browser is not mobile, using regular transition",e),!1)},hidden:function(){return!T.is.visible()},visible:function(){return H.hasClass(S.visible)},open:function(){return T.is.visible()},closed:function(){return T.is.hidden()},vertical:function(){return H.hasClass(S.top)},animating:function(){return L.hasClass(S.animating)},rtl:function(){return"rtl"==H.css("direction")}},setting:function(i,n){if(T.debug("Changing setting",i,n),e.isPlainObject(i))e.extend(!0,C,i);else{if(n===t)return C[i];C[i]=n}},internal:function(i,n){if(e.isPlainObject(i))e.extend(!0,T,i);else{if(n===t)return T[i];T[i]=n}},debug:function(){C.debug&&(C.performance?T.performance.log(arguments):(T.debug=Function.prototype.bind.call(console.info,console,C.name+":"),T.debug.apply(console,arguments)))},verbose:function(){C.verbose&&C.debug&&(C.performance?T.performance.log(arguments):(T.verbose=Function.prototype.bind.call(console.info,console,C.name+":"),T.verbose.apply(console,arguments)))},error:function(){T.error=Function.prototype.bind.call(console.error,console,C.name+":"),T.error.apply(console,arguments)},performance:{log:function(e){var i,n,t;C.performance&&(i=(new Date).getTime(),t=f||i,n=i-t,f=i,m.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:z,"Execution Time":n})),clearTimeout(T.performance.timer),T.performance.timer=setTimeout(T.performance.display,100)},display:function(){var i=C.name+":",n=0;f=!1,clearTimeout(T.performance.timer),e.each(m,function(e,i){n+=i["Execution Time"]}),i+=" "+n+"ms",d&&(i+=" '"+d+"'"),(console.group!==t||console.table!==t)&&m.length>0&&(console.groupCollapsed(i),console.table?console.table(m):e.each(m,function(e,i){console.log(i.Name+": "+i["Execution Time"]+"ms")}),console.groupEnd()),m=[]}},invoke:function(i,n,o){var s,a,l,c=M;return n=n||v,o=z||o,"string"==typeof i&&c!==t&&(i=i.split(/[\. ]/),s=i.length-1,e.each(i,function(n,o){var r=n!=s?o+i[n+1].charAt(0).toUpperCase()+i[n+1].slice(1):i;if(e.isPlainObject(c[r])&&n!=s)c=c[r];else{if(c[r]!==t)return a=c[r],!1;if(!e.isPlainObject(c[o])||n==s)return c[o]!==t?(a=c[o],!1):(T.error(F.method,i),!1);c=c[o]}})),e.isFunction(a)?l=a.apply(o,n):a!==t&&(l=a),e.isArray(r)?r.push(l):r!==t?r=[r,l]:l!==t&&(r=l),a}},b?(M===t&&T.initialize(),T.invoke(g)):(M!==t&&T.invoke("destroy"),T.initialize())}),r!==t?r:this},e.fn.sidebar.settings={name:"Sidebar",namespace:"sidebar",debug:!1,verbose:!0,performance:!0,transition:"auto",mobileTransition:"auto",defaultTransition:{computer:{left:"uncover",right:"uncover",top:"overlay",bottom:"overlay"},mobile:{left:"uncover",right:"uncover",top:"overlay",bottom:"overlay"}},context:"body",exclusive:!1,closable:!0,dimPage:!0,scrollLock:!1,returnScroll:!1,useLegacy:"auto",duration:500,easing:"easeInOutQuint",onChange:function(){},onShow:function(){},onHide:function(){},onHidden:function(){},onVisible:function(){},className:{active:"active",animating:"animating",dimmed:"dimmed",ios:"ios",pushable:"pushable",pushed:"pushed",right:"right",top:"top",left:"left",bottom:"bottom",visible:"visible"},selector:{fixed:".fixed",omitted:"script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",pusher:".pusher",sidebar:".ui.sidebar"},regExp:{ios:/(iPad|iPhone|iPod)/g,mobile:/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g},error:{method:"The method you called is not defined.",pusher:"Had to add pusher element. For optimal performance make sure body content is inside a pusher element",movedSidebar:"Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag",overlay:"The overlay setting is no longer supported, use animation: overlay",notFound:"There were no elements that matched the specified selector"}},e.extend(e.easing,{easeInOutQuint:function(e,i,n,t,o){return(i/=o/2)<1?t/2*i*i*i*i*i+n:t/2*((i-=2)*i*i*i*i+2)+n}})}(jQuery,window,document);