/* * # Semantic UI * git://github.com/Semantic-Org/Semantic-UI.git#1.0 * * * 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||"",u=("ontouchstart"in o.documentElement,(new Date).getTime()),c=[],l=arguments[0],d="string"==typeof l,f=[].slice.call(arguments,1);return s.each(function(){var o,s,g,m=e.isPlainObject(i)?e.extend(!0,{},e.fn.popup.settings,i):e.extend({},e.fn.popup.settings),h=m.selector,b=m.className,v=m.error,y=m.metadata,w=m.namespace,k="."+m.namespace,x="module-"+w,C=e(this),P=e(m.context),T=m.target?e(m.target):C,A=e(t),E=e("body"),z=0,O=this,j=C.data(x);g={initialize:function(){g.debug("Initializing module",C),g.refresh(),"click"==m.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),m.target&&g.debug("Target set to element",T),A.on("resize"+k,g.event.resize),g.exists()?m.hoverable&&g.bind.popup():g.create(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),j=g,C.data(x,j)},refresh:function(){o=m.popup?e(m.popup):m.inline?T.next(m.selector.popup):!1,s=m.popup?o.offsetParent():m.inline?T.offsetParent():E},destroy:function(){g.debug("Destroying previous module"),o&&!m.preserve&&g.remove(),C.off(k).removeData(x)},event:{start:function(){var t=e.isPlainObject(m.delay)?m.delay.show:m.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(m.delay)?m.delay.hide:m.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)||m.html,n=C.data(y.variation)||m.variation,i=C.data(y.title)||m.title,r=C.data(y.content)||C.attr("title")||m.content;t||r||i?(g.debug("Creating pop-up html"),t||(t=m.templates.popup({title:i,content:r})),o=e("
").addClass(b.popup).addClass(n).html(t),n&&o.addClass(n),m.inline?(g.verbose("Inserting popup element inline",o),o.insertAfter(C)):(g.verbose("Appending popup element to body",o),o.appendTo(P)),m.hoverable&&g.bind.popup(),e.proxy(m.onCreate,o)()):0!==T.next(m.selector.popup).size()?(g.verbose("Pre-existing popup found, reverting to inline"),m.inline=!0,g.refresh(),m.hoverable&&g.bind.popup()):g.debug("No content specified skipping display",O)},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(e){e=e||function(){},g.debug("Showing pop-up",m.transition),m.preserve||m.popup||g.refresh(),g.exists()||g.create(),o&&g.set.position()&&(g.save.conditions(),g.animate.show(e))},hide:function(e){e=e||function(){},C.removeClass(b.visible),g.unbind.close(),g.is.visible()&&(g.restore.conditions(),g.animate.hide(e))},hideAll:function(){e(h.popup).filter(":visible").popup("hide")},hideGracefully:function(t){t&&0===e(t.target).closest(h.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?m.inline||m.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 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=t||function(){},m.transition&&e.fn.transition!==n&&C.transition("is supported")?o.transition({animation:m.transition+" in",queue:!1,duration:m.duration,start:function(){C.addClass(b.visible)},complete:function(){g.bind.close(),e.proxy(t,O)()}}):(C.addClass(b.visible),o.stop().fadeIn(m.duration,m.easing,function(){g.bind.close(),e.proxy(t,O)()})),e.proxy(m.onShow,O)()},hide:function(t){t=t||function(){},g.debug("Hiding pop-up"),m.transition&&e.fn.transition!==n&&C.transition("is supported")?o.transition({animation:m.transition+" out",queue:!1,duration:m.duration,complete:function(){g.reset(),t()}}):o.stop().fadeOut(m.duration,m.easing,function(){g.reset(),t()}),e.proxy(m.onHide,O)()}},get:{startEvent:function(){return"hover"==m.on?"mouseenter":"focus"==m.on?"focus":!1},endEvent:function(){return"hover"==m.on?"mouseleave":"focus"==m.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.top