fomantic-ui 2.10.0-beta.7 → 2.10.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -10
- package/README.md +4 -5
- package/changelog-setup.js +64 -70
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +94 -131
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +152 -205
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +305 -341
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +76 -116
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +58 -91
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +651 -941
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +70 -108
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +182 -256
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +325 -429
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +211 -295
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +67 -97
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +175 -235
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +103 -138
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +79 -120
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +239 -333
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +157 -223
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +122 -163
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +242 -325
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +68 -98
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +116 -159
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +168 -233
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +89 -114
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +86 -141
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +134 -210
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +4006 -5558
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/gulpfile.js +5 -7
- package/package.json +1 -1
- package/scripts/nightly-version.js +7 -10
- package/src/definitions/behaviors/api.js +151 -204
- package/src/definitions/behaviors/form.js +324 -428
- package/src/definitions/behaviors/state.js +67 -97
- package/src/definitions/behaviors/visibility.js +133 -209
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +93 -130
- package/src/definitions/modules/calendar.js +304 -340
- package/src/definitions/modules/checkbox.js +75 -115
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +650 -940
- package/src/definitions/modules/embed.js +69 -107
- package/src/definitions/modules/flyout.js +181 -255
- package/src/definitions/modules/modal.js +210 -294
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +174 -234
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +78 -119
- package/src/definitions/modules/search.js +238 -332
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +121 -162
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +115 -158
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +88 -113
- package/src/definitions/modules/transition.js +85 -140
- package/tasks/admin/components/create.js +88 -108
- package/tasks/admin/components/init.js +26 -32
- package/tasks/admin/components/update.js +46 -53
- package/tasks/admin/distributions/create.js +71 -101
- package/tasks/admin/distributions/init.js +27 -33
- package/tasks/admin/distributions/update.js +45 -52
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +54 -63
- package/tasks/build/javascript.js +45 -53
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -7
- package/tasks/clean.js +2 -4
- package/tasks/collections/admin.js +13 -15
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +2 -4
- package/tasks/collections/install.js +2 -4
- package/tasks/collections/rtl.js +2 -4
- package/tasks/collections/various.js +2 -4
- package/tasks/config/admin/github.js +7 -9
- package/tasks/config/admin/templates/css-package.js +1 -3
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +22 -30
- package/tasks/config/project/install.js +56 -70
- package/tasks/config/project/release.js +6 -8
- package/tasks/config/tasks.js +8 -12
- package/tasks/config/user.js +13 -17
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +24 -30
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +71 -98
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
2
|
+
* # Fomantic UI - 2.10.0-beta.8+62e258f
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(V,X,_){"use strict";function Q(e){return"function"==typeof e&&"number"!=typeof e.nodeType}X=void 0!==X&&X.Math===Math?X:globalThis,V.fn.modal=function(L){var z,e=V(this),q=V(X),I=V(_),B=V("body"),W=Date.now(),j=[],P=L,K="string"==typeof P,R=[].slice.call(arguments,1),U=function(e,t){var n;return 0<=[X,_].indexOf(e)?n=B:0===(n=V(t.document).find(e)).length&&(n=t.frameElement?U(e,t.parent):B),n};return e.each(function(){var n,o,a,e,i,t,s,r,c,l,d,u=V.isPlainObject(L)?V.extend(!0,{},V.fn.modal.settings,L):V.extend({},V.fn.modal.settings),f=u.selector,m=u.className,h=u.namespace,g=u.fields,v=u.error,p="."+h,b="module-"+h,y=V(this),k=U(u.context,X),x=k[0]===B[0],w=y.find(f.closeIcon),C=y.hasClass("modal"),S=this,M=C?y.data(b):void 0,A=!1,D="",T="",H=!1,F=!1,N=!1,O=!1,E={initialize:function(){var a;E.create.id(),C||(E.create.modal(),Q(u.onHidden)||(u.onHidden=function(){E.destroy(),y.remove()})),y.addClass(u.class),""!==u.title&&y.find(f.title).html(E.helpers.escape(u.title,u)).addClass(u.classTitle),""!==u.content&&y.find(f.content).html(E.helpers.escape(u.content,u)).addClass(u.classContent),E.has.configActions()&&(0===(a=y.find(f.actions).addClass(u.classActions)).length?a=V("<div/>",{class:m.actions+" "+(u.classActions||"")}).appendTo(y):a.empty(),u.actions.forEach(function(e){var t=e[g.icon]?"<i "+(e[g.text]?'aria-hidden="true"':"")+' class="'+E.helpers.escape(e[g.icon])+' icon"></i>':"",n=E.helpers.escape(e[g.text]||"",u),i=E.helpers.escape(e[g.class]||""),o=e[g.click]&&Q(e[g.click])?e[g.click]:function(){};a.append(V("<button/>",{html:t+n,"aria-label":(e[g.text]||e[g.icon]||"").replace(/<[^>]+(>|$)/g,""),class:m.button+" "+i,on:{click:function(){var e=V(this);e.is(f.approve)||e.is(f.deny)||!1===o.call(S,y)||E.hide()}}}))})),E.cache={},E.verbose("Initializing dimmer",k),E.create.dimmer(),u.allowMultiple&&E.create.innerDimmer(),u.centered||y.addClass("top aligned"),E.refreshModals(),E.bind.events(),E.observeChanges(),E.instantiate(),u.autoShow&&E.show()},instantiate:function(){E.verbose("Storing instance of modal"),M=E,y.data(b,M)},create:{modal:function(){var e;y=V("<div/>",{class:m.modal,role:"dialog","aria-modal":!0}),u.closeIcon&&(w=V("<i/>",{class:m.close,role:"button",tabindex:0,"aria-label":u.text.close}),y.append(w)),""!==u.title&&(e="_"+E.get.id()+"title",y.attr("aria-labelledby",e),V("<div/>",{class:m.title,id:e}).appendTo(y)),""!==u.content&&(e="_"+E.get.id()+"desc",y.attr("aria-describedby",e),V("<div/>",{class:m.content,id:e}).appendTo(y)),E.has.configActions()&&V("<div/>",{class:m.actions}).appendTo(y),k.append(y),S=y[0]},dimmer:function(){var e={debug:u.debug,dimmerName:"modals"},e=V.extend(!0,e,u.dimmerSettings);void 0===V.fn.dimmer?E.error(v.dimmer):(E.debug("Creating dimmer"),i=k.dimmer(e),H=E.is.scrolling(),u.detachable?(E.verbose("Modal is detachable, moving content into dimmer"),i.dimmer("add content",y)):E.set.undetached(),t=i.dimmer("get dimmer"))},id:function(){l=(Math.random().toString(16)+"000000000").slice(2,10),c="."+l,E.verbose("Creating unique id for element",l)},innerDimmer:function(){0===y.find(f.dimmer).length&&V("<div/>",{class:m.innerDimmer}).prependTo(y)}},destroy:function(){d&&d.disconnect(),E.verbose("Destroying previous modal"),y.removeData(b).off(p),q.off(c),k.off(c),t.off(c),w.off(c),n&&n.off(c),k.dimmer("destroy")},observeChanges:function(){"MutationObserver"in X&&((d=new MutationObserver(function(e){function o(e){for(var t=[],n=0,i=e.length;n<i;n++)Array.prototype.push.apply(t,o(e[n].childNodes)),t.push(e[n]);return t}var n=!1,i=!1,a=!0;e.every(function(e){var t;return"attributes"===e.type?O&&("disabled"===e.attributeName||0<V(e.target).find(":input").addBack(":input").filter(":visible").length)&&(i=!0):(n=!0,t=V(o(e.addedNodes)).filter("a[href], [tabindex], :input:enabled").filter(":visible"),e=V(o(e.removedNodes)).filter("a[href], [tabindex], :input"),(0<t.length||0<e.length)&&(i=!0,(0<t.filter(":input").length||0<e.filter(":input").length)&&(a=!1))),!i}),n&&u.observeChanges&&(E.debug("DOM tree modified, refreshing"),E.refresh()),i&&E.refreshInputs(a)})).observe(S,{attributeFilter:["class","disabled"],attributes:!0,childList:!0,subtree:!0}),E.debug("Setting up mutation observer",d))},refresh:function(){E.remove.scrolling(),E.cacheSizes(),E.can.useFlex()||E.set.modalOffset(),E.set.screenHeight(),E.set.type()},refreshModals:function(){a=y.siblings(f.modal),o=a.add(y)},refreshInputs:function(e){n&&n.off("keydown"+c),0===(n=y.find("a[href], [tabindex], :input:enabled").filter(":visible").filter(function(){return 0===V(this).closest(".disabled").length})).filter(":input").length?(n=y.add(n),y.attr("tabindex",-1)):y.removeAttr("tabindex"),n.first().on("keydown"+c,E.event.inputKeyDown.first),n.last().on("keydown"+c,E.event.inputKeyDown.last),!e&&u.autofocus&&0===n.filter(":focus").length&&E.set.autofocus()},attachEvents:function(e,t){var n=V(e);t=Q(E[t])?E[t]:E.toggle,0<n.length?(E.debug("Attaching modal events to element",e,t),n.off(p).on("click"+p,t)):E.error(v.notFound,e)},bind:{events:function(){E.verbose("Attaching events"),y.on("click"+p,f.close,E.event.close).on("click"+p,f.approve,E.event.approve).on("click"+p,f.deny,E.event.deny),w.on("keyup"+c,E.event.closeKeyUp),q.on("resize"+c,E.event.resize).on("focus"+c,E.event.focus),k.on("click"+c,E.event.click)},scrollLock:function(){i[0].addEventListener("touchmove",E.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){i[0].removeEventListener("touchmove",E.event.preventScroll,{passive:!1})}},get:{id:function(){return l},element:function(){return y},settings:function(){return u}},event:{approve:function(){A||!1===u.onApprove.call(S,V(this))?E.verbose("Approve callback returned false cancelling hide"):(A=!0,E.hide(function(){A=!1}))},preventScroll:function(e){-1!==e.target.className.indexOf("dimmer")&&e.preventDefault()},deny:function(){A||!1===u.onDeny.call(S,V(this))?E.verbose("Deny callback returned false cancelling hide"):(A=!0,E.hide(function(){A=!1}))},close:function(){E.hide()},closeKeyUp:function(e){e=e.which;e!==u.keys.enter&&e!==u.keys.space||!y.hasClass(m.front)||E.hide()},inputKeyDown:{first:function(e){e.which===u.keys.tab&&e.shiftKey&&(n.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==u.keys.tab||e.shiftKey||(n.first().trigger("focus"),e.preventDefault())}},mousedown:function(e){var t=V(e.target),n=E.is.rtl();(s=0<t.closest(f.modal).length)&&E.verbose("Mouse down event registered inside the modal"),(r=E.is.scrolling()&&(!n&&q.outerWidth()-u.scrollbarWidth<=e.clientX||n&&u.scrollbarWidth>=e.clientX))&&E.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(e){if(u.closable)if(s)E.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(r)E.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{var t=0<V(e.target).closest(f.modal).length,e=V.contains(_.documentElement,e.target);if(!t&&e&&E.is.active()&&y.hasClass(m.front)){if(E.debug("Dimmer clicked, hiding all modals"),u.allowMultiple){if(!E.hideAll())return}else if(!E.hide())return;E.remove.clickaway()}}else E.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(E.timer),E.timer=setTimeout(function(){e()},t)},keyboard:function(e){e.which===u.keys.escape&&(u.closable?(E.debug("Escape key pressed hiding modal"),y.hasClass(m.front)&&E.hide()):E.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){i.dimmer("is active")&&(E.is.animating()||E.is.active())&&requestAnimationFrame(E.refresh)},focus:function(){N=!0},click:function(e){N&&_.activeElement!==e.target&&i.dimmer("is active")&&E.is.active()&&u.autofocus&&0===V(_.activeElement).closest(f.modal).length&&requestAnimationFrame(E.set.autofocus),N=!1}},toggle:function(){E.is.active()||E.is.animating()?E.hide():E.show()},show:function(e){e=Q(e)?e:function(){},E.refreshModals(),E.set.dimmerSettings(),E.set.dimmerStyles(),E.showModal(e)},hide:function(e){return e=Q(e)?e:function(){},E.refreshModals(),E.hideModal(e)},showModal:function(e){e=Q(e)?e:function(){},E.is.animating()||!E.is.active()?!1===u.onShow.call(S)?E.verbose("Show callback returned false cancelling show"):(F=E.has.scrollbar(),E.showDimmer(),E.cacheSizes(),F&&E.set.bodyMargin(),E.can.useFlex()?E.remove.legacy():(E.set.legacy(),E.set.modalOffset(),E.debug("Using non-flex legacy modal positioning.")),E.set.screenHeight(),E.set.type(),E.set.clickaway(),!u.allowMultiple&&E.others.active()?E.hideOthers(E.showModal):(A=!1,u.allowMultiple&&(E.others.active()&&a.filter("."+m.active).find(f.dimmer).removeClass("out").addClass("transition fade in active"),u.detachable&&y.detach().appendTo(t)),u.transition&&void 0!==V.fn.transition?(E.debug("Showing modal with css animations"),E.set.observeAttributes(!1),y.transition({debug:u.debug,verbose:u.verbose,silent:u.silent,animation:(u.transition.showMethod||u.transition)+" in",queue:u.queue,duration:u.transition.showDuration||u.duration,useFailSafe:!0,onComplete:function(){u.onVisible.apply(S),u.keyboardShortcuts&&E.add.keyboardShortcuts(),E.save.focus(),E.set.active(),E.refreshInputs(),requestAnimationFrame(E.set.observeAttributes),e()}})):E.error(v.noTransition))):E.debug("Modal is already visible")},hideModal:function(e,t,n){var i=a.filter("."+m.active).last();if(e=Q(e)?e:function(){},!1===u.onHide.call(S,V(this)))return E.verbose("Hide callback returned false cancelling hide"),A=!1;(E.is.animating()||E.is.active())&&(E.debug("Hiding modal"),u.transition&&void 0!==V.fn.transition?(E.remove.active(),E.set.observeAttributes(!1),y.transition({debug:u.debug,verbose:u.verbose,silent:u.silent,animation:(u.transition.hideMethod||u.transition)+" out",queue:u.queue,duration:u.transition.hideDuration||u.duration,useFailSafe:!0,onStart:function(){E.others.active()||E.others.animating()||t?u.allowMultiple&&(n?o:i).find(f.dimmer).removeClass("in").addClass("out"):E.hideDimmer(),u.keyboardShortcuts&&!E.others.active()&&E.remove.keyboardShortcuts()},onComplete:function(){E.unbind.scrollLock(),E.remove.active(),u.allowMultiple&&(i.addClass(m.front),y.removeClass(m.front),(n?o:i).find(f.dimmer).removeClass("active")),Q(u.onHidden)&&u.onHidden.call(S),E.remove.dimmerStyles(),E.restore.focus(),e()}})):E.error(v.noTransition))},showDimmer:function(){i.dimmer("is animating")||!i.dimmer("is active")?(F&&(x||t.css("top",i.scrollTop()),E.save.bodyMargin()),E.debug("Showing dimmer"),i.dimmer("show")):E.debug("Dimmer already visible")},hideDimmer:function(){i.dimmer("is animating")||i.dimmer("is active")?(E.unbind.scrollLock(),i.dimmer("hide",function(){F&&E.restore.bodyMargin(),E.remove.clickaway(),E.remove.screenHeight()})):E.debug("Dimmer is not visible cannot hide")},hideAll:function(n){var i,e=o.filter("."+m.active+", ."+m.animating);if(n=Q(n)?n:function(){},0<e.length)return E.debug("Hiding all visible modals"),i=!0,V(e.get().reverse()).each(function(e,t){i=i&&V(t).modal("hide modal",n,!1,!0)}),i&&E.hideDimmer(),i},hideOthers:function(e){var t=a.filter("."+m.active+", ."+m.animating);e=Q(e)?e:function(){},0<t.length&&(E.debug("Hiding other modals",a),t.modal("hide modal",e,!0))},others:{active:function(){return 0<a.filter("."+m.active).length},animating:function(){return 0<a.filter("."+m.animating).length}},add:{keyboardShortcuts:function(){E.verbose("Adding keyboard shortcuts"),I.on("keydown"+p,E.event.keyboard)}},save:{focus:function(){0<V(_.activeElement).closest(y).length||(e=V(_.activeElement).trigger("blur"))},bodyMargin:function(){D=k.css((x?"margin-":"padding-")+(E.can.leftBodyScrollbar()?"left":"right"));var e=parseInt(D.replace(/[^\d.]/g,""),10),t=x?X.innerWidth-_.documentElement.clientWidth:k[0].offsetWidth-k[0].clientWidth;T=e+t}},restore:{focus:function(){e&&0<e.length&&u.restoreFocus&&e.trigger("focus")},bodyMargin:function(){var n=E.can.leftBodyScrollbar()?"left":"right";k.css((x?"margin-":"padding-")+n,D),k.find(f.bodyFixed.replace("right",n)).each(function(){var e=V(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},remove:{active:function(){y.removeClass(m.active)},legacy:function(){y.removeClass(m.legacy)},clickaway:function(){u.detachable||y.off("mousedown"+c),t.off("mousedown"+c),t.off("mouseup"+c)},dimmerStyles:function(){t.removeClass(m.inverted),i.removeClass(m.blurring)},bodyStyle:function(){""===k.attr("style")&&(E.verbose("Removing style attribute"),k.removeAttr("style"))},screenHeight:function(){E.debug("Removing page height"),k.css("height",""),E.remove.bodyStyle()},keyboardShortcuts:function(){E.verbose("Removing keyboard shortcuts"),I.off("keydown"+p)},scrolling:function(){H||i.removeClass(m.scrolling),y.removeClass(m.scrolling)}},cacheSizes:function(){y.addClass(m.loading);var e=y.prop("scrollHeight"),t=y.outerWidth(),n=y.outerHeight();void 0!==E.cache.pageHeight&&0===n||(V.extend(E.cache,{pageHeight:I.outerHeight(),width:t,height:n+u.offset,scrollHeight:e+u.offset,contextHeight:(x?q:i).height()}),E.cache.topOffset=-E.cache.height/2),y.removeClass(m.loading),E.debug("Caching modal and container sizes",E.cache)},helpers:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const n={'"':""","&":"&","'":"'","<":"<",">":">"};return e.replace(/["'<>]|&(?![\d#A-Za-z]{1,12};)/g,e=>n[e])}},can:{leftBodyScrollbar:function(){return void 0===E.cache.leftBodyScrollbar&&(E.cache.leftBodyScrollbar=E.is.rtl()&&(E.is.iframe&&!E.is.firefox()||E.is.safari())),E.cache.leftBodyScrollbar},useFlex:function(){return"auto"===u.useFlex?u.detachable:(u.useFlex&&!u.detachable&&E.debug("useFlex true in combination with detachable false is not supported"),u.useFlex)},fit:function(){var e=E.cache.contextHeight,t=E.cache.contextHeight/2,n=E.cache.topOffset,i=E.cache.scrollHeight,o=E.cache.height,a=u.padding;return o<i?t+n+i+a<e:o+2*a<e}},has:{configActions:function(){return Array.isArray(u.actions)&&0<u.actions.length},scrollbar:function(){return x||"hidden"!==k.css("overflow-y")}},is:{active:function(){return y.hasClass(m.active)},animating:function(){return y.transition("is animating")},scrolling:function(){return i.hasClass(m.scrolling)},rtl:function(){return void 0===E.cache.isRTL&&(E.cache.isRTL="rtl"===y.attr("dir")||"rtl"===y.css("direction")||"rtl"===B.attr("dir")||"rtl"===B.css("direction")||"rtl"===k.attr("dir")||"rtl"===k.css("direction")),E.cache.isRTL},safari:function(){return void 0===E.cache.isSafari&&(E.cache.isSafari=/constructor/i.test(X.HTMLElement)||!!X.ApplePaySession),E.cache.isSafari},firefox:function(){return void 0===E.cache.isFirefox&&(E.cache.isFirefox=!!X.InstallTrigger),E.cache.isFirefox},iframe:function(){return!(self===top)}},set:{observeAttributes:function(e){O=!1!==e},autofocus:function(){var e=n.filter("[autofocus]"),t=n.filter(":input");(0<e.length?e:0<t.length?t:y).first().trigger("focus")},bodyMargin:function(){var n=E.can.leftBodyScrollbar()?"left":"right";(u.detachable||E.can.fit())&&k.css((x?"margin-":"padding-")+n,T+"px"),k.find(f.bodyFixed.replace("right",n)).each(function(){var e=V(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+T+"px)")})},clickaway:function(){u.detachable||y.on("mousedown"+c,E.event.mousedown),t.on("mousedown"+c,E.event.mousedown),t.on("mouseup"+c,E.event.mouseup)},dimmerSettings:function(){var e;void 0===V.fn.dimmer?E.error(v.dimmer):(e={debug:u.debug,dimmerName:"modals",closable:"auto",useFlex:E.can.useFlex(),duration:{show:u.transition.showDuration||u.duration,hide:u.transition.hideDuration||u.duration}},e=V.extend(!0,e,u.dimmerSettings),u.inverted&&(e.variation=void 0!==e.variation?e.variation+" inverted":"inverted"),k.dimmer("setting",e))},dimmerStyles:function(){u.inverted?t.addClass(m.inverted):t.removeClass(m.inverted),u.blurring?i.addClass(m.blurring):i.removeClass(m.blurring)},modalOffset:function(){var e;u.detachable?y.css({marginTop:!y.hasClass("aligned")&&E.can.fit()?-E.cache.height/2:u.padding/2,marginLeft:-E.cache.width/2}):(e=E.can.fit(),y.css({top:!y.hasClass("aligned")&&e?I.scrollTop()+(E.cache.contextHeight-E.cache.height)/2:!e||y.hasClass("top")?I.scrollTop()+u.padding:I.scrollTop()+(E.cache.contextHeight-E.cache.height-u.padding),marginLeft:-E.cache.width/2})),E.verbose("Setting modal offset for legacy mode")},screenHeight:function(){E.can.fit()?k.css("height",""):y.hasClass("bottom")||(E.debug("Modal is taller than page content, resizing page height"),k.css("height",E.cache.height+2*u.padding+"px"))},active:function(){y.addClass(m.active+" "+m.front),a.filter("."+m.active).removeClass(m.front)},scrolling:function(){i.addClass(m.scrolling),y.addClass(m.scrolling),E.unbind.scrollLock()},legacy:function(){y.addClass(m.legacy)},type:function(){E.can.fit()?(E.verbose("Modal fits on screen"),E.others.active()||E.others.animating()||(E.remove.scrolling(),E.bind.scrollLock())):y.hasClass("bottom")?E.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(E.verbose("Modal cannot fit on screen setting to scrolling"),E.set.scrolling())},undetached:function(){i.addClass(m.undetached)}},setting:function(e,t){if(E.debug("Changing setting",e,t),V.isPlainObject(e))V.extend(!0,u,e);else{if(void 0===t)return u[e];V.isPlainObject(u[e])?V.extend(!0,u[e],t):u[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,E,e);else{if(void 0===t)return E[e];E[e]=t}},debug:function(){!u.silent&&u.debug&&(u.performance?E.performance.log(arguments):(E.debug=Function.prototype.bind.call(console.info,console,u.name+":"),E.debug.apply(console,arguments)))},verbose:function(){!u.silent&&u.verbose&&u.debug&&(u.performance?E.performance.log(arguments):(E.verbose=Function.prototype.bind.call(console.info,console,u.name+":"),E.verbose.apply(console,arguments)))},error:function(){u.silent||(E.error=Function.prototype.bind.call(console.error,console,u.name+":"),E.error.apply(console,arguments))},performance:{log:function(e){var t,n;u.performance&&(n=(t=Date.now())-(W||t),W=t,j.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":n})),clearTimeout(E.performance.timer),E.performance.timer=setTimeout(function(){E.performance.display()},500)},display:function(){var e=u.name+":",n=0;W=!1,clearTimeout(E.performance.timer),V.each(j,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<j.length&&(console.groupCollapsed(e),console.table?console.table(j):V.each(j,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),j=[]}},invoke:function(i,e,t){var o,a,n,s=M;return e=e||R,t=t||S,"string"==typeof i&&void 0!==s&&(i=i.split(/[ .]/),o=i.length-1,V.each(i,function(e,t){var n=e!==o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(V.isPlainObject(s[n])&&e!==o)s=s[n];else{if(void 0!==s[n])return a=s[n],!1;{if(!V.isPlainObject(s[t])||e===o)return void 0!==s[t]?a=s[t]:E.error(v.method,i),!1;s=s[t]}}})),Q(a)?n=a.apply(t,e):void 0!==a&&(n=a),Array.isArray(z)?z.push(n):void 0!==z?z=[z,n]:void 0!==n&&(z=n),a}};K?(void 0===M&&(Q(u.templates[P])&&(u.autoShow=!0,u.className.modal=u.className.template,u=V.extend(!0,{},u,u.templates[P].apply(E,R)),m=u.className,u.namespace,g=u.fields,v=u.error),E.initialize()),Q(u.templates[P])||E.invoke(P)):(void 0!==M&&M.invoke("destroy"),E.initialize(),z=y)}),void 0!==z?z:this},V.modal=V.fn.modal,V.fn.modal.settings={name:"Modal",namespace:"modal",useFlex:"auto",offset:0,silent:!1,debug:!1,verbose:!1,performance:!0,observeChanges:!1,allowMultiple:!1,detachable:!0,closable:!0,autofocus:!0,restoreFocus:!0,autoShow:!1,inverted:!1,blurring:!1,centered:!0,dimmerSettings:{closable:!1,useCSS:!0},keyboardShortcuts:!0,context:"body",queue:!1,duration:500,transition:"scale",padding:50,scrollbarWidth:10,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!1,fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onHide:function(){return!0},onHidden:!1,onApprove:function(){return!0},onDeny:function(){return!0},keys:{space:32,enter:13,escape:27,tab:9},selector:{title:"> .header",content:"> .content",actions:"> .actions",close:"> .close",closeIcon:"> .close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel",modal:".ui.modal",dimmer:"> .ui.dimmer",bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close",prompt:".ui.input > input"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined.",notFound:"The element you specified could not be found"},className:{active:"active",animating:"animating",blurring:"blurring",inverted:"inverted",legacy:"legacy",loading:"loading",scrolling:"scrolling",undetached:"undetached",front:"front",close:"close icon",button:"ui button",modal:"ui modal",title:"header",content:"content",actions:"actions",template:"ui tiny modal",ok:"positive",cancel:"negative",prompt:"ui fluid input",innerDimmer:"ui inverted dimmer"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},V.fn.modal.settings.templates={getArguments:function(e){e=[].slice.call(e);return V.isPlainObject(e[0])?V.extend({handler:function(){},content:"",title:""},e[0]):(Q(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments),n=t.handler;return{title:t.title,content:t.content,onApprove:n,actions:[{text:e.text.ok,class:e.className.ok,click:n}]}},confirm:function(){function e(){i.handler(!0)}function t(){i.handler(!1)}var n=this.get.settings(),i=n.templates.getArguments(arguments);return{title:i.title,content:i.content,onApprove:e,onDeny:t,actions:[{text:n.text.ok,class:n.className.ok,click:e},{text:n.text.cancel,class:n.className.cancel,click:t}]}},prompt:function(){function e(){var e=n.get.settings(),e=n.get.element().find(e.selector.prompt)[0];o.handler(V(e).val())}function t(){o.handler(null)}var n=this,i=this.get.settings(),o=i.templates.getArguments(arguments);return 0===V(V.parseHTML(o.content)).filter(".ui.input").length&&(o.content+='<p><div class="'+this.helpers.escape(i.className.prompt)+'"><input placeholder="'+this.helpers.escape(o.placeholder||"")+'" type="text" value="'+this.helpers.escape(o.defaultValue||"")+'"></div></p>'),{title:o.title,content:o.content,onApprove:e,onDeny:t,actions:[{text:i.text.ok,class:i.className.ok,click:e},{text:i.text.cancel,class:i.className.cancel,click:t}]}}}}(jQuery,window,document);
|
11
|
+
!function(V,X,_){"use strict";function Q(e){return"function"==typeof e&&"number"!=typeof e.nodeType}X=void 0!==X&&X.Math===Math?X:globalThis,V.fn.modal=function(L){let e=V(this),z=V(X),q=V(_),I=V("body"),B=Date.now(),W=[],j=L,P="string"==typeof j,K=[].slice.call(arguments,1),R=function(e,t){let n;return 0<=[X,_].indexOf(e)?n=I:0===(n=V(t.document).find(e)).length&&(n=t.frameElement?R(e,t.parent):I),n},U;return e.each(function(){let r=V.isPlainObject(L)?V.extend(!0,{},V.fn.modal.settings,L):V.extend({},V.fn.modal.settings),a=r.selector,c=r.className;var e=r.namespace;let l=r.fields,d=r.error,i="."+e,t="module-"+e,u=V(this),o=R(r.context,X),s=o[0]===I[0],n=u.find(a.closeIcon),f,m,h,g,p,v,b=u.hasClass("modal"),y=this,k=b?u.data(t):void 0,x=!1,w,C,S="",M="",A=!1,D=!1,T=!1,H,F,N,O=!1,E;E={initialize:function(){if(E.create.id(),b||(E.create.modal(),Q(r.onHidden)||(r.onHidden=function(){E.destroy(),u.remove()})),u.addClass(r.class),""!==r.title&&u.find(a.title).html(E.helpers.escape(r.title,r)).addClass(r.classTitle),""!==r.content&&u.find(a.content).html(E.helpers.escape(r.content,r)).addClass(r.classContent),E.has.configActions()){let s=u.find(a.actions).addClass(r.classActions);0===s.length?s=V("<div/>",{class:c.actions+" "+(r.classActions||"")}).appendTo(u):s.empty(),r.actions.forEach(function(e){var t=e[l.icon]?"<i "+(e[l.text]?'aria-hidden="true"':"")+' class="'+E.helpers.escape(e[l.icon])+' icon"></i>':"",n=E.helpers.escape(e[l.text]||"",r),i=E.helpers.escape(e[l.class]||"");let o=e[l.click]&&Q(e[l.click])?e[l.click]:function(){};s.append(V("<button/>",{html:t+n,"aria-label":(e[l.text]||e[l.icon]||"").replace(/<[^>]+(>|$)/g,""),class:c.button+" "+i,on:{click:function(){let e=V(this);e.is(a.approve)||e.is(a.deny)||!1===o.call(y,u)||E.hide()}}}))})}E.cache={},E.verbose("Initializing dimmer",o),E.create.dimmer(),r.allowMultiple&&E.create.innerDimmer(),r.centered||u.addClass("top aligned"),E.refreshModals(),E.bind.events(),E.observeChanges(),E.instantiate(),r.autoShow&&E.show()},instantiate:function(){E.verbose("Storing instance of modal"),k=E,u.data(t,k)},create:{modal:function(){var e;u=V("<div/>",{class:c.modal,role:"dialog","aria-modal":!0}),r.closeIcon&&(n=V("<i/>",{class:c.close,role:"button",tabindex:0,"aria-label":r.text.close}),u.append(n)),""!==r.title&&(e="_"+E.get.id()+"title",u.attr("aria-labelledby",e),V("<div/>",{class:c.title,id:e}).appendTo(u)),""!==r.content&&(e="_"+E.get.id()+"desc",u.attr("aria-describedby",e),V("<div/>",{class:c.content,id:e}).appendTo(u)),E.has.configActions()&&V("<div/>",{class:c.actions}).appendTo(u),o.append(u),y=u[0]},dimmer:function(){var e={debug:r.debug,dimmerName:"modals"},e=V.extend(!0,e,r.dimmerSettings);void 0===V.fn.dimmer?E.error(d.dimmer):(E.debug("Creating dimmer"),p=o.dimmer(e),A=E.is.scrolling(),r.detachable?(E.verbose("Modal is detachable, moving content into dimmer"),p.dimmer("add content",u)):E.set.undetached(),v=p.dimmer("get dimmer"))},id:function(){F=(Math.random().toString(16)+"000000000").slice(2,10),H="."+F,E.verbose("Creating unique id for element",F)},innerDimmer:function(){0===u.find(a.dimmer).length&&V("<div/>",{class:c.innerDimmer}).prependTo(u)}},destroy:function(){N&&N.disconnect(),E.verbose("Destroying previous modal"),u.removeData(t).off(i),z.off(H),o.off(H),v.off(H),n.off(H),f&&f.off(H),o.dimmer("destroy")},observeChanges:function(){"MutationObserver"in X&&((N=new MutationObserver(function(e){function o(n){let i=[];for(let e=0,t=n.length;e<t;e++)Array.prototype.push.apply(i,o(n[e].childNodes)),i.push(n[e]);return i}let i=!1,s=!1,a=!0;e.every(function(n){if("attributes"===n.type)O&&("disabled"===n.attributeName||0<V(n.target).find(":input").addBack(":input").filter(":visible").length)&&(s=!0);else{i=!0;let e=V(o(n.addedNodes)).filter("a[href], [tabindex], :input:enabled").filter(":visible"),t=V(o(n.removedNodes)).filter("a[href], [tabindex], :input");(0<e.length||0<t.length)&&(s=!0,(0<e.filter(":input").length||0<t.filter(":input").length)&&(a=!1))}return!s}),i&&r.observeChanges&&(E.debug("DOM tree modified, refreshing"),E.refresh()),s&&E.refreshInputs(a)})).observe(y,{attributeFilter:["class","disabled"],attributes:!0,childList:!0,subtree:!0}),E.debug("Setting up mutation observer",N))},refresh:function(){E.remove.scrolling(),E.cacheSizes(),E.can.useFlex()||E.set.modalOffset(),E.set.screenHeight(),E.set.type()},refreshModals:function(){h=u.siblings(a.modal),m=h.add(u)},refreshInputs:function(e){f&&f.off("keydown"+H),0===(f=u.find("a[href], [tabindex], :input:enabled").filter(":visible").filter(function(){return 0===V(this).closest(".disabled").length})).filter(":input").length?(f=u.add(f),u.attr("tabindex",-1)):u.removeAttr("tabindex"),f.first().on("keydown"+H,E.event.inputKeyDown.first),f.last().on("keydown"+H,E.event.inputKeyDown.last),!e&&r.autofocus&&0===f.filter(":focus").length&&E.set.autofocus()},attachEvents:function(e,t){let n=V(e);t=Q(E[t])?E[t]:E.toggle,0<n.length?(E.debug("Attaching modal events to element",e,t),n.off(i).on("click"+i,t)):E.error(d.notFound,e)},bind:{events:function(){E.verbose("Attaching events"),u.on("click"+i,a.close,E.event.close).on("click"+i,a.approve,E.event.approve).on("click"+i,a.deny,E.event.deny),n.on("keyup"+H,E.event.closeKeyUp),z.on("resize"+H,E.event.resize).on("focus"+H,E.event.focus),o.on("click"+H,E.event.click)},scrollLock:function(){p[0].addEventListener("touchmove",E.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){p[0].removeEventListener("touchmove",E.event.preventScroll,{passive:!1})}},get:{id:function(){return F},element:function(){return u},settings:function(){return r}},event:{approve:function(){x||!1===r.onApprove.call(y,V(this))?E.verbose("Approve callback returned false cancelling hide"):(x=!0,E.hide(function(){x=!1}))},preventScroll:function(e){-1!==e.target.className.indexOf("dimmer")&&e.preventDefault()},deny:function(){x||!1===r.onDeny.call(y,V(this))?E.verbose("Deny callback returned false cancelling hide"):(x=!0,E.hide(function(){x=!1}))},close:function(){E.hide()},closeKeyUp:function(e){e=e.which;e!==r.keys.enter&&e!==r.keys.space||!u.hasClass(c.front)||E.hide()},inputKeyDown:{first:function(e){e.which===r.keys.tab&&e.shiftKey&&(f.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==r.keys.tab||e.shiftKey||(f.first().trigger("focus"),e.preventDefault())}},mousedown:function(e){let t=V(e.target);var n=E.is.rtl();(w=0<t.closest(a.modal).length)&&E.verbose("Mouse down event registered inside the modal"),(C=E.is.scrolling()&&(!n&&z.outerWidth()-r.scrollbarWidth<=e.clientX||n&&r.scrollbarWidth>=e.clientX))&&E.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(t){if(r.closable)if(w)E.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(C)E.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{let e=V(t.target);var n=0<e.closest(a.modal).length,t=V.contains(_.documentElement,t.target);if(!n&&t&&E.is.active()&&u.hasClass(c.front)){if(E.debug("Dimmer clicked, hiding all modals"),r.allowMultiple){if(!E.hideAll())return}else if(!E.hide())return;E.remove.clickaway()}}else E.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(E.timer),E.timer=setTimeout(function(){e()},t)},keyboard:function(e){e.which===r.keys.escape&&(r.closable?(E.debug("Escape key pressed hiding modal"),u.hasClass(c.front)&&E.hide()):E.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){p.dimmer("is active")&&(E.is.animating()||E.is.active())&&requestAnimationFrame(E.refresh)},focus:function(){T=!0},click:function(e){T&&_.activeElement!==e.target&&p.dimmer("is active")&&E.is.active()&&r.autofocus&&0===V(_.activeElement).closest(a.modal).length&&requestAnimationFrame(E.set.autofocus),T=!1}},toggle:function(){E.is.active()||E.is.animating()?E.hide():E.show()},show:function(e){e=Q(e)?e:function(){},E.refreshModals(),E.set.dimmerSettings(),E.set.dimmerStyles(),E.showModal(e)},hide:function(e){return e=Q(e)?e:function(){},E.refreshModals(),E.hideModal(e)},showModal:function(e){e=Q(e)?e:function(){},E.is.animating()||!E.is.active()?!1===r.onShow.call(y)?E.verbose("Show callback returned false cancelling show"):(D=E.has.scrollbar(),E.showDimmer(),E.cacheSizes(),D&&E.set.bodyMargin(),E.can.useFlex()?E.remove.legacy():(E.set.legacy(),E.set.modalOffset(),E.debug("Using non-flex legacy modal positioning.")),E.set.screenHeight(),E.set.type(),E.set.clickaway(),!r.allowMultiple&&E.others.active()?E.hideOthers(E.showModal):(x=!1,r.allowMultiple&&(E.others.active()&&h.filter("."+c.active).find(a.dimmer).removeClass("out").addClass("transition fade in active"),r.detachable&&u.detach().appendTo(v)),r.transition&&void 0!==V.fn.transition?(E.debug("Showing modal with css animations"),E.set.observeAttributes(!1),u.transition({debug:r.debug,verbose:r.verbose,silent:r.silent,animation:(r.transition.showMethod||r.transition)+" in",queue:r.queue,duration:r.transition.showDuration||r.duration,useFailSafe:!0,onComplete:function(){r.onVisible.apply(y),r.keyboardShortcuts&&E.add.keyboardShortcuts(),E.save.focus(),E.set.active(),E.refreshInputs(),requestAnimationFrame(E.set.observeAttributes),e()}})):E.error(d.noTransition))):E.debug("Modal is already visible")},hideModal:function(e,t,n){let i=h.filter("."+c.active).last();if(e=Q(e)?e:function(){},!1===r.onHide.call(y,V(this)))return E.verbose("Hide callback returned false cancelling hide"),x=!1;(E.is.animating()||E.is.active())&&(E.debug("Hiding modal"),r.transition&&void 0!==V.fn.transition?(E.remove.active(),E.set.observeAttributes(!1),u.transition({debug:r.debug,verbose:r.verbose,silent:r.silent,animation:(r.transition.hideMethod||r.transition)+" out",queue:r.queue,duration:r.transition.hideDuration||r.duration,useFailSafe:!0,onStart:function(){E.others.active()||E.others.animating()||t?r.allowMultiple&&(n?m:i).find(a.dimmer).removeClass("in").addClass("out"):E.hideDimmer(),r.keyboardShortcuts&&!E.others.active()&&E.remove.keyboardShortcuts()},onComplete:function(){E.unbind.scrollLock(),E.remove.active(),r.allowMultiple&&(i.addClass(c.front),u.removeClass(c.front),(n?m:i).find(a.dimmer).removeClass("active")),Q(r.onHidden)&&r.onHidden.call(y),E.remove.dimmerStyles(),E.restore.focus(),e()}})):E.error(d.noTransition))},showDimmer:function(){p.dimmer("is animating")||!p.dimmer("is active")?(D&&(s||v.css("top",p.scrollTop()),E.save.bodyMargin()),E.debug("Showing dimmer"),p.dimmer("show")):E.debug("Dimmer already visible")},hideDimmer:function(){p.dimmer("is animating")||p.dimmer("is active")?(E.unbind.scrollLock(),p.dimmer("hide",function(){D&&E.restore.bodyMargin(),E.remove.clickaway(),E.remove.screenHeight()})):E.debug("Dimmer is not visible cannot hide")},hideAll:function(i){let e=m.filter("."+c.active+", ."+c.animating);if(i=Q(i)?i:function(){},0<e.length){E.debug("Hiding all visible modals");let n=!0;return V(e.get().reverse()).each(function(e,t){n=n&&V(t).modal("hide modal",i,!1,!0)}),n&&E.hideDimmer(),n}},hideOthers:function(e){let t=h.filter("."+c.active+", ."+c.animating);e=Q(e)?e:function(){},0<t.length&&(E.debug("Hiding other modals",h),t.modal("hide modal",e,!0))},others:{active:function(){return 0<h.filter("."+c.active).length},animating:function(){return 0<h.filter("."+c.animating).length}},add:{keyboardShortcuts:function(){E.verbose("Adding keyboard shortcuts"),q.on("keydown"+i,E.event.keyboard)}},save:{focus:function(){let e=V(_.activeElement);0<e.closest(u).length||(g=V(_.activeElement).trigger("blur"))},bodyMargin:function(){S=o.css((s?"margin-":"padding-")+(E.can.leftBodyScrollbar()?"left":"right"));var e=parseInt(S.replace(/[^\d.]/g,""),10),t=s?X.innerWidth-_.documentElement.clientWidth:o[0].offsetWidth-o[0].clientWidth;M=e+t}},restore:{focus:function(){g&&0<g.length&&r.restoreFocus&&g.trigger("focus")},bodyMargin:function(){let n=E.can.leftBodyScrollbar()?"left":"right";o.css((s?"margin-":"padding-")+n,S),o.find(a.bodyFixed.replace("right",n)).each(function(){let e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},remove:{active:function(){u.removeClass(c.active)},legacy:function(){u.removeClass(c.legacy)},clickaway:function(){r.detachable||u.off("mousedown"+H),v.off("mousedown"+H),v.off("mouseup"+H)},dimmerStyles:function(){v.removeClass(c.inverted),p.removeClass(c.blurring)},bodyStyle:function(){""===o.attr("style")&&(E.verbose("Removing style attribute"),o.removeAttr("style"))},screenHeight:function(){E.debug("Removing page height"),o.css("height",""),E.remove.bodyStyle()},keyboardShortcuts:function(){E.verbose("Removing keyboard shortcuts"),q.off("keydown"+i)},scrolling:function(){A||p.removeClass(c.scrolling),u.removeClass(c.scrolling)}},cacheSizes:function(){u.addClass(c.loading);var e=u.prop("scrollHeight"),t=u.outerWidth(),n=u.outerHeight();void 0!==E.cache.pageHeight&&0===n||(V.extend(E.cache,{pageHeight:q.outerHeight(),width:t,height:n+r.offset,scrollHeight:e+r.offset,contextHeight:(s?z:p).height()}),E.cache.topOffset=-E.cache.height/2),u.removeClass(c.loading),E.debug("Caching modal and container sizes",E.cache)},helpers:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const n={'"':""","&":"&","'":"'","<":"<",">":">"};return e.replace(/["'<>]|&(?![\d#A-Za-z]{1,12};)/g,e=>n[e])}},can:{leftBodyScrollbar:function(){return void 0===E.cache.leftBodyScrollbar&&(E.cache.leftBodyScrollbar=E.is.rtl()&&(E.is.iframe&&!E.is.firefox()||E.is.safari())),E.cache.leftBodyScrollbar},useFlex:function(){return"auto"===r.useFlex?r.detachable:(r.useFlex&&!r.detachable&&E.debug("useFlex true in combination with detachable false is not supported"),r.useFlex)},fit:function(){var e=E.cache.contextHeight,t=E.cache.contextHeight/2,n=E.cache.topOffset,i=E.cache.scrollHeight,o=E.cache.height,s=r.padding;return o<i?t+n+i+s<e:o+2*s<e}},has:{configActions:function(){return Array.isArray(r.actions)&&0<r.actions.length},scrollbar:function(){return s||"hidden"!==o.css("overflow-y")}},is:{active:function(){return u.hasClass(c.active)},animating:function(){return u.transition("is animating")},scrolling:function(){return p.hasClass(c.scrolling)},rtl:function(){return void 0===E.cache.isRTL&&(E.cache.isRTL="rtl"===u.attr("dir")||"rtl"===u.css("direction")||"rtl"===I.attr("dir")||"rtl"===I.css("direction")||"rtl"===o.attr("dir")||"rtl"===o.css("direction")),E.cache.isRTL},safari:function(){return void 0===E.cache.isSafari&&(E.cache.isSafari=/constructor/i.test(X.HTMLElement)||!!X.ApplePaySession),E.cache.isSafari},firefox:function(){return void 0===E.cache.isFirefox&&(E.cache.isFirefox=!!X.InstallTrigger),E.cache.isFirefox},iframe:function(){return!(self===top)}},set:{observeAttributes:function(e){O=!1!==e},autofocus:function(){let e=f.filter("[autofocus]"),t=f.filter(":input"),n=(0<e.length?e:0<t.length?t:u).first();n.trigger("focus")},bodyMargin:function(){let n=E.can.leftBodyScrollbar()?"left":"right";(r.detachable||E.can.fit())&&o.css((s?"margin-":"padding-")+n,M+"px"),o.find(a.bodyFixed.replace("right",n)).each(function(){let e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+M+"px)")})},clickaway:function(){r.detachable||u.on("mousedown"+H,E.event.mousedown),v.on("mousedown"+H,E.event.mousedown),v.on("mouseup"+H,E.event.mouseup)},dimmerSettings:function(){if(void 0===V.fn.dimmer)E.error(d.dimmer);else{var t={debug:r.debug,dimmerName:"modals",closable:"auto",useFlex:E.can.useFlex(),duration:{show:r.transition.showDuration||r.duration,hide:r.transition.hideDuration||r.duration}};let e=V.extend(!0,t,r.dimmerSettings);r.inverted&&(e.variation=void 0!==e.variation?e.variation+" inverted":"inverted"),o.dimmer("setting",e)}},dimmerStyles:function(){r.inverted?v.addClass(c.inverted):v.removeClass(c.inverted),r.blurring?p.addClass(c.blurring):p.removeClass(c.blurring)},modalOffset:function(){var e;r.detachable?u.css({marginTop:!u.hasClass("aligned")&&E.can.fit()?-E.cache.height/2:r.padding/2,marginLeft:-E.cache.width/2}):(e=E.can.fit(),u.css({top:!u.hasClass("aligned")&&e?q.scrollTop()+(E.cache.contextHeight-E.cache.height)/2:!e||u.hasClass("top")?q.scrollTop()+r.padding:q.scrollTop()+(E.cache.contextHeight-E.cache.height-r.padding),marginLeft:-E.cache.width/2})),E.verbose("Setting modal offset for legacy mode")},screenHeight:function(){E.can.fit()?o.css("height",""):u.hasClass("bottom")||(E.debug("Modal is taller than page content, resizing page height"),o.css("height",E.cache.height+2*r.padding+"px"))},active:function(){u.addClass(c.active+" "+c.front),h.filter("."+c.active).removeClass(c.front)},scrolling:function(){p.addClass(c.scrolling),u.addClass(c.scrolling),E.unbind.scrollLock()},legacy:function(){u.addClass(c.legacy)},type:function(){E.can.fit()?(E.verbose("Modal fits on screen"),E.others.active()||E.others.animating()||(E.remove.scrolling(),E.bind.scrollLock())):u.hasClass("bottom")?E.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(E.verbose("Modal cannot fit on screen setting to scrolling"),E.set.scrolling())},undetached:function(){p.addClass(c.undetached)}},setting:function(e,t){if(E.debug("Changing setting",e,t),V.isPlainObject(e))V.extend(!0,r,e);else{if(void 0===t)return r[e];V.isPlainObject(r[e])?V.extend(!0,r[e],t):r[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,E,e);else{if(void 0===t)return E[e];E[e]=t}},debug:function(){!r.silent&&r.debug&&(r.performance?E.performance.log(arguments):(E.debug=Function.prototype.bind.call(console.info,console,r.name+":"),E.debug.apply(console,arguments)))},verbose:function(){!r.silent&&r.verbose&&r.debug&&(r.performance?E.performance.log(arguments):(E.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),E.verbose.apply(console,arguments)))},error:function(){r.silent||(E.error=Function.prototype.bind.call(console.error,console,r.name+":"),E.error.apply(console,arguments))},performance:{log:function(e){var t,n;r.performance&&(n=(t=Date.now())-(B||t),B=t,W.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:y,"Execution Time":n})),clearTimeout(E.performance.timer),E.performance.timer=setTimeout(function(){E.performance.display()},500)},display:function(){var e=r.name+":";let n=0;B=!1,clearTimeout(E.performance.timer),V.each(W,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<W.length&&(console.groupCollapsed(e),console.table?console.table(W):V.each(W,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),W=[]}},invoke:function(i,e,t){let o=k,s,a,n;return e=e||K,t=t||y,"string"==typeof i&&void 0!==o&&(i=i.split(/[ .]/),s=i.length-1,V.each(i,function(e,t){var n=e!==s?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(V.isPlainObject(o[n])&&e!==s)o=o[n];else{if(void 0!==o[n])return a=o[n],!1;{if(!V.isPlainObject(o[t])||e===s)return void 0!==o[t]?a=o[t]:E.error(d.method,i),!1;o=o[t]}}})),Q(a)?n=a.apply(t,e):void 0!==a&&(n=a),Array.isArray(U)?U.push(n):void 0!==U?U=[U,n]:void 0!==n&&(U=n),a}},P?(void 0===k&&(Q(r.templates[j])&&(r.autoShow=!0,r.className.modal=r.className.template,r=V.extend(!0,{},r,r.templates[j].apply(E,K)),c=r.className,r.namespace,l=r.fields,d=r.error),E.initialize()),Q(r.templates[j])||E.invoke(j)):(void 0!==k&&k.invoke("destroy"),E.initialize(),U=u)}),void 0!==U?U:this},V.modal=V.fn.modal,V.fn.modal.settings={name:"Modal",namespace:"modal",useFlex:"auto",offset:0,silent:!1,debug:!1,verbose:!1,performance:!0,observeChanges:!1,allowMultiple:!1,detachable:!0,closable:!0,autofocus:!0,restoreFocus:!0,autoShow:!1,inverted:!1,blurring:!1,centered:!0,dimmerSettings:{closable:!1,useCSS:!0},keyboardShortcuts:!0,context:"body",queue:!1,duration:500,transition:"scale",padding:50,scrollbarWidth:10,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!1,fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onHide:function(){return!0},onHidden:!1,onApprove:function(){return!0},onDeny:function(){return!0},keys:{space:32,enter:13,escape:27,tab:9},selector:{title:"> .header",content:"> .content",actions:"> .actions",close:"> .close",closeIcon:"> .close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel",modal:".ui.modal",dimmer:"> .ui.dimmer",bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close",prompt:".ui.input > input"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined.",notFound:"The element you specified could not be found"},className:{active:"active",animating:"animating",blurring:"blurring",inverted:"inverted",legacy:"legacy",loading:"loading",scrolling:"scrolling",undetached:"undetached",front:"front",close:"close icon",button:"ui button",modal:"ui modal",title:"header",content:"content",actions:"actions",template:"ui tiny modal",ok:"positive",cancel:"negative",prompt:"ui fluid input",innerDimmer:"ui inverted dimmer"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},V.fn.modal.settings.templates={getArguments:function(e){let t=[].slice.call(e);return V.isPlainObject(t[0])?V.extend({handler:function(){},content:"",title:""},t[0]):(Q(t[t.length-1])||t.push(function(){}),{handler:t.pop(),content:t.pop()||"",title:t.pop()||""})},alert:function(){let e=this.get.settings();var t=e.templates.getArguments(arguments),n=t.handler;return{title:t.title,content:t.content,onApprove:n,actions:[{text:e.text.ok,class:e.className.ok,click:n}]}},confirm:function(){let e=this.get.settings(),t=e.templates.getArguments(arguments);function n(){t.handler(!0)}function i(){t.handler(!1)}return{title:t.title,content:t.content,onApprove:n,onDeny:i,actions:[{text:e.text.ok,class:e.className.ok,click:n},{text:e.text.cancel,class:e.className.cancel,click:i}]}},prompt:function(){let t=this,e=this.get.settings(),n=e.templates.getArguments(arguments);function i(){var e=t.get.settings(),e=t.get.element().find(e.selector.prompt)[0];n.handler(V(e).val())}function o(){n.handler(null)}return 0===V(V.parseHTML(n.content)).filter(".ui.input").length&&(n.content+='<p><div class="'+this.helpers.escape(e.className.prompt)+'"><input placeholder="'+this.helpers.escape(n.placeholder||"")+'" type="text" value="'+this.helpers.escape(n.defaultValue||"")+'"></div></p>'),{title:n.title,content:n.content,onApprove:i,onDeny:o,actions:[{text:e.text.ok,class:e.className.ok,click:i},{text:e.text.cancel,class:e.className.cancel,click:o}]}}}}(jQuery,window,document);
|
package/dist/components/nag.css
CHANGED
package/dist/components/nag.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.8+62e258f - Nag
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,53 +20,49 @@
|
|
20
20
|
: globalThis;
|
21
21
|
|
22
22
|
$.fn.nag = function (parameters) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
41
|
-
}
|
23
|
+
let $allModules = $(this);
|
24
|
+
let $body = $('body');
|
25
|
+
|
26
|
+
let time = Date.now();
|
27
|
+
let performance = [];
|
28
|
+
|
29
|
+
let query = arguments[0];
|
30
|
+
let methodInvoked = typeof query === 'string';
|
31
|
+
let queryArguments = [].slice.call(arguments, 1);
|
32
|
+
let contextCheck = function (context, win) {
|
33
|
+
let $context;
|
34
|
+
if ([window, document].indexOf(context) >= 0) {
|
35
|
+
$context = $(context);
|
36
|
+
} else {
|
37
|
+
$context = $(win.document).find(context);
|
38
|
+
if ($context.length === 0) {
|
39
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
42
40
|
}
|
41
|
+
}
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
;
|
43
|
+
return $context;
|
44
|
+
};
|
45
|
+
let returnedValue;
|
48
46
|
$allModules.each(function () {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
: $.extend({}, $.fn.nag.settings),
|
47
|
+
let settings = $.isPlainObject(parameters)
|
48
|
+
? $.extend(true, {}, $.fn.nag.settings, parameters)
|
49
|
+
: $.extend({}, $.fn.nag.settings);
|
53
50
|
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
let selector = settings.selector;
|
52
|
+
let error = settings.error;
|
53
|
+
let namespace = settings.namespace;
|
57
54
|
|
58
|
-
|
59
|
-
|
55
|
+
let eventNamespace = '.' + namespace;
|
56
|
+
let moduleNamespace = namespace + '-module';
|
60
57
|
|
61
|
-
|
58
|
+
let $module = $(this);
|
62
59
|
|
63
|
-
|
60
|
+
let $context = settings.context ? contextCheck(settings.context, window) : $body;
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
;
|
62
|
+
let element = this;
|
63
|
+
let instance = $module.data(moduleNamespace);
|
64
|
+
let storage;
|
65
|
+
let module;
|
70
66
|
module = {
|
71
67
|
|
72
68
|
initialize: function () {
|
@@ -77,14 +73,12 @@
|
|
77
73
|
storage = module.get.storage();
|
78
74
|
$module
|
79
75
|
.on('click' + eventNamespace, selector.close, module.dismiss)
|
80
|
-
.data(moduleNamespace, module)
|
81
|
-
;
|
76
|
+
.data(moduleNamespace, module);
|
82
77
|
|
83
78
|
if (settings.detachable && $module.parent()[0] !== $context[0]) {
|
84
79
|
$module
|
85
80
|
.detach()
|
86
|
-
.prependTo($context)
|
87
|
-
;
|
81
|
+
.prependTo($context);
|
88
82
|
}
|
89
83
|
|
90
84
|
if (settings.displayTime > 0) {
|
@@ -99,8 +93,7 @@
|
|
99
93
|
module.verbose('Destroying instance');
|
100
94
|
$module
|
101
95
|
.removeData(moduleNamespace)
|
102
|
-
.off(eventNamespace)
|
103
|
-
;
|
96
|
+
.off(eventNamespace);
|
104
97
|
},
|
105
98
|
|
106
99
|
show: function () {
|
@@ -113,12 +106,10 @@
|
|
113
106
|
module.debug('Showing nag', settings.animation.show);
|
114
107
|
if (settings.animation.show === 'fade') {
|
115
108
|
$module
|
116
|
-
.fadeIn(settings.duration, settings.easing, settings.onVisible)
|
117
|
-
;
|
109
|
+
.fadeIn(settings.duration, settings.easing, settings.onVisible);
|
118
110
|
} else {
|
119
111
|
$module
|
120
|
-
.slideDown(settings.duration, settings.easing, settings.onVisible)
|
121
|
-
;
|
112
|
+
.slideDown(settings.duration, settings.easing, settings.onVisible);
|
122
113
|
}
|
123
114
|
}
|
124
115
|
},
|
@@ -132,12 +123,10 @@
|
|
132
123
|
module.debug('Hiding nag', settings.animation.hide);
|
133
124
|
if (settings.animation.hide === 'fade') {
|
134
125
|
$module
|
135
|
-
.fadeOut(settings.duration, settings.easing, settings.onHidden)
|
136
|
-
;
|
126
|
+
.fadeOut(settings.duration, settings.easing, settings.onHidden);
|
137
127
|
} else {
|
138
128
|
$module
|
139
|
-
.slideUp(settings.duration, settings.easing, settings.onHidden)
|
140
|
-
;
|
129
|
+
.slideUp(settings.duration, settings.easing, settings.onHidden);
|
141
130
|
}
|
142
131
|
},
|
143
132
|
|
@@ -200,14 +189,12 @@
|
|
200
189
|
// RFC6265 compliant encoding
|
201
190
|
key = encodeURIComponent(key)
|
202
191
|
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
203
|
-
.replace(/[()]/g, escape)
|
204
|
-
;
|
192
|
+
.replace(/[()]/g, escape);
|
205
193
|
value = encodeURIComponent(value)
|
206
|
-
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent)
|
207
|
-
;
|
194
|
+
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent);
|
208
195
|
|
209
|
-
|
210
|
-
for (
|
196
|
+
let cookieOptions = '';
|
197
|
+
for (let option in options) {
|
211
198
|
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
212
199
|
cookieOptions += '; ' + option;
|
213
200
|
if (typeof options[option] === 'string') {
|
@@ -218,12 +205,10 @@
|
|
218
205
|
document.cookie = key + '=' + value + cookieOptions;
|
219
206
|
},
|
220
207
|
getItem: function (key) {
|
221
|
-
|
222
|
-
for (
|
223
|
-
|
224
|
-
|
225
|
-
foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent)
|
226
|
-
;
|
208
|
+
let cookies = document.cookie.split('; ');
|
209
|
+
for (let i = 0, il = cookies.length; i < il; i++) {
|
210
|
+
let parts = cookies[i].split('=');
|
211
|
+
let foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent);
|
227
212
|
if (key === foundKey) {
|
228
213
|
return parts[1] || '';
|
229
214
|
}
|
@@ -238,9 +223,7 @@
|
|
238
223
|
module.error(error.noStorage);
|
239
224
|
},
|
240
225
|
storageOptions: function () {
|
241
|
-
|
242
|
-
options = {}
|
243
|
-
;
|
226
|
+
let options = {};
|
244
227
|
if (settings.expires) {
|
245
228
|
options.expires = module.get.expirationDate(settings.expires);
|
246
229
|
}
|
@@ -267,9 +250,7 @@
|
|
267
250
|
|
268
251
|
storage: {
|
269
252
|
set: function (key, value) {
|
270
|
-
|
271
|
-
options = module.get.storageOptions()
|
272
|
-
;
|
253
|
+
let options = module.get.storageOptions();
|
273
254
|
if (storage === window.localStorage && options.expires) {
|
274
255
|
module.debug('Storing expiration value in localStorage', key, options.expires);
|
275
256
|
storage.setItem(key + settings.expirationKey, options.expires);
|
@@ -282,12 +263,10 @@
|
|
282
263
|
}
|
283
264
|
},
|
284
265
|
get: function (key) {
|
285
|
-
|
286
|
-
storedValue
|
287
|
-
;
|
266
|
+
let storedValue;
|
288
267
|
storedValue = storage.getItem(key);
|
289
268
|
if (storage === window.localStorage) {
|
290
|
-
|
269
|
+
let expiration = storage.getItem(key + settings.expirationKey);
|
291
270
|
if (expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
|
292
271
|
module.debug('Value in localStorage has expired. Deleting key', key);
|
293
272
|
module.storage.remove(key);
|
@@ -301,9 +280,7 @@
|
|
301
280
|
return storedValue;
|
302
281
|
},
|
303
282
|
remove: function (key) {
|
304
|
-
|
305
|
-
options = module.get.storageOptions()
|
306
|
-
;
|
283
|
+
let options = module.get.storageOptions();
|
307
284
|
options.expires = module.get.expirationDate(-1);
|
308
285
|
if (storage === window.localStorage) {
|
309
286
|
storage.removeItem(key + settings.expirationKey);
|
@@ -363,11 +340,9 @@
|
|
363
340
|
},
|
364
341
|
performance: {
|
365
342
|
log: function (message) {
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
previousTime
|
370
|
-
;
|
343
|
+
let currentTime;
|
344
|
+
let executionTime;
|
345
|
+
let previousTime;
|
371
346
|
if (settings.performance) {
|
372
347
|
currentTime = Date.now();
|
373
348
|
previousTime = time || currentTime;
|
@@ -386,10 +361,8 @@
|
|
386
361
|
}, 500);
|
387
362
|
},
|
388
363
|
display: function () {
|
389
|
-
|
390
|
-
|
391
|
-
totalTime = 0
|
392
|
-
;
|
364
|
+
let title = settings.name + ':';
|
365
|
+
let totalTime = 0;
|
393
366
|
time = false;
|
394
367
|
clearTimeout(module.performance.timer);
|
395
368
|
$.each(performance, function (index, data) {
|
@@ -411,22 +384,19 @@
|
|
411
384
|
},
|
412
385
|
},
|
413
386
|
invoke: function (query, passedArguments, context) {
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
response
|
419
|
-
;
|
387
|
+
let object = instance;
|
388
|
+
let maxDepth;
|
389
|
+
let found;
|
390
|
+
let response;
|
420
391
|
passedArguments = passedArguments || queryArguments;
|
421
392
|
context = context || element;
|
422
393
|
if (typeof query === 'string' && object !== undefined) {
|
423
394
|
query = query.split(/[ .]/);
|
424
395
|
maxDepth = query.length - 1;
|
425
396
|
$.each(query, function (depth, value) {
|
426
|
-
|
397
|
+
let camelCaseValue = depth !== maxDepth
|
427
398
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
428
|
-
: query
|
429
|
-
;
|
399
|
+
: query;
|
430
400
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
431
401
|
object = object[camelCaseValue];
|
432
402
|
} else if (object[camelCaseValue] !== undefined) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
2
|
+
* # Fomantic UI - 2.10.0-beta.8+62e258f
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(w,S,D){"use strict";S=void 0!==S&&S.Math===Math?S:globalThis,w.fn.nag=function(g){
|
11
|
+
!function(w,S,D){"use strict";S=void 0!==S&&S.Math===Math?S:globalThis,w.fn.nag=function(g){let e=w(this),p=w("body"),m=Date.now(),f=[],h=g,b="string"==typeof h,v=[].slice.call(arguments,1),y=function(e,t){let n;return 0<=[S,D].indexOf(e)?n=w(e):0===(n=w(t.document).find(e)).length&&(n=t.frameElement?y(e,t.parent):p),n},x;return e.each(function(){let o=w.isPlainObject(g)?w.extend(!0,{},w.fn.nag.settings,g):w.extend({},w.fn.nag.settings),e=o.selector,l=o.error;var t=o.namespace;let n="."+t,i=t+"-module",a=w(this),r=o.context?y(o.context,S):p,c=this,d=a.data(i),s,u;u={initialize:function(){u.verbose("Initializing element"),"string"!=typeof o.value&&(o.value=JSON.stringify(o.value)),s=u.get.storage(),a.on("click"+n,e.close,u.dismiss).data(i,u),o.detachable&&a.parent()[0]!==r[0]&&a.detach().prependTo(r),0<o.displayTime&&setTimeout(function(){u.hide()},o.displayTime),u.show()},destroy:function(){u.verbose("Destroying instance"),a.removeData(i).off(n)},show:function(){if(u.should.show()&&!a.is(":visible")){if(!1===o.onShow.call(c))return u.debug("onShow callback returned false, cancelling nag animation"),!1;u.debug("Showing nag",o.animation.show),"fade"===o.animation.show?a.fadeIn(o.duration,o.easing,o.onVisible):a.slideDown(o.duration,o.easing,o.onVisible)}},hide:function(){if(!1===o.onHide.call(c))return u.debug("onHide callback returned false, cancelling nag animation"),!1;u.debug("Hiding nag",o.animation.hide),"fade"===o.animation.hide?a.fadeOut(o.duration,o.easing,o.onHidden):a.slideUp(o.duration,o.easing,o.onHidden)},dismiss:function(e){!1!==u.hide()&&o.storageMethod&&(u.debug("Dismissing nag",o.storageMethod,o.key,o.value,o.expires),u.storage.set(o.key,o.value)),e&&(e.stopImmediatePropagation(),e.preventDefault())},should:{show:function(){return o.persist?(u.debug("Persistent nag is set, can show nag"),!0):u.storage.get(o.key)!=o.value.toString()?(u.debug("Stored value is not set, can show nag",u.storage.get(o.key)),!0):(u.debug("Stored value is set, cannot show nag",u.storage.get(o.key)),!1)}},get:{expirationDate:function(e){if((e="number"==typeof e?new Date(Date.now()+864e5*e):e)instanceof Date&&e.getTime())return e.toUTCString();u.error(l.expiresFormat)},storage:function(){return"localstorage"===o.storageMethod&&void 0!==S.localStorage?(u.debug("Using local storage"),S.localStorage):"sessionstorage"===o.storageMethod&&void 0!==S.sessionStorage?(u.debug("Using session storage"),S.sessionStorage):"cookie"in D?(u.debug("Using cookie"),{setItem:function(e,t,n){e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),t=encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g,decodeURIComponent);let o="";for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(o+="; "+i,"string"==typeof n[i]&&(o+="="+n[i].split(";")[0]));D.cookie=e+"="+t+o},getItem:function(n){let o=D.cookie.split("; ");for(let t=0,e=o.length;t<e;t++){let e=o[t].split("=");if(n===e[0].replace(/(%[\da-f]{2})+/gi,decodeURIComponent))return e[1]||""}},removeItem:function(e,t){s.setItem(e,"",t)}}):void u.error(l.noStorage)},storageOptions:function(){let e={};return o.expires&&(e.expires=u.get.expirationDate(o.expires)),o.domain&&(e.domain=o.domain),o.path&&(e.path=o.path),o.secure&&(e.secure=o.secure),o.samesite&&(e.samesite=o.samesite),e}},clear:function(){u.storage.remove(o.key)},storage:{set:function(e,t){var n=u.get.storageOptions();s===S.localStorage&&n.expires&&(u.debug("Storing expiration value in localStorage",e,n.expires),s.setItem(e+o.expirationKey,n.expires)),u.debug("Value stored",e,t);try{s.setItem(e,t,n)}catch(e){u.error(l.setItem,e)}},get:function(e){let t;var n;return t=s.getItem(e),s===S.localStorage&&null!=(n=s.getItem(e+o.expirationKey))&&new Date(n)<new Date&&(u.debug("Value in localStorage has expired. Deleting key",e),u.storage.remove(e),t=null),t="undefined"!==t&&"null"!==t&&void 0!==t&&null!==t?t:void 0},remove:function(e){let t=u.get.storageOptions();t.expires=u.get.expirationDate(-1),s===S.localStorage&&s.removeItem(e+o.expirationKey),s.removeItem(e,t)}},setting:function(e,t){if(u.debug("Changing setting",e,t),w.isPlainObject(e))w.extend(!0,o,e);else{if(void 0===t)return o[e];w.isPlainObject(o[e])?w.extend(!0,o[e],t):o[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,u,e);else{if(void 0===t)return u[e];u[e]=t}},debug:function(){!o.silent&&o.debug&&(o.performance?u.performance.log(arguments):(u.debug=Function.prototype.bind.call(console.info,console,o.name+":"),u.debug.apply(console,arguments)))},verbose:function(){!o.silent&&o.verbose&&o.debug&&(o.performance?u.performance.log(arguments):(u.verbose=Function.prototype.bind.call(console.info,console,o.name+":"),u.verbose.apply(console,arguments)))},error:function(){o.silent||(u.error=Function.prototype.bind.call(console.error,console,o.name+":"),u.error.apply(console,arguments))},performance:{log:function(e){var t,n;o.performance&&(n=(t=Date.now())-(m||t),m=t,f.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:c,"Execution Time":n})),clearTimeout(u.performance.timer),u.performance.timer=setTimeout(function(){u.performance.display()},500)},display:function(){var e=o.name+":";let n=0;m=!1,clearTimeout(u.performance.timer),w.each(f,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<f.length&&(console.groupCollapsed(e),console.table?console.table(f):w.each(f,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),f=[]}},invoke:function(o,e,t){let i=d,a,r,n;var s;return e=e||v,t=t||c,"string"==typeof o&&void 0!==i&&(o=o.split(/[ .]/),a=o.length-1,w.each(o,function(e,t){var n=e!==a?t+o[e+1].charAt(0).toUpperCase()+o[e+1].slice(1):o;if(w.isPlainObject(i[n])&&e!==a)i=i[n];else{if(void 0!==i[n])return r=i[n],!1;{if(!w.isPlainObject(i[t])||e===a)return void 0!==i[t]?r=i[t]:u.error(l.method,o),!1;i=i[t]}}})),"function"==typeof(s=r)&&"number"!=typeof s.nodeType?n=r.apply(t,e):void 0!==r&&(n=r),Array.isArray(x)?x.push(n):void 0!==x?x=[x,n]:void 0!==n&&(x=n),r}},b?(void 0===d&&u.initialize(),u.invoke(h)):(void 0!==d&&d.invoke("destroy"),u.initialize())}),void 0!==x?x:this},w.fn.nag.settings={name:"Nag",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},context:!1,detachable:!1,expires:30,domain:!1,path:"/",secure:!1,samesite:!1,storageMethod:"cookie",key:"nag",value:"dismiss",expirationKey:"ExpirationDate",error:{noStorage:"Unsupported storage method",method:"The method you called is not defined.",setItem:"Unexpected error while setting value",expiresFormat:'"expires" must be a number of days or a Date Object'},className:{bottom:"bottom",fixed:"fixed"},selector:{close:"> .close.icon"},duration:500,easing:"easeOutQuad",onShow:function(){},onVisible:function(){},onHide:function(){},onHidden:function(){}},w.extend(w.easing,{easeOutQuad:function(e){return 1-(1-e)*(1-e)}})}(jQuery,window,document);
|