You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
18 KiB
10 lines
18 KiB
8 years ago
|
/*!
|
||
|
* # Semantic UI 2.2.9 - Popup
|
||
|
* http://github.com/semantic-org/semantic-ui/
|
||
|
*
|
||
|
*
|
||
|
* Released under the MIT license
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
*
|
||
|
*/
|
||
|
!function(t,e,o,n){"use strict";e="undefined"!=typeof e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),t.fn.popup=function(i){var r,a=t(this),s=t(o),p=t(e),l=t("body"),u=a.selector||"",c=!0,d=(new Date).getTime(),f=[],g=arguments[0],h="string"==typeof g,m=[].slice.call(arguments,1);return a.each(function(){var a,v,b,w,y,C,T=t.isPlainObject(i)?t.extend(!0,{},t.fn.popup.settings,i):t.extend({},t.fn.popup.settings),P=T.selector,x=T.className,k=T.error,S=T.metadata,E=T.namespace,A="."+T.namespace,D="module-"+E,O=t(this),j=t(T.context),F=t(T.scrollContext),R=t(T.boundary),H=T.target?t(T.target):O,N=0,M=!1,W=!1,G=this,I=O.data(D);C={initialize:function(){C.debug("Initializing",O),C.createID(),C.bind.events(),!C.exists()&&T.preserve&&C.create(),T.observeChanges&&C.observeChanges(),C.instantiate()},instantiate:function(){C.verbose("Storing instance",C),I=C,O.data(D,I)},observeChanges:function(){"MutationObserver"in e&&(b=new MutationObserver(C.event.documentChanged),b.observe(o,{childList:!0,subtree:!0}),C.debug("Setting up mutation observer",b))},refresh:function(){T.popup?a=t(T.popup).eq(0):T.inline&&(a=H.nextAll(P.popup).eq(0),T.popup=a),T.popup?(a.addClass(x.loading),v=C.get.offsetParent(),a.removeClass(x.loading),T.movePopup&&C.has.popup()&&C.get.offsetParent(a)[0]!==v[0]&&(C.debug("Moving popup to the same offset parent as activating element"),a.detach().appendTo(v))):v=T.inline?C.get.offsetParent(H):C.has.popup()?C.get.offsetParent(a):l,v.is("html")&&v[0]!==l[0]&&(C.debug("Setting page as offset parent"),v=l),C.get.variation()&&C.set.variation()},reposition:function(){C.refresh(),C.set.position()},destroy:function(){C.debug("Destroying previous module"),b&&b.disconnect(),a&&!T.preserve&&C.removePopup(),clearTimeout(C.hideTimer),clearTimeout(C.showTimer),C.unbind.close(),C.unbind.events(),O.removeData(D)},event:{start:function(e){var o=t.isPlainObject(T.delay)?T.delay.show:T.delay;clearTimeout(C.hideTimer),W||(C.showTimer=setTimeout(C.show,o))},end:function(){var e=t.isPlainObject(T.delay)?T.delay.hide:T.delay;clearTimeout(C.showTimer),C.hideTimer=setTimeout(C.hide,e)},touchstart:function(t){W=!0,C.show()},resize:function(){C.is.visible()&&C.set.position()},documentChanged:function(e){[].forEach.call(e,function(e){e.removedNodes&&[].forEach.call(e.removedNodes,function(e){(e==G||t(e).find(G).length>0)&&(C.debug("Element removed from DOM, tearing down events"),C.destroy())})})},hideGracefully:function(e){var n=t(e.target),i=t.contains(o.documentElement,e.target),r=n.closest(P.popup).length>0;e&&!r&&i?(C.debug("Click occurred outside popup hiding popup"),C.hide()):C.debug("Click was inside popup, keeping popup open")}},create:function(){var e=C.get.html(),o=C.get.title(),n=C.get.content();e||n||o?(C.debug("Creating pop-up html"),e||(e=T.templates.popup({title:o,content:n})),a=t("<div/>").addClass(x.popup).data(S.activator,O).html(e),T.inline?(C.verbose("Inserting popup element inline",a),a.insertAfter(O)):(C.verbose("Appending popup element to body",a),a.appendTo(j)),C.refresh(),C.set.variation(),T.hoverable&&C.bind.popup(),T.onCreate.call(a,G)):0!==H.next(P.popup).length?(C.verbose("Pre-existing popup found"),T.inline=!0,T.popup=H.next(P.popup).data(S.activator,O),C.refresh(),T.hoverable&&C.bind.popup()):T.popup?(t(T.popup).data(S.activator,O),C.verbose("Used popup specified in settings"),C.refresh(),T.hoverable&&C.bind.popup()):C.debug("No content specified skipping display",G)},createID:function(){y=(Math.random().toString(16)+"000000000").substr(2,8),w="."+y,C.verbose("Creating unique id for element",y)},toggle:function(){C.debug("Toggling pop-up"),C.is.hidden()?(C.debug("Popup is hidden, showing pop-up"),C.unbind.close(),C.show()):(C.debug("Popup is visible, hiding pop-up"),C.hide())},show:function(t){if(t=t||function(){},C.debug("Showing pop-up",T.transition),C.is.hidden()&&(!C.is.active()||!C.is.dropdown())){if(C.exists()||C.create(),T.onShow.call(a,G)===!1)return void C.debug("onShow callback returned false, cancelling popup animation");T.preserve||T.popup||C.refresh(),a&&C.
|