/*! * # Semantic UI 2.0.0 - Popup * http://github.com/semantic-org/semantic-ui/ * * * Copyright 2015 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(t,e,o,n){"use strict";t.fn.popup=function(i){var r,a=t(this),s=t(o),p=t(e),l=t("body"),u=a.selector||"",c="ontouchstart"in o.documentElement,d=(new Date).getTime(),f=[],g=arguments[0],h="string"==typeof g,m=[].slice.call(arguments,1);return a.each(function(){var o,a,v,b,y,w=t.isPlainObject(i)?t.extend(!0,{},t.fn.popup.settings,i):t.extend({},t.fn.popup.settings),T=w.selector,P=w.className,C=w.error,k=w.metadata,x=w.namespace,S="."+w.namespace,E="module-"+x,D=t(this),O=t(w.context),j=w.target?t(w.target):D,A=0,R=!1,F=!1,H=this,I=D.data(E);y={initialize:function(){y.debug("Initializing",D),y.createID(),y.bind.events(),!y.exists()&&w.preserve&&y.create(),y.instantiate()},instantiate:function(){y.verbose("Storing instance",y),I=y,D.data(E,I)},refresh:function(){w.popup?o=t(w.popup).eq(0):w.inline&&(o=j.next(T.popup).eq(0),w.popup=o),w.popup?(o.addClass(P.loading),a=y.get.offsetParent(),o.removeClass(P.loading),w.movePopup&&y.has.popup()&&y.get.offsetParent(o)[0]!==a[0]&&(y.debug("Moving popup to the same offset parent as activating element"),o.detach().appendTo(a))):a=w.inline?y.get.offsetParent(j):y.has.popup()?y.get.offsetParent(o):l,a.is("html")&&(y.debug("Setting page as offset parent"),a=l)},reposition:function(){y.refresh(),y.set.position()},destroy:function(){y.debug("Destroying previous module"),o&&!w.preserve&&y.removePopup(),clearTimeout(y.hideTimer),clearTimeout(y.showTimer),p.off(v),D.off(S).removeData(E)},event:{start:function(){var e=t.isPlainObject(w.delay)?w.delay.show:w.delay;clearTimeout(y.hideTimer),y.showTimer=setTimeout(y.show,e)},end:function(){var e=t.isPlainObject(w.delay)?w.delay.hide:w.delay;clearTimeout(y.showTimer),y.hideTimer=setTimeout(y.hide,e)},touchstart:function(){F=!0,y.event.start()},resize:function(){y.is.visible()&&y.set.position()},hideGracefully:function(e){e&&0===t(e.target).closest(T.popup).length?(y.debug("Click occurred outside popup hiding popup"),y.hide()):y.debug("Click was inside popup, keeping popup open")}},create:function(){var e=y.get.html(),n=y.get.variation(),i=y.get.title(),r=y.get.content();e||r||i?(y.debug("Creating pop-up html"),e||(e=w.templates.popup({title:i,content:r})),o=t("
").addClass(P.popup).addClass(n).data(k.activator,D).html(e),n&&o.addClass(n),w.inline?(y.verbose("Inserting popup element inline",o),o.insertAfter(D)):(y.verbose("Appending popup element to body",o),o.appendTo(O)),y.refresh(),w.hoverable&&y.bind.popup(),w.onCreate.call(o,H)):0!==j.next(T.popup).length?(y.verbose("Pre-existing popup found"),w.inline=!0,w.popups=j.next(T.popup).data(k.activator,D),y.refresh(),w.hoverable&&y.bind.popup()):w.popup?(t(w.popup).data(k.activator,D),y.verbose("Used popup specified in settings"),y.refresh(),w.hoverable&&y.bind.popup()):y.debug("No content specified skipping display",H)},createID:function(){b=(Math.random().toString(16)+"000000000").substr(2,8),v="."+b,y.verbose("Creating unique id for element",b)},toggle:function(){y.debug("Toggling pop-up"),y.is.hidden()?(y.debug("Popup is hidden, showing pop-up"),y.unbind.close(),y.show()):(y.debug("Popup is visible, hiding pop-up"),y.hide())},show:function(t){if(t=t||function(){},y.debug("Showing pop-up",w.transition),y.is.hidden()&&(!y.is.active()||!y.is.dropdown())){if(y.exists()||y.create(),w.onShow.call(o,H)===!1)return void y.debug("onShow callback returned false, cancelling popup animation");w.preserve||w.popup||y.refresh(),o&&y.set.position()&&(y.save.conditions(),w.exclusive&&y.hideAll(),y.animate.show(t))}},hide:function(t){if(t=t||function(){},y.is.visible()||y.is.animating()){if(w.onHide.call(o,H)===!1)return void y.debug("onHide callback returned false, cancelling popup animation");y.remove.visible(),y.unbind.close(),y.restore.conditions(),y.animate.hide(t)}},hideAll:function(){t(T.popup).filter("."+P.visible).each(function(){t(this).data(k.activator).popup("hide")})},exists:function(){return o?w.inline||w.popup?y.has.popup():o.closest(O).length>=1?!0:!1:!1},removePopup:function(){y.debug("Removing popup",o),y.has.popup()&&!w.popup&&(o.remove(),o=n),w.onRemove.call(o,H)},save:{conditions:function(){y.cache={title:D.attr("title")},y.cache.title&&D.removeAttr("title"),y.verbose("Saving original attributes",y.cache.title)}},restore:{conditions:function(){return y.cache&&y.cache.title&&(D.attr("title",y.cache.title),y.verbose("Restoring original attributes",y.cache.title)),!0}},animate:{show:function(e){e=t.isFunction(e)?e:function(){},w.transition&&t.fn.transition!==n&&D.transition("is supported")?(y.set.visible(),o.transition({animation:w.transition+" in",queue:!1,debug:w.debug,verbose:w.verbose,duration:w.duration,onComplete:function(){y.bind.close(),e.call(o,H),w.onVisible.call(o,H)}})):y.error(C.noTransition)},hide:function(e){return e=t.isFunction(e)?e:function(){},y.debug("Hiding pop-up"),w.onShow.call(o,H)===!1?void y.debug("onShow callback returned false, cancelling popup animation"):void(w.transition&&t.fn.transition!==n&&D.transition("is supported")?o.transition({animation:w.transition+" out",queue:!1,duration:w.duration,debug:w.debug,verbose:w.verbose,onComplete:function(){y.reset(),e.call(o,H),w.onHidden.call(o,H)}}):y.error(C.noTransition))}},get:{html:function(){return D.removeData(k.html),D.data(k.html)||w.html},title:function(){return D.removeData(k.title),D.data(k.title)||w.title},content:function(){return D.removeData(k.content),D.data(k.content)||D.attr("title")||w.content},variation:function(){return D.removeData(k.variation),D.data(k.variation)||w.variation},calculations:function(){var t,n=j[0],i=w.inline||w.popup?j.position():j.offset(),r={};return r={target:{element:j[0],width:j.outerWidth(),height:j.outerHeight(),top:i.top,left:i.left,margin:{}},popup:{width:o.outerWidth(),height:o.outerHeight()},parent:{width:a.outerWidth(),height:a.outerHeight()},screen:{scroll:{top:p.scrollTop(),left:p.scrollLeft()},width:p.width(),height:p.height()}},r.target.margin.top=w.inline?parseInt(e.getComputedStyle(n).getPropertyValue("margin-top"),10):0,r.target.margin.left=w.inline?y.is.rtl()?parseInt(e.getComputedStyle(n).getPropertyValue("margin-right"),10):parseInt(e.getComputedStyle(n).getPropertyValue("margin-left"),10):0,t=r.screen,r.boundary={top:t.scroll.top,bottom:t.scroll.top+t.height,left:t.scroll.left,right:t.scroll.left+t.width},r},id:function(){return b},startEvent:function(){return"hover"==w.on?"mouseenter":"focus"==w.on?"focus":!1},scrollEvent:function(){return"scroll"},endEvent:function(){return"hover"==w.on?"mouseleave":"focus"==w.on?"blur":!1},offsetParent:function(e){var o=e!==n?e[0]:D[0],i=o.parentNode,r=t(i);if(i)for(var a="none"===r.css("transform"),s="static"===r.css("position"),p=r.is("html");i&&!p&&s&&a;)i=i.parentNode,r=t(i),a="none"===r.css("transform"),s="static"===r.css("position"),p=r.is("html");return r&&r.length>0?r:t()},offstagePosition:function(e,n){var i,r,a=o.offset(),s={},p=[];return e=e||!1,n=n||y.get.calculations(),i=n.popup,r=n.boundary,a&&e&&(s={top:a.top