wishthis/node_modules/fomantic-ui/dist/components/popup.min.js

11 lines
19 KiB
JavaScript
Raw Normal View History

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