/* * # 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()),u=[],c=arguments[0],d="string"==typeof c,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,x="."+h.namespace,k="module-"+w,P=e(this),C=e(h.context),T=h.target?e(h.target):P,O=e(t),A=e("body"),E=0,S=this,z=P.data(k);g={initialize:function(){g.debug("Initializing module",P),g.refresh(),"click"==h.on?P.on("click"+x,g.toggle):g.get.startEvent()&&P.on(g.get.startEvent()+x,g.event.start).on(g.get.endEvent()+x,g.event.end),h.target&&g.debug("Target set to element",T),O.on("resize"+x,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,P.data(k,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():A},reposition:function(){g.refresh(),g.set.position()},destroy:function(){g.debug("Destroying previous module"),o&&!h.preserve&&g.removePopup(),P.off(x).removeData(k)},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=P.data(y.html)||h.html,n=P.data(y.variation)||h.variation,i=P.data(y.title)||h.title,r=P.data(y.content)||P.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(P)):(g.verbose("Appending popup element to body",o),o.appendTo(C)),h.hoverable&&g.bind.popup(),e.proxy(h.onCreate,o)(S)):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",S)},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(){},g.remove.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(C).size():!1},removePopup:function(){g.debug("Removing popup"),e.proxy(h.onRemove,o)(S),o.removePopup()},save:{conditions:function(){g.cache={title:P.attr("title")},g.cache.title&&P.removeAttr("title"),g.verbose("Saving original attributes",g.cache.title)}},restore:{conditions:function(){return S.blur(),g.cache&&g.cache.title&&(P.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&&P.transition("is supported")?(g.set.visible(),o.transition({animation:h.transition+" in",queue:!1,debug:h.debug,verbose:h.verbose,duration:h.duration,onComplete:function(){g.bind.close(),e.proxy(t,o)(S),e.proxy(h.onVisible,o)(S)}})):(g.set.visible(),o.stop().fadeIn(h.duration,h.easing,function(){g.bind.close(),e.proxy(t,S)()})),e.proxy(h.onShow,o)(S)},hide:function(t){t=e.isFunction(t)?t:function(){},g.debug("Hiding pop-up"),h.transition&&e.fn.transition!==n&&P.transition("is supported")?o.transition({animation:h.transition+" out",queue:!1,duration:h.duration,debug:h.debug,verbose:h.verbose,onComplete:function(){g.reset(),e.proxy(t,o)(S),e.proxy(h.onHidden,o)(S)}}):o.stop().fadeOut(h.duration,h.easing,function(){g.reset(),t()}),e.proxy(h.onHide,o)(S)}},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(n){var n=n||!1,i={top:e(t).scrollTop(),bottom:e(t).scrollTop()+e(t).height(),left:0,right:e(t).width()},r={width:o.width(),height:o.height(),offset:o.offset()},s={},a=[];return r.offset&&n&&(g.verbose("Checking if outside viewable area",r.offset),s={top:r.offset.top