/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI * http://beta.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(e,t,o,n){"use strict";e.fn.popup=function(i){var r,s=e(this),a=e(o),p=s.selector||"",l=("ontouchstart"in o.documentElement,(new Date).getTime()),c=[],u=arguments[0],d="string"==typeof u,f=[].slice.call(arguments,1);return s.each(function(){var o,s,g,h=e.isPlainObject(i)?e.extend(!0,{},e.fn.popup.settings,i):e.extend({},e.fn.popup.settings),m=h.selector,b=h.className,v=h.error,y=h.metadata,w=h.namespace,k="."+h.namespace,x="module-"+w,C=e(this),P=e(h.context),T=h.target?e(h.target):C,O=e(t),S=e("body"),A=0,E=this,z=C.data(x);g={initialize:function(){g.debug("Initializing module",C),g.refresh(),"click"==h.on?C.on("click"+k,g.toggle):g.get.startEvent()&&C.on(g.get.startEvent()+k,g.event.start).on(g.get.endEvent()+k,g.event.end),h.target&&g.debug("Target set to element",T),O.on("resize"+k,g.event.resize),g.exists()?h.hoverable&&g.bind.popup():g.create(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),z=g,C.data(x,z)},refresh:function(){o=h.popup?e(h.popup):h.inline?T.next(h.selector.popup):!1,s=h.popup?o.offsetParent():h.inline?T.offsetParent():S},destroy:function(){g.debug("Destroying previous module"),o&&!h.preserve&&g.remove(),C.off(k).removeData(x)},event:{start:function(){var t=e.isPlainObject(h.delay)?h.delay.show:h.delay;clearTimeout(g.hideTimer),g.showTimer=setTimeout(function(){!g.is.hidden()||g.is.active()&&g.is.dropdown()||g.show()},t)},end:function(){var t=e.isPlainObject(h.delay)?h.delay.hide:h.delay;clearTimeout(g.showTimer),g.hideTimer=setTimeout(function(){g.is.visible()&&g.hide()},t)},resize:function(){g.is.visible()&&g.set.position()}},create:function(){var t=C.data(y.html)||h.html,n=C.data(y.variation)||h.variation,i=C.data(y.title)||h.title,r=C.data(y.content)||C.attr("title")||h.content;t||r||i?(g.debug("Creating pop-up html"),t||(t=h.templates.popup({title:i,content:r})),o=e("
").addClass(b.popup).addClass(n).html(t),n&&o.addClass(n),h.inline?(g.verbose("Inserting popup element inline",o),o.insertAfter(C)):(g.verbose("Appending popup element to body",o),o.appendTo(P)),h.hoverable&&g.bind.popup(),e.proxy(h.onCreate,o)()):0!==T.next(h.selector.popup).size()?(g.verbose("Pre-existing popup found, reverting to inline"),h.inline=!0,g.refresh(),h.hoverable&&g.bind.popup()):g.debug("No content specified skipping display",E)},toggle:function(){g.debug("Toggling pop-up"),g.is.hidden()?(g.debug("Popup is hidden, showing pop-up"),g.unbind.close(),g.hideAll(),g.show()):(g.debug("Popup is visible, hiding pop-up"),g.hide())},show:function(t){t=e.isFunction(t)?t:function(){},g.debug("Showing pop-up",h.transition),h.preserve||h.popup||g.refresh(),g.exists()||g.create(),o&&g.set.position()&&(g.save.conditions(),g.animate.show(t))},hide:function(t){t=e.isFunction(t)?t:function(){},C.removeClass(b.visible),g.unbind.close(),g.is.visible()&&(g.restore.conditions(),g.animate.hide(t))},hideAll:function(){e(m.popup).filter(":visible").popup("hide")},hideGracefully:function(t){t&&0===e(t.target).closest(m.popup).size()?(g.debug("Click occurred outside popup hiding popup"),g.hide()):g.debug("Click was inside popup, keeping popup open")},exists:function(){return o?h.inline||h.popup?0!==o.size():o.closest(P).size():!1},remove:function(){g.debug("Removing popup"),o.remove()},save:{conditions:function(){g.cache={title:C.attr("title")},g.cache.title&&C.removeAttr("title"),g.verbose("Saving original attributes",g.cache.title)}},restore:{conditions:function(){return E.blur(),g.cache&&g.cache.title&&(C.attr("title",g.cache.title),g.verbose("Restoring original attributes",g.cache.title)),!0}},animate:{show:function(t){t=e.isFunction(t)?t:function(){},h.transition&&e.fn.transition!==n&&C.transition("is supported")?o.transition({animation:h.transition+" in",queue:!1,duration:h.duration,onStart:function(){C.addClass(b.visible)},onComplete:function(){g.bind.close(),e.proxy(t,E)()}}):(C.addClass(b.visible),o.stop().fadeIn(h.duration,h.easing,function(){g.bind.close(),e.proxy(t,E)()})),e.proxy(h.onShow,E)()},hide:function(t){t=e.isFunction(t)?t:function(){},g.debug("Hiding pop-up"),h.transition&&e.fn.transition!==n&&C.transition("is supported")?o.transition({animation:h.transition+" out",queue:!1,duration:h.duration,onComplete:function(){g.reset(),t()}}):o.stop().fadeOut(h.duration,h.easing,function(){g.reset(),t()}),e.proxy(h.onHide,E)()}},get:{startEvent:function(){return"hover"==h.on?"mouseenter":"focus"==h.on?"focus":!1},endEvent:function(){return"hover"==h.on?"mouseleave":"focus"==h.on?"blur":!1},offstagePosition:function(){var n={top:e(t).scrollTop(),bottom:e(t).scrollTop()+e(t).height(),left:0,right:e(t).width()},i={width:o.width(),height:o.outerHeight(),offset:o.offset()},r={},s=[];return i.offset&&(r={top:i.offset.topn.bottom,right:i.offset.left+i.width>n.right,left:i.offset.left0?s.join(" "):!1},nextPosition:function(e){switch(e){case"top left":e="bottom left";break;case"bottom left":e="top right";break;case"top right":e="bottom right";break;case"bottom right":e="top center";break;case"top center":e="bottom center";break;case"bottom center":e="right center";break;case"right center":e="left center";break;case"left center":e="top center"}return e}},set:{position:function(i,r){var a,p,l=(e(t).width(),e(t).height(),T.outerWidth()),c=T.outerHeight(),u=o.outerWidth(),d=o.outerHeight(),f=s.outerWidth(),m=s.outerHeight(),w=h.distanceAway,k=T[0],x=h.inline?parseInt(t.getComputedStyle(k).getPropertyValue("margin-top"),10):0,P=h.inline?parseInt(t.getComputedStyle(k).getPropertyValue("margin-left"),10):0,O=h.inline||h.popup?T.position():T.offset();switch(i=i||C.data(y.position)||h.position,r=r||C.data(y.offset)||h.offset,h.inline&&(g.debug("Adding targets margin to calculation"),"left center"==i||"right center"==i?(r+=x,w+=-P):"top left"==i||"top center"==i||"top right"==i?(r+=P,w-=x):(r+=P,w+=x)),g.debug("Calculating popup positioning",i),i){case"top left":a={top:"auto",bottom:m-O.top+w,left:O.left+r,right:"auto"};break;case"top center":a={bottom:m-O.top+w,left:O.left+l/2-u/2+r,top:"auto",right:"auto"};break;case"top right":a={bottom:m-O.top+w,right:f-O.left-l-r,top:"auto",left:"auto"};break;case"left center":a={top:O.top+c/2-d/2+r,right:f-O.left+w,left:"auto",bottom:"auto"};break;case"right center":a={top:O.top+c/2-d/2+r,left:O.left+l+w,bottom:"auto",right:"auto"};break;case"bottom left":a={top:O.top+c+w,left:O.left+r,bottom:"auto",right:"auto"};break;case"bottom center":a={top:O.top+c+w,left:O.left+l/2-u/2+r,bottom:"auto",right:"auto"};break;case"bottom right":a={top:O.top+c+w,right:f-O.left-l-r,left:"auto",bottom:"auto"}}return a===n&&g.error(v.invalidPosition),o.css(a).removeClass(b.position).addClass(i).addClass(b.loading),p=g.get.offstagePosition(),p?(g.debug("Element is outside boundaries",p),A0&&(console.groupCollapsed(t),console.table?console.table(c):e.each(c,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(t,o,i){var s,a,p,l=z;return o=o||f,i=E||i,"string"==typeof t&&l!==n&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(o,i){var r=o!=s?i+t[o+1].charAt(0).toUpperCase()+t[o+1].slice(1):t;if(e.isPlainObject(l[r])&&o!=s)l=l[r];else{if(l[r]!==n)return a=l[r],!1;if(!e.isPlainObject(l[i])||o==s)return l[i]!==n?(a=l[i],!1):!1;l=l[i]}})),e.isFunction(a)?p=a.apply(i,o):a!==n&&(p=a),e.isArray(r)?r.push(p):r!==n?r=[r,p]:p!==n&&(r=p),a}},d?(z===n&&g.initialize(),g.invoke(u)):(z!==n&&g.destroy(),g.initialize())}),r!==n?r:this},e.fn.popup.settings={name:"Popup",debug:!1,verbose:!1,performance:!1,namespace:"popup",onCreate:function(){},onRemove:function(){},onShow:function(){},onHide:function(){},variation:"",content:!1,html:!1,title:!1,on:"hover",closable:!0,hideOnScroll:!0,context:"body",position:"top left",delay:{show:30,hide:0},target:!1,popup:!1,inline:!1,preserve:!0,hoverable:!1,duration:200,easing:"easeOutQuint",transition:"scale",distanceAway:0,offset:0,maxSearchDepth:10,error:{invalidPosition:"The position you specified is not a valid position",method:"The method you called is not defined.",recursion:"Popup attempted to reposition element to fit, but could not find an adequate position."},metadata:{content:"content",html:"html",offset:"offset",position:"position",title:"title",variation:"variation"},className:{active:"active",animating:"animating",dropdown:"dropdown",loading:"loading",popup:"ui popup",position:"top left center bottom right",visible:"visible"},selector:{popup:".ui.popup"},templates:{escape:function(e){var t=/[&<>"'`]/g,o=/[&<>"'`]/,n={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},i=function(e){return n[e]};return o.test(e)?e.replace(t,i):e},popup:function(t){var o="",i=e.fn.popup.settings.templates.escape;return typeof t!==n&&(typeof t.title!==n&&t.title&&(t.title=i(t.title),o+='
'+t.title+"
"),typeof t.content!==n&&t.content&&(t.content=i(t.content),o+='
'+t.content+"
")),o}}},e.extend(e.easing,{easeOutQuad:function(e,t,o,n,i){return-n*(t/=i)*(t-2)+o}})}(jQuery,window,document);