rails-active-ui 0.1.0
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.
- checksums.yaml +7 -0
- data/Rakefile +6 -0
- data/app/assets/stylesheets.css +73555 -0
- data/app/components/accordion_component.rb +34 -0
- data/app/components/ad_component.rb +28 -0
- data/app/components/api_component.rb +24 -0
- data/app/components/breadcrumb_component.rb +26 -0
- data/app/components/button_component.rb +49 -0
- data/app/components/calendar_component.rb +34 -0
- data/app/components/card_component.rb +56 -0
- data/app/components/checkbox_component.rb +41 -0
- data/app/components/column_component.rb +62 -0
- data/app/components/comment_component.rb +45 -0
- data/app/components/concerns/alignable.rb +21 -0
- data/app/components/concerns/attachable.rb +16 -0
- data/app/components/concerns/orientable.rb +21 -0
- data/app/components/concerns/positionable.rb +21 -0
- data/app/components/concerns/sizeable.rb +18 -0
- data/app/components/container_component.rb +23 -0
- data/app/components/dimmer_component.rb +30 -0
- data/app/components/divider_component.rb +30 -0
- data/app/components/dropdown_component.rb +63 -0
- data/app/components/embed_component.rb +32 -0
- data/app/components/emoji_component.rb +15 -0
- data/app/components/feed_component.rb +22 -0
- data/app/components/flag_component.rb +15 -0
- data/app/components/flyout_component.rb +41 -0
- data/app/components/form_component.rb +39 -0
- data/app/components/grid_component.rb +85 -0
- data/app/components/h_stack_component.rb +67 -0
- data/app/components/header_component.rb +60 -0
- data/app/components/icon_component.rb +41 -0
- data/app/components/image_component.rb +46 -0
- data/app/components/input_component.rb +52 -0
- data/app/components/item_component.rb +39 -0
- data/app/components/item_group_component.rb +30 -0
- data/app/components/label_component.rb +49 -0
- data/app/components/link_component.rb +23 -0
- data/app/components/list_component.rb +39 -0
- data/app/components/loader_component.rb +33 -0
- data/app/components/menu_component.rb +64 -0
- data/app/components/menu_item_component.rb +52 -0
- data/app/components/message_component.rb +54 -0
- data/app/components/modal_component.rb +50 -0
- data/app/components/nag_component.rb +25 -0
- data/app/components/overlay_component.rb +16 -0
- data/app/components/placeholder_component.rb +39 -0
- data/app/components/popup_component.rb +31 -0
- data/app/components/progress_component.rb +48 -0
- data/app/components/pusher_component.rb +18 -0
- data/app/components/rail_component.rb +31 -0
- data/app/components/rating_component.rb +41 -0
- data/app/components/reset_component.rb +12 -0
- data/app/components/reveal_component.rb +39 -0
- data/app/components/row_component.rb +39 -0
- data/app/components/search_component.rb +44 -0
- data/app/components/segment_component.rb +57 -0
- data/app/components/segment_group_component.rb +36 -0
- data/app/components/shape_component.rb +25 -0
- data/app/components/sidebar_component.rb +33 -0
- data/app/components/site_component.rb +12 -0
- data/app/components/slider_component.rb +46 -0
- data/app/components/state_component.rb +25 -0
- data/app/components/statistic_component.rb +43 -0
- data/app/components/step_component.rb +56 -0
- data/app/components/step_group_component.rb +38 -0
- data/app/components/sticky_component.rb +22 -0
- data/app/components/sub_header_component.rb +15 -0
- data/app/components/sub_menu_component.rb +24 -0
- data/app/components/tab_component.rb +24 -0
- data/app/components/table_cell_component.rb +60 -0
- data/app/components/table_component.rb +160 -0
- data/app/components/table_row_component.rb +43 -0
- data/app/components/text_component.rb +73 -0
- data/app/components/toast_component.rb +36 -0
- data/app/components/transition_component.rb +32 -0
- data/app/components/v_stack_component.rb +31 -0
- data/app/components/visibility_component.rb +22 -0
- data/app/helpers/component_helper.rb +109 -0
- data/app/helpers/fui_helper.rb +53 -0
- data/app/javascript/accordion.js +547 -0
- data/app/javascript/accordion.min.js +11 -0
- data/app/javascript/api.js +1112 -0
- data/app/javascript/api.min.js +11 -0
- data/app/javascript/calendar.js +1960 -0
- data/app/javascript/calendar.min.js +11 -0
- data/app/javascript/checkbox.js +819 -0
- data/app/javascript/checkbox.min.js +11 -0
- data/app/javascript/dimmer.js +686 -0
- data/app/javascript/dimmer.min.js +11 -0
- data/app/javascript/dropdown.js +4019 -0
- data/app/javascript/dropdown.min.js +11 -0
- data/app/javascript/embed.js +646 -0
- data/app/javascript/embed.min.js +11 -0
- data/app/javascript/flyout.js +1405 -0
- data/app/javascript/flyout.min.js +11 -0
- data/app/javascript/form.js +2070 -0
- data/app/javascript/form.min.js +11 -0
- data/app/javascript/jquery.js +10716 -0
- data/app/javascript/jquery.min.js +2 -0
- data/app/javascript/modal.js +1507 -0
- data/app/javascript/modal.min.js +11 -0
- data/app/javascript/nag.js +522 -0
- data/app/javascript/nag.min.js +11 -0
- data/app/javascript/popup.js +1457 -0
- data/app/javascript/popup.min.js +11 -0
- data/app/javascript/progress.js +922 -0
- data/app/javascript/progress.min.js +11 -0
- data/app/javascript/rating.js +496 -0
- data/app/javascript/rating.min.js +11 -0
- data/app/javascript/search.js +1519 -0
- data/app/javascript/search.min.js +11 -0
- data/app/javascript/shape.js +721 -0
- data/app/javascript/shape.min.js +11 -0
- data/app/javascript/sidebar.js +952 -0
- data/app/javascript/sidebar.min.js +11 -0
- data/app/javascript/site.js +415 -0
- data/app/javascript/site.min.js +11 -0
- data/app/javascript/slider.js +1449 -0
- data/app/javascript/slider.min.js +11 -0
- data/app/javascript/state.js +653 -0
- data/app/javascript/state.min.js +11 -0
- data/app/javascript/sticky.js +852 -0
- data/app/javascript/sticky.min.js +11 -0
- data/app/javascript/tab.js +867 -0
- data/app/javascript/tab.min.js +11 -0
- data/app/javascript/toast.js +916 -0
- data/app/javascript/toast.min.js +11 -0
- data/app/javascript/transition.js +955 -0
- data/app/javascript/transition.min.js +11 -0
- data/app/javascript/ui/controllers/fui_accordion_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_api_controller.js +80 -0
- data/app/javascript/ui/controllers/fui_calendar_controller.js +66 -0
- data/app/javascript/ui/controllers/fui_checkbox_controller.js +48 -0
- data/app/javascript/ui/controllers/fui_dimmer_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_dropdown_controller.js +68 -0
- data/app/javascript/ui/controllers/fui_embed_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_flyout_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_form_controller.js +62 -0
- data/app/javascript/ui/controllers/fui_modal_controller.js +61 -0
- data/app/javascript/ui/controllers/fui_nag_controller.js +52 -0
- data/app/javascript/ui/controllers/fui_popup_controller.js +58 -0
- data/app/javascript/ui/controllers/fui_progress_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_rating_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_search_controller.js +76 -0
- data/app/javascript/ui/controllers/fui_shape_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_sidebar_controller.js +48 -0
- data/app/javascript/ui/controllers/fui_site_controller.js +29 -0
- data/app/javascript/ui/controllers/fui_slider_controller.js +53 -0
- data/app/javascript/ui/controllers/fui_state_controller.js +63 -0
- data/app/javascript/ui/controllers/fui_sticky_controller.js +50 -0
- data/app/javascript/ui/controllers/fui_tab_controller.js +57 -0
- data/app/javascript/ui/controllers/fui_toast_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_transition_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_visibility_controller.js +55 -0
- data/app/javascript/ui/index.js +114 -0
- data/app/javascript/visibility.js +1196 -0
- data/app/javascript/visibility.min.js +11 -0
- data/app/lib/component.rb +63 -0
- data/config/importmap.rb +27 -0
- data/config/initializers/ruby_template_handler.rb +31 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/ui_tasks.rake +4 -0
- data/lib/ui/engine.rb +27 -0
- data/lib/ui/version.rb +3 -0
- data/lib/ui.rb +6 -0
- metadata +220 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* # Fomantic UI - 2.9.4
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI
|
|
4
|
+
* https://fomantic-ui.com/
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2026 Contributors
|
|
7
|
+
* Released under the MIT license
|
|
8
|
+
* https://opensource.org/licenses/MIT
|
|
9
|
+
*
|
|
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(...e){const z=V(X),q=V(_),I=V("body"),t=Q(this)?I:V(this);let B=Date.now(),W=[];const j=e[0],P="string"==typeof j,K=e.slice(1),R=function(e,t){let n;return[X,_].includes(e)?n=I:0===(n=V(t.document).find(e)).length&&(n=t.frameElement?R(e,t.parent):I),n};let U;return t.each(function(){let c=V.isPlainObject(j)?V.extend(!0,{},V.fn.modal.settings,j):V.extend({},V.fn.modal.settings);const l=c.selector;let d=c.className;var e=c.namespace;let u=c.fields,r=c.error;const i="."+e,t="module-"+e;let f=V(this);const m=R(c.context,X),o=m[0]===I[0];let n=f.find(l.closeIcon),s,a,h,g,p,v;const b=f.hasClass("modal");let y=this,k=b?f.data(t):void 0,w=!1,x,C,S="",M=0,A=0,D=!1,T=!1,H=!1,F,N,L,E=!1;const O={initialize:function(){if(O.create.id(),b||(O.create.modal(),Q(c.onHidden)||(c.onHidden=function(){O.destroy(),f.remove()})),f.addClass(c.class),""!==c.title&&f.find(l.title).html(O.helpers.escape(c.title,c)).addClass(c.classTitle),""!==c.content&&f.find(l.content).html(O.helpers.escape(c.content,c)).addClass(c.classContent),O.has.configActions()){let e=f.find(l.actions).addClass(c.classActions);0===e.length?e=V("<div/>",{class:d.actions+" "+(c.classActions||"")}).appendTo(f):e.empty();for(const o of c.actions){var t=o[u.icon]?"<i "+(o[u.text]?'aria-hidden="true"':"")+' class="'+O.helpers.escape(o[u.icon])+' icon"></i>':"",n=O.helpers.escape(o[u.text]||"",c),i=O.helpers.escape(o[u.class]||"");const s=o[u.click]&&Q(o[u.click])?o[u.click]:function(){},a=y,r=f;e.append(V("<button/>",{html:t+n,"aria-label":(o[u.text]||o[u.icon]||"").replace(/<[^>]+(>|$)/g,""),class:d.button+" "+i,on:{click:function(){const e=V(this);e.is(l.approve)||e.is(l.deny)||!1===s.call(a,r)||O.hide()}}}))}}O.cache={},O.verbose("Initializing dimmer",m),O.create.dimmer(),c.allowMultiple&&O.create.innerDimmer(),c.centered||f.addClass("top aligned"),O.refreshModals(),O.bind.events(),O.observeChanges(),O.instantiate(),c.autoShow&&O.show()},instantiate:function(){O.verbose("Storing instance of modal"),k=O,f.data(t,k)},create:{modal:function(){var e;f=V("<div/>",{class:d.modal,role:"dialog","aria-modal":!0}),c.closeIcon&&(n=V("<i/>",{class:d.close,role:"button",tabindex:0,"aria-label":c.text.close}),f.append(n)),""!==c.title&&(e="_"+O.get.id()+"title",f.attr("aria-labelledby",e),V("<div/>",{class:d.title,id:e}).appendTo(f)),""!==c.content&&(e="_"+O.get.id()+"desc",f.attr("aria-describedby",e),V("<div/>",{class:d.content,id:e}).appendTo(f)),O.has.configActions()&&V("<div/>",{class:d.actions}).appendTo(f),m.append(f),y=f[0]},dimmer:function(){var e={debug:c.debug,dimmerName:"modals"},e=V.extend(!0,e,c.dimmerSettings);void 0===V.fn.dimmer?O.error(r.dimmer):(O.debug("Creating dimmer"),p=m.dimmer(e),D=O.is.scrolling(),c.detachable?(O.verbose("Modal is detachable, moving content into dimmer"),p.dimmer("add content",f)):O.set.undetached(),v=p.dimmer("get dimmer"))},id:function(){N=(Math.random().toString(16)+"000000000").slice(2,10),F="."+N,O.verbose("Creating unique id for element",N)},innerDimmer:function(){0===f.find(l.dimmer).length&&V("<div/>",{class:d.innerDimmer}).prependTo(f)}},destroy:function(){L&&L.disconnect(),O.verbose("Destroying previous modal"),f.removeData(t).off(i),z.off(F),m.off(F),v.off(F),n.off(F),s&&s.off(F),m.dimmer("destroy")},observeChanges:function(){(L=new MutationObserver(function(e){function i(e){const t=[];for(const n of e)t.push(...i(n.childNodes),n);return t}let o=!1,s=!1,a=!0;e.every(function(e){if("attributes"===e.type)E&&("disabled"===e.attributeName||0<V(e.target).find(":input").addBack(":input").filter(":visible").length)&&(s=!0);else{o=!0;const t=V(i(e.addedNodes)).filter("a[href], [tabindex], :input:enabled").filter(":visible"),n=V(i(e.removedNodes)).filter("a[href], [tabindex], :input");(0<t.length||0<n.length)&&(s=!0,(0<t.filter(":input").length||0<n.filter(":input").length)&&(a=!1))}return!s}),o&&c.observeChanges&&(O.debug("DOM tree modified, refreshing"),O.refresh()),s&&O.refreshInputs(a)})).observe(y,{attributeFilter:["class","disabled"],attributes:!0,childList:!0,subtree:!0}),O.debug("Setting up mutation observer",L)},refresh:function(){O.remove.scrolling(),O.cacheSizes(),O.can.useFlex()||O.set.modalOffset(),O.set.screenHeight(),O.set.type()},refreshModals:function(){h=f.siblings(l.modal),a=h.add(f)},refreshInputs:function(e){s&&s.off("keydown"+F),0===(s=f.find("a[href], [tabindex], :input:enabled").filter(":visible").filter(function(){return 0===V(this).closest(".disabled").length})).filter(":input").length?(s=f.add(s),f.attr("tabindex",-1)):f.removeAttr("tabindex"),s.first().on("keydown"+F,O.event.inputKeyDown.first),s.last().on("keydown"+F,O.event.inputKeyDown.last),!e&&c.autofocus&&0===s.filter(":focus").length&&O.set.autofocus()},attachEvents:function(e,t){const n=V(e);t=Q(O[t])?O[t]:O.toggle,0<n.length?(O.debug("Attaching modal events to element",e,t),n.off(i).on("click"+i,t)):O.error(r.notFound,e)},bind:{events:function(){O.verbose("Attaching events"),f.on("click"+i,l.close,O.event.close).on("click"+i,l.approve,O.event.approve).on("click"+i,l.deny,O.event.deny),n.on("keyup"+F,O.event.closeKeyUp),z.on("resize"+F,O.event.resize).on("focus"+F,O.event.focus),m.on("click"+F,O.event.click)},scrollLock:function(){p[0].addEventListener("touchmove",O.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){p[0].removeEventListener("touchmove",O.event.preventScroll,{passive:!1})}},get:{id:function(){return N},element:function(){return f},settings:function(){return c}},event:{approve:function(){w||!1===c.onApprove.call(y,V(this))?O.verbose("Approve callback returned false cancelling hide"):(w=!0,O.hide(function(){w=!1}))},preventScroll:function(e){e.target.className.includes("dimmer")&&e.preventDefault()},deny:function(){w||!1===c.onDeny.call(y,V(this))?O.verbose("Deny callback returned false cancelling hide"):(w=!0,O.hide(function(){w=!1}))},close:function(){O.hide()},closeKeyUp:function(e){e=e.which;e!==c.keys.enter&&e!==c.keys.space||!f.hasClass(d.front)||O.hide()},inputKeyDown:{first:function(e){e.which===c.keys.tab&&e.shiftKey&&(s.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==c.keys.tab||e.shiftKey||(s.first().trigger("focus"),e.preventDefault())}},mousedown:function(e){const t=V(e.target);var n=O.is.rtl();(x=0<t.closest(l.modal).length)&&O.verbose("Mouse down event registered inside the modal"),(C=O.is.scrolling()&&(!n&&z.outerWidth()-c.scrollbarWidth<=e.clientX||n&&c.scrollbarWidth>=e.clientX))&&O.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(e){if(c.closable)if(x)O.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(C)O.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{const n=V(e.target);var t=0<n.closest(l.modal).length,e=_.documentElement.contains(e.target);if(!t&&e&&O.is.active()&&f.hasClass(d.front)){if(O.debug("Dimmer clicked, hiding all modals"),c.allowMultiple){if(!O.hideAll())return}else if(!O.hide())return;O.remove.clickaway()}}else O.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(O.timer),O.timer=setTimeout(function(){e()},t)},keyboard:function(e){e.which===c.keys.escape&&(c.closable?(O.debug("Escape key pressed hiding modal"),f.hasClass(d.front)&&O.hide()):O.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){p.dimmer("is active")&&(O.is.animating()||O.is.active())&&requestAnimationFrame(O.refresh)},focus:function(){H=!0},click:function(e){H&&_.activeElement!==e.target&&p.dimmer("is active")&&O.is.active()&&c.autofocus&&0===V(_.activeElement).closest(l.modal).length&&requestAnimationFrame(O.set.autofocus),H=!1}},toggle:function(){O.is.active()||O.is.animating()?O.hide():O.show()},show:function(e){e=Q(e)?e:function(){},O.refreshModals(),O.set.dimmerSettings(),O.set.dimmerStyles(),O.showModal(e)},hide:function(e){return e=Q(e)?e:function(){},O.refreshModals(),O.hideModal(e)},showModal:function(e){e=Q(e)?e:function(){},O.is.animating()||!O.is.active()?!1===c.onShow.call(y)?O.verbose("Show callback returned false cancelling show"):(T=O.has.scrollbar(),O.showDimmer(),O.cacheSizes(),T&&O.set.bodyMargin(),O.can.useFlex()?O.remove.legacy():(O.set.legacy(),O.set.modalOffset(),O.debug("Using non-flex legacy modal positioning.")),O.set.screenHeight(),O.set.type(),O.set.clickaway(),!c.allowMultiple&&O.others.active()?O.hideOthers(O.showModal):(w=!1,c.allowMultiple&&(O.others.active()&&h.filter("."+d.active).find(l.dimmer).removeClass("out").addClass("transition fade in active"),c.detachable&&f.detach().appendTo(v)),c.transition&&void 0!==V.fn.transition?(O.debug("Showing modal with css animations"),O.set.observeAttributes(!1),f.transition({debug:c.debug,verbose:c.verbose,silent:c.silent,animation:(c.transition.showMethod||c.transition)+" in",queue:c.queue,duration:c.transition.showDuration||c.duration,useFailSafe:!0,onComplete:function(){c.onVisible.call(y),c.keyboardShortcuts&&O.add.keyboardShortcuts(),O.save.focus(),O.set.active(),O.refreshInputs(),requestAnimationFrame(O.set.observeAttributes),e()}})):O.error(r.noTransition))):O.debug("Modal is already visible")},hideModal:function(e,t,n){const i=h.filter("."+d.active).last();if(e=Q(e)?e:function(){},!1===c.onHide.call(y,V(this)))return O.verbose("Hide callback returned false cancelling hide"),w=!1;(O.is.animating()||O.is.active())&&(O.debug("Hiding modal"),c.transition&&void 0!==V.fn.transition?(O.remove.active(),O.set.observeAttributes(!1),f.transition({debug:c.debug,verbose:c.verbose,silent:c.silent,animation:(c.transition.hideMethod||c.transition)+" out",queue:c.queue,duration:c.transition.hideDuration||c.duration,useFailSafe:!0,onStart:function(){O.others.active()||O.others.animating()||t?c.allowMultiple&&(n?a:i).find(l.dimmer).removeClass("in").addClass("out"):O.hideDimmer(),c.keyboardShortcuts&&!O.others.active()&&O.remove.keyboardShortcuts()},onComplete:function(){O.unbind.scrollLock(),O.remove.active(),c.allowMultiple&&(i.addClass(d.front),f.removeClass(d.front),(n?a:i).find(l.dimmer).removeClass("active")),Q(c.onHidden)&&c.onHidden.call(y),O.remove.dimmerStyles(),O.restore.focus(),e()}})):O.error(r.noTransition))},showDimmer:function(){p.dimmer("is animating")||!p.dimmer("is active")?(T&&(o||v.css("top",p.scrollTop()),O.save.bodyMargin()),O.debug("Showing dimmer"),p.dimmer("show")):O.debug("Dimmer already visible")},hideDimmer:function(){p.dimmer("is animating")||p.dimmer("is active")?(O.unbind.scrollLock(),p.dimmer("hide",function(){T&&O.restore.bodyMargin(),O.remove.clickaway(),O.remove.screenHeight()})):O.debug("Dimmer is not visible cannot hide")},hideAll:function(i){const e=a.filter("."+d.active+", ."+d.animating);if(i=Q(i)?i:function(){},0<e.length){O.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&&O.hideDimmer(),n}},hideOthers:function(e){const t=h.filter("."+d.active+", ."+d.animating);e=Q(e)?e:function(){},0<t.length&&(O.debug("Hiding other modals",h),t.modal("hide modal",e,!0))},others:{active:function(){return 0<h.filter("."+d.active).length},animating:function(){return 0<h.filter("."+d.animating).length}},add:{keyboardShortcuts:function(){O.verbose("Adding keyboard shortcuts"),q.on("keydown"+i,O.event.keyboard)}},save:{focus:function(){const e=V(_.activeElement);0<e.closest(f).length||(g=V(_.activeElement).trigger("blur"))},bodyMargin:function(){S=m.css((o?"margin-":"padding-")+(O.can.leftBodyScrollbar()?"left":"right")),M=Number.parseInt(S.replace(/[^\d.]/g,""),10);var e=o?X.innerWidth-_.documentElement.clientWidth:m[0].offsetWidth-m[0].clientWidth;A=M+e}},restore:{focus:function(){g&&0<g.length&&c.restoreFocus&&g.trigger("focus")},bodyMargin:function(){const n=O.can.leftBodyScrollbar()?"left":"right";m.css((o?"margin-":"padding-")+n,0===M?"":S),m.find(l.bodyFixed.replace("right",n)).each(function(){const e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},remove:{active:function(){f.removeClass(d.active)},legacy:function(){f.removeClass(d.legacy)},clickaway:function(){c.detachable||f.off("mousedown"+F),v.off("mousedown"+F),v.off("mouseup"+F)},dimmerStyles:function(){v.removeClass(d.inverted),p.removeClass(d.blurring)},bodyStyle:function(){""===m.attr("style")&&(O.verbose("Removing style attribute"),m.removeAttr("style"))},screenHeight:function(){O.debug("Removing page height"),m.css("height",""),O.remove.bodyStyle()},keyboardShortcuts:function(){O.verbose("Removing keyboard shortcuts"),q.off("keydown"+i)},scrolling:function(){D||p.removeClass(d.scrolling),f.removeClass(d.scrolling)}},cacheSizes:function(){f.addClass(d.loading);var e=f.prop("scrollHeight"),t=f.outerWidth(),n=f.outerHeight();void 0!==O.cache.pageHeight&&0===n||(V.extend(O.cache,{pageHeight:q.outerHeight(),width:t,height:n+c.offset,scrollHeight:e+c.offset,contextHeight:(o?z:p).height()}),O.cache.topOffset=-O.cache.height/2),f.removeClass(d.loading),O.debug("Caching modal and container sizes",O.cache)},helpers:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const n={'"':""","&":"&","'":"'","<":"<",">":">"};return String(e).replace(/["&'<>]/g,e=>n[e])}},can:{leftBodyScrollbar:function(){return void 0===O.cache.leftBodyScrollbar&&(O.cache.leftBodyScrollbar=O.is.rtl()&&(O.is.iframe&&!O.is.firefox()||O.is.safari())),O.cache.leftBodyScrollbar},useFlex:function(){return"auto"===c.useFlex?c.detachable:(c.useFlex&&!c.detachable&&O.debug("useFlex true in combination with detachable false is not supported"),c.useFlex)},fit:function(){var e=O.cache.contextHeight,t=O.cache.contextHeight/2,n=O.cache.topOffset,i=O.cache.scrollHeight,o=O.cache.height,s=c.padding;return o<i?t+n+i+s<e:o+2*s<e}},has:{configActions:function(){return Array.isArray(c.actions)&&0<c.actions.length},scrollbar:function(){return o||"hidden"!==m.css("overflow-y")}},is:{active:function(){return f.hasClass(d.active)},animating:function(){return f.transition("is animating")},scrolling:function(){return p.hasClass(d.scrolling)},rtl:function(){return void 0===O.cache.isRTL&&(O.cache.isRTL="rtl"===f.attr("dir")||"rtl"===f.css("direction")||"rtl"===I.attr("dir")||"rtl"===I.css("direction")||"rtl"===m.attr("dir")||"rtl"===m.css("direction")),O.cache.isRTL},safari:function(){return void 0===O.cache.isSafari&&(O.cache.isSafari=/constructor/i.test(X.HTMLElement)||!!X.ApplePaySession),O.cache.isSafari},firefox:function(){return void 0===O.cache.isFirefox&&(O.cache.isFirefox=!!X.InstallTrigger),O.cache.isFirefox},iframe:function(){return!(X.self===X.top)}},set:{observeAttributes:function(e){E=!1!==e},autofocus:function(){const e=s.filter("[autofocus]"),t=s.filter(":input"),n=(0<e.length?e:0<t.length?t:f).first();n.trigger("focus")},bodyMargin:function(){const n=O.can.leftBodyScrollbar()?"left":"right";(c.detachable||O.can.fit())&&m.css((o?"margin-":"padding-")+n,A+"px"),m.find(l.bodyFixed.replace("right",n)).each(function(){const e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+A+"px)")})},clickaway:function(){c.detachable||f.on("mousedown"+F,O.event.mousedown),v.on("mousedown"+F,O.event.mousedown),v.on("mouseup"+F,O.event.mouseup)},dimmerSettings:function(){if(void 0===V.fn.dimmer)O.error(r.dimmer);else{var e={debug:c.debug,dimmerName:"modals",closable:"auto",useFlex:O.can.useFlex(),duration:{show:c.transition.showDuration||c.duration,hide:c.transition.hideDuration||c.duration}};const t=V.extend(!0,e,c.dimmerSettings);c.inverted&&(t.variation=void 0!==t.variation?t.variation+" inverted":"inverted"),m.dimmer("setting",t)}},dimmerStyles:function(){c.inverted?v.addClass(d.inverted):v.removeClass(d.inverted),c.blurring?p.addClass(d.blurring):p.removeClass(d.blurring)},modalOffset:function(){var e;c.detachable?f.css({marginTop:!f.hasClass("aligned")&&O.can.fit()?-O.cache.height/2:c.padding/2,marginLeft:-O.cache.width/2}):(e=O.can.fit(),f.css({top:!f.hasClass("aligned")&&e?q.scrollTop()+(O.cache.contextHeight-O.cache.height)/2:!e||f.hasClass("top")?q.scrollTop()+c.padding:q.scrollTop()+(O.cache.contextHeight-O.cache.height-c.padding),marginLeft:-O.cache.width/2})),O.verbose("Setting modal offset for legacy mode")},screenHeight:function(){O.can.fit()?m.css("height",""):f.hasClass("bottom")||(O.debug("Modal is taller than page content, resizing page height"),m.css("height",O.cache.height+2*c.padding+"px"))},active:function(){f.addClass(d.active+" "+d.front),h.filter("."+d.active).removeClass(d.front)},scrolling:function(){p.addClass(d.scrolling),f.addClass(d.scrolling),O.unbind.scrollLock()},legacy:function(){f.addClass(d.legacy)},type:function(){O.can.fit()?(O.verbose("Modal fits on screen"),O.others.active()||O.others.animating()||(O.remove.scrolling(),O.bind.scrollLock())):f.hasClass("bottom")?O.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(O.verbose("Modal cannot fit on screen setting to scrolling"),O.set.scrolling())},undetached:function(){p.addClass(d.undetached)}},setting:function(e,t){if(O.debug("Changing setting",e,t),V.isPlainObject(e))V.extend(!0,c,e);else{if(void 0===t)return c[e];V.isPlainObject(c[e])?V.extend(!0,c[e],t):c[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,O,e);else{if(void 0===t)return O[e];O[e]=t}},debug:function(...e){!c.silent&&c.debug&&(c.performance?O.performance.log(e):(O.debug=Function.prototype.bind.call(console.info,console,c.name+":"),O.debug.apply(console,e)))},verbose:function(...e){!c.silent&&c.verbose&&c.debug&&(c.performance?O.performance.log(e):(O.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),O.verbose.apply(console,e)))},error:function(...e){c.silent||(O.error=Function.prototype.bind.call(console.error,console,c.name+":"),O.error.apply(console,e))},performance:{log:function(e){var t,n;c.performance&&(n=(t=Date.now())-(B||t),B=t,W.push({Name:e[0],Arguments:e.slice(1),Element:y,"Execution Time":n})),clearTimeout(O.performance.timer),O.performance.timer=setTimeout(function(){O.performance.display()},500)},display:function(){var e=c.name+":";let n=0;B=!1,clearTimeout(O.performance.timer),V.each(W,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<W.length&&(console.groupCollapsed(e),console.table(W),console.groupEnd()),W=[]}},invoke:function(i,e=K,t=y){let o=k,s,a,n;return"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]:O.error(r.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(c.templates[j])&&(c.autoShow=!0,c.className.modal=c.className.template,c=V.extend(!0,{},c,c.templates[j].apply(O,K)),d=c.className,c.namespace,u=c.fields,r=c.error),O.initialize()),Q(c.templates[j])||O.invoke(j)):(void 0!==k&&k.invoke("destroy"),O.initialize(),U=f)}),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){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(...e){const t=this.get.settings();var n=(e=t.templates.getArguments(e)).handler;return{title:e.title,content:e.content,onApprove:n,actions:[{text:t.text.ok,class:t.className.ok,click:n}]}},confirm:function(...e){const t=this.get.settings();function n(){e.handler(!0)}function i(){e.handler(!1)}return{title:(e=t.templates.getArguments(e)).title,content:e.content,onApprove:n,onDeny:i,actions:[{text:t.text.ok,class:t.className.ok,click:n},{text:t.text.cancel,class:t.className.cancel,click:i}]}},prompt:function(...t){const n=this,e=this.get.settings();t=e.templates.getArguments(t);function i(){var e=n.get.settings(),e=n.get.element().find(e.selector.prompt)[0];t.handler(V(e).val())}function o(){t.handler(null)}return 0===V(V.parseHTML(t.content)).filter(".ui.input").length&&(t.content+='<p><div class="'+this.helpers.escape(e.className.prompt)+'"><input placeholder="'+this.helpers.escape(t.placeholder||"")+'" type="text" value="'+this.helpers.escape(t.defaultValue||"")+'"></div></p>'),{title:t.title,content:t.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);
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Fomantic-UI 2.9.4 - Nag
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* https://opensource.org/licenses/MIT
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
(function ($, window, document) {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
function isFunction(obj) {
|
|
15
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window = window !== undefined && window.Math === Math
|
|
19
|
+
? window
|
|
20
|
+
: globalThis;
|
|
21
|
+
|
|
22
|
+
$.fn.nag = function (...args) {
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $body = $('body');
|
|
25
|
+
|
|
26
|
+
let time = Date.now();
|
|
27
|
+
let performance = [];
|
|
28
|
+
|
|
29
|
+
const parameters = args[0];
|
|
30
|
+
const methodInvoked = typeof parameters === 'string';
|
|
31
|
+
const queryArguments = args.slice(1);
|
|
32
|
+
const contextCheck = function (context, win) {
|
|
33
|
+
let $context;
|
|
34
|
+
if ([window, document].includes(context)) {
|
|
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;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return $context;
|
|
44
|
+
};
|
|
45
|
+
let returnedValue;
|
|
46
|
+
$allModules.each(function () {
|
|
47
|
+
const settings = $.isPlainObject(parameters)
|
|
48
|
+
? $.extend(true, {}, $.fn.nag.settings, parameters)
|
|
49
|
+
: $.extend({}, $.fn.nag.settings);
|
|
50
|
+
|
|
51
|
+
const selector = settings.selector;
|
|
52
|
+
const error = settings.error;
|
|
53
|
+
const namespace = settings.namespace;
|
|
54
|
+
|
|
55
|
+
const eventNamespace = '.' + namespace;
|
|
56
|
+
const moduleNamespace = namespace + '-module';
|
|
57
|
+
|
|
58
|
+
const $module = $(this);
|
|
59
|
+
|
|
60
|
+
const $context = settings.context ? contextCheck(settings.context, window) : $body;
|
|
61
|
+
|
|
62
|
+
const element = this;
|
|
63
|
+
const instance = $module.data(moduleNamespace);
|
|
64
|
+
let storage;
|
|
65
|
+
const module = {
|
|
66
|
+
|
|
67
|
+
initialize: function () {
|
|
68
|
+
module.verbose('Initializing element');
|
|
69
|
+
if (typeof settings.value !== 'string') {
|
|
70
|
+
settings.value = JSON.stringify(settings.value);
|
|
71
|
+
}
|
|
72
|
+
storage = module.get.storage();
|
|
73
|
+
$module
|
|
74
|
+
.on('click' + eventNamespace, selector.close, module.dismiss)
|
|
75
|
+
.data(moduleNamespace, module);
|
|
76
|
+
|
|
77
|
+
if (settings.detachable && $module.parent()[0] !== $context[0]) {
|
|
78
|
+
$module
|
|
79
|
+
.detach()
|
|
80
|
+
.prependTo($context);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (settings.displayTime > 0) {
|
|
84
|
+
setTimeout(function () {
|
|
85
|
+
module.hide();
|
|
86
|
+
}, settings.displayTime);
|
|
87
|
+
}
|
|
88
|
+
module.show();
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
destroy: function () {
|
|
92
|
+
module.verbose('Destroying instance');
|
|
93
|
+
$module
|
|
94
|
+
.removeData(moduleNamespace)
|
|
95
|
+
.off(eventNamespace);
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
show: function () {
|
|
99
|
+
if (module.should.show() && !$module.is(':visible')) {
|
|
100
|
+
if (settings.onShow.call(element) === false) {
|
|
101
|
+
module.debug('onShow callback returned false, cancelling nag animation');
|
|
102
|
+
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
module.debug('Showing nag', settings.animation.show);
|
|
106
|
+
if (settings.animation.show === 'fade') {
|
|
107
|
+
$module
|
|
108
|
+
.fadeIn(settings.duration, settings.easing, settings.onVisible);
|
|
109
|
+
} else {
|
|
110
|
+
$module
|
|
111
|
+
.slideDown(settings.duration, settings.easing, settings.onVisible);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
hide: function () {
|
|
117
|
+
if (settings.onHide.call(element) === false) {
|
|
118
|
+
module.debug('onHide callback returned false, cancelling nag animation');
|
|
119
|
+
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
module.debug('Hiding nag', settings.animation.hide);
|
|
123
|
+
if (settings.animation.hide === 'fade') {
|
|
124
|
+
$module
|
|
125
|
+
.fadeOut(settings.duration, settings.easing, settings.onHidden);
|
|
126
|
+
} else {
|
|
127
|
+
$module
|
|
128
|
+
.slideUp(settings.duration, settings.easing, settings.onHidden);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
dismiss: function (event) {
|
|
133
|
+
if (module.hide() !== false && settings.storageMethod) {
|
|
134
|
+
module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
|
|
135
|
+
module.storage.set(settings.key, settings.value);
|
|
136
|
+
}
|
|
137
|
+
if (event) {
|
|
138
|
+
event.stopImmediatePropagation();
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
should: {
|
|
144
|
+
show: function () {
|
|
145
|
+
if (settings.persist) {
|
|
146
|
+
module.debug('Persistent nag is set, can show nag');
|
|
147
|
+
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
if (module.storage.get(settings.key) != settings.value.toString()) {
|
|
151
|
+
module.debug('Stored value is not set, can show nag', module.storage.get(settings.key));
|
|
152
|
+
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
module.debug('Stored value is set, cannot show nag', module.storage.get(settings.key));
|
|
156
|
+
|
|
157
|
+
return false;
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
get: {
|
|
162
|
+
expirationDate: function (expires) {
|
|
163
|
+
if (typeof expires === 'number') {
|
|
164
|
+
expires = new Date(Date.now() + expires * 864e5);
|
|
165
|
+
}
|
|
166
|
+
if (expires instanceof Date && expires.getTime()) {
|
|
167
|
+
return expires.toUTCString();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.error(error.expiresFormat);
|
|
171
|
+
},
|
|
172
|
+
storage: function () {
|
|
173
|
+
if (settings.storageMethod === 'localstorage') {
|
|
174
|
+
module.debug('Using local storage');
|
|
175
|
+
|
|
176
|
+
return window.localStorage;
|
|
177
|
+
}
|
|
178
|
+
if (settings.storageMethod === 'sessionstorage') {
|
|
179
|
+
module.debug('Using session storage');
|
|
180
|
+
|
|
181
|
+
return window.sessionStorage;
|
|
182
|
+
}
|
|
183
|
+
module.debug('Using cookie');
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
setItem: function (key, value, options) {
|
|
187
|
+
// RFC6265 compliant encoding
|
|
188
|
+
key = encodeURIComponent(key)
|
|
189
|
+
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
190
|
+
.replace(/[()]/g, escape);
|
|
191
|
+
value = encodeURIComponent(value)
|
|
192
|
+
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent);
|
|
193
|
+
|
|
194
|
+
let cookieOptions = '';
|
|
195
|
+
for (const option in options) {
|
|
196
|
+
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
|
197
|
+
cookieOptions += '; ' + option;
|
|
198
|
+
if (typeof options[option] === 'string') {
|
|
199
|
+
cookieOptions += '=' + options[option].split(';')[0];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
document.cookie = key + '=' + value + cookieOptions;
|
|
204
|
+
},
|
|
205
|
+
getItem: function (key) {
|
|
206
|
+
const cookies = document.cookie.split('; ');
|
|
207
|
+
for (const c of cookies) {
|
|
208
|
+
const parts = c.split('=');
|
|
209
|
+
const foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent);
|
|
210
|
+
if (key === foundKey) {
|
|
211
|
+
return parts[1] || '';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
removeItem: function (key, options) {
|
|
216
|
+
storage.setItem(key, '', options);
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
storageOptions: function () {
|
|
221
|
+
const options = {};
|
|
222
|
+
if (settings.expires) {
|
|
223
|
+
options.expires = module.get.expirationDate(settings.expires);
|
|
224
|
+
}
|
|
225
|
+
if (settings.domain) {
|
|
226
|
+
options.domain = settings.domain;
|
|
227
|
+
}
|
|
228
|
+
if (settings.path) {
|
|
229
|
+
options.path = settings.path;
|
|
230
|
+
}
|
|
231
|
+
if (settings.secure) {
|
|
232
|
+
options.secure = settings.secure;
|
|
233
|
+
}
|
|
234
|
+
if (settings.samesite) {
|
|
235
|
+
options.samesite = settings.samesite;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return options;
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
clear: function () {
|
|
243
|
+
module.storage.remove(settings.key);
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
storage: {
|
|
247
|
+
set: function (key, value) {
|
|
248
|
+
const options = module.get.storageOptions();
|
|
249
|
+
if (storage === window.localStorage && options.expires) {
|
|
250
|
+
module.debug('Storing expiration value in localStorage', key, options.expires);
|
|
251
|
+
storage.setItem(key + settings.expirationKey, options.expires);
|
|
252
|
+
}
|
|
253
|
+
module.debug('Value stored', key, value);
|
|
254
|
+
try {
|
|
255
|
+
storage.setItem(key, value, options);
|
|
256
|
+
} catch (error_) {
|
|
257
|
+
module.error(error.setItem, error_);
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
get: function (key) {
|
|
261
|
+
let storedValue;
|
|
262
|
+
storedValue = storage.getItem(key);
|
|
263
|
+
if (storage === window.localStorage) {
|
|
264
|
+
const expiration = storage.getItem(key + settings.expirationKey);
|
|
265
|
+
if (expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
|
|
266
|
+
module.debug('Value in localStorage has expired. Deleting key', key);
|
|
267
|
+
module.storage.remove(key);
|
|
268
|
+
storedValue = null;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (storedValue === 'undefined' || storedValue === 'null' || storedValue === undefined || storedValue === null) {
|
|
272
|
+
storedValue = undefined;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return storedValue;
|
|
276
|
+
},
|
|
277
|
+
remove: function (key) {
|
|
278
|
+
const options = module.get.storageOptions();
|
|
279
|
+
options.expires = module.get.expirationDate(-1);
|
|
280
|
+
if (storage === window.localStorage) {
|
|
281
|
+
storage.removeItem(key + settings.expirationKey);
|
|
282
|
+
}
|
|
283
|
+
storage.removeItem(key, options);
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
setting: function (name, value) {
|
|
288
|
+
module.debug('Changing setting', name, value);
|
|
289
|
+
if ($.isPlainObject(name)) {
|
|
290
|
+
$.extend(true, settings, name);
|
|
291
|
+
} else if (value !== undefined) {
|
|
292
|
+
if ($.isPlainObject(settings[name])) {
|
|
293
|
+
$.extend(true, settings[name], value);
|
|
294
|
+
} else {
|
|
295
|
+
settings[name] = value;
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
return settings[name];
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
internal: function (name, value) {
|
|
302
|
+
if ($.isPlainObject(name)) {
|
|
303
|
+
$.extend(true, module, name);
|
|
304
|
+
} else if (value !== undefined) {
|
|
305
|
+
module[name] = value;
|
|
306
|
+
} else {
|
|
307
|
+
return module[name];
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
debug: function (...args) {
|
|
311
|
+
if (!settings.silent && settings.debug) {
|
|
312
|
+
if (settings.performance) {
|
|
313
|
+
module.performance.log(args);
|
|
314
|
+
} else {
|
|
315
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
316
|
+
module.debug.apply(console, args);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
verbose: function (...args) {
|
|
321
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
|
322
|
+
if (settings.performance) {
|
|
323
|
+
module.performance.log(args);
|
|
324
|
+
} else {
|
|
325
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
326
|
+
module.verbose.apply(console, args);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
error: function (...args) {
|
|
331
|
+
if (!settings.silent) {
|
|
332
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
333
|
+
module.error.apply(console, args);
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
performance: {
|
|
337
|
+
log: function (message) {
|
|
338
|
+
let currentTime;
|
|
339
|
+
let executionTime;
|
|
340
|
+
let previousTime;
|
|
341
|
+
if (settings.performance) {
|
|
342
|
+
currentTime = Date.now();
|
|
343
|
+
previousTime = time || currentTime;
|
|
344
|
+
executionTime = currentTime - previousTime;
|
|
345
|
+
time = currentTime;
|
|
346
|
+
performance.push({
|
|
347
|
+
Name: message[0],
|
|
348
|
+
Arguments: message.slice(1),
|
|
349
|
+
Element: element,
|
|
350
|
+
'Execution Time': executionTime,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
clearTimeout(module.performance.timer);
|
|
354
|
+
module.performance.timer = setTimeout(function () {
|
|
355
|
+
module.performance.display();
|
|
356
|
+
}, 500);
|
|
357
|
+
},
|
|
358
|
+
display: function () {
|
|
359
|
+
let title = settings.name + ':';
|
|
360
|
+
let totalTime = 0;
|
|
361
|
+
time = false;
|
|
362
|
+
clearTimeout(module.performance.timer);
|
|
363
|
+
$.each(performance, function (index, data) {
|
|
364
|
+
totalTime += data['Execution Time'];
|
|
365
|
+
});
|
|
366
|
+
title += ' ' + totalTime + 'ms';
|
|
367
|
+
if (performance.length > 0) {
|
|
368
|
+
console.groupCollapsed(title);
|
|
369
|
+
console.table(performance);
|
|
370
|
+
console.groupEnd();
|
|
371
|
+
}
|
|
372
|
+
performance = [];
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
invoke: function (query, passedArguments = queryArguments, context = element) {
|
|
376
|
+
let object = instance;
|
|
377
|
+
let maxDepth;
|
|
378
|
+
let found;
|
|
379
|
+
let response;
|
|
380
|
+
if (typeof query === 'string' && object !== undefined) {
|
|
381
|
+
query = query.split(/[ .]/);
|
|
382
|
+
maxDepth = query.length - 1;
|
|
383
|
+
$.each(query, function (depth, value) {
|
|
384
|
+
const camelCaseValue = depth !== maxDepth
|
|
385
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
386
|
+
: query;
|
|
387
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
388
|
+
object = object[camelCaseValue];
|
|
389
|
+
} else if (object[camelCaseValue] !== undefined) {
|
|
390
|
+
found = object[camelCaseValue];
|
|
391
|
+
|
|
392
|
+
return false;
|
|
393
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
|
394
|
+
object = object[value];
|
|
395
|
+
} else if (object[value] !== undefined) {
|
|
396
|
+
found = object[value];
|
|
397
|
+
|
|
398
|
+
return false;
|
|
399
|
+
} else {
|
|
400
|
+
module.error(error.method, query);
|
|
401
|
+
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
if (isFunction(found)) {
|
|
407
|
+
response = found.apply(context, passedArguments);
|
|
408
|
+
} else if (found !== undefined) {
|
|
409
|
+
response = found;
|
|
410
|
+
}
|
|
411
|
+
if (Array.isArray(returnedValue)) {
|
|
412
|
+
returnedValue.push(response);
|
|
413
|
+
} else if (returnedValue !== undefined) {
|
|
414
|
+
returnedValue = [returnedValue, response];
|
|
415
|
+
} else if (response !== undefined) {
|
|
416
|
+
returnedValue = response;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return found;
|
|
420
|
+
},
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
if (methodInvoked) {
|
|
424
|
+
if (instance === undefined) {
|
|
425
|
+
module.initialize();
|
|
426
|
+
}
|
|
427
|
+
module.invoke(parameters);
|
|
428
|
+
} else {
|
|
429
|
+
if (instance !== undefined) {
|
|
430
|
+
instance.invoke('destroy');
|
|
431
|
+
}
|
|
432
|
+
module.initialize();
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
return returnedValue !== undefined
|
|
437
|
+
? returnedValue
|
|
438
|
+
: this;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
$.fn.nag.settings = {
|
|
442
|
+
|
|
443
|
+
name: 'Nag',
|
|
444
|
+
|
|
445
|
+
silent: false,
|
|
446
|
+
debug: false,
|
|
447
|
+
verbose: false,
|
|
448
|
+
performance: true,
|
|
449
|
+
|
|
450
|
+
namespace: 'Nag',
|
|
451
|
+
|
|
452
|
+
// allows cookie to be overridden
|
|
453
|
+
persist: false,
|
|
454
|
+
|
|
455
|
+
// set to zero to require manual dismissal, otherwise hides on its own
|
|
456
|
+
displayTime: 0,
|
|
457
|
+
|
|
458
|
+
animation: {
|
|
459
|
+
show: 'slide',
|
|
460
|
+
hide: 'slide',
|
|
461
|
+
},
|
|
462
|
+
|
|
463
|
+
context: false,
|
|
464
|
+
detachable: false,
|
|
465
|
+
|
|
466
|
+
expires: 30,
|
|
467
|
+
|
|
468
|
+
// cookie storage only options
|
|
469
|
+
domain: false,
|
|
470
|
+
path: '/',
|
|
471
|
+
secure: false,
|
|
472
|
+
samesite: false,
|
|
473
|
+
|
|
474
|
+
// type of storage to use
|
|
475
|
+
storageMethod: 'cookie',
|
|
476
|
+
|
|
477
|
+
// value to store in dismissed localstorage/cookie
|
|
478
|
+
key: 'nag',
|
|
479
|
+
value: 'dismiss',
|
|
480
|
+
|
|
481
|
+
// Key suffix to support expiration in localstorage
|
|
482
|
+
expirationKey: 'ExpirationDate',
|
|
483
|
+
|
|
484
|
+
error: {
|
|
485
|
+
method: 'The method you called is not defined.',
|
|
486
|
+
setItem: 'Unexpected error while setting value',
|
|
487
|
+
expiresFormat: '"expires" must be a number of days or a Date Object',
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
className: {
|
|
491
|
+
bottom: 'bottom',
|
|
492
|
+
fixed: 'fixed',
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
selector: {
|
|
496
|
+
close: '> .close.icon',
|
|
497
|
+
},
|
|
498
|
+
|
|
499
|
+
duration: 500,
|
|
500
|
+
easing: 'easeOutQuad',
|
|
501
|
+
|
|
502
|
+
// callback before show animation, return false to prevent show
|
|
503
|
+
onShow: function () {},
|
|
504
|
+
|
|
505
|
+
// called after show animation
|
|
506
|
+
onVisible: function () {},
|
|
507
|
+
|
|
508
|
+
// callback before hide animation, return false to prevent hide
|
|
509
|
+
onHide: function () {},
|
|
510
|
+
|
|
511
|
+
// callback after hide animation
|
|
512
|
+
onHidden: function () {},
|
|
513
|
+
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
// Adds easing
|
|
517
|
+
$.extend($.easing, {
|
|
518
|
+
easeOutQuad: function (x) {
|
|
519
|
+
return 1 - (1 - x) * (1 - x);
|
|
520
|
+
},
|
|
521
|
+
});
|
|
522
|
+
})(jQuery, window, document);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* # Fomantic UI - 2.9.4
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI
|
|
4
|
+
* https://fomantic-ui.com/
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2026 Contributors
|
|
7
|
+
* Released under the MIT license
|
|
8
|
+
* https://opensource.org/licenses/MIT
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
!function(x,w,D){"use strict";w=void 0!==w&&w.Math===Math?w:globalThis,x.fn.nag=function(...e){const n=x(this),g=x("body");let p=Date.now(),m=[];const f=e[0],h="string"==typeof f,b=e.slice(1),v=function(e,n){let t;return[w,D].includes(e)?t=x(e):0===(t=x(n.document).find(e)).length&&(t=n.frameElement?v(e,n.parent):g),t};let y;return n.each(function(){const o=x.isPlainObject(f)?x.extend(!0,{},x.fn.nag.settings,f):x.extend({},x.fn.nag.settings),e=o.selector,c=o.error;var n=o.namespace;const t="."+n,i=n+"-module",a=x(this),r=o.context?v(o.context,w):g,l=this,d=a.data(i);let s;const u={initialize:function(){u.verbose("Initializing element"),"string"!=typeof o.value&&(o.value=JSON.stringify(o.value)),s=u.get.storage(),a.on("click"+t,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(t)},show:function(){if(u.should.show()&&!a.is(":visible")){if(!1===o.onShow.call(l))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(l))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(c.expiresFormat)},storage:function(){return"localstorage"===o.storageMethod?(u.debug("Using local storage"),w.localStorage):"sessionstorage"===o.storageMethod?(u.debug("Using session storage"),w.sessionStorage):(u.debug("Using cookie"),{setItem:function(e,n,t){e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g,decodeURIComponent);let o="";for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(o+="; "+i,"string"==typeof t[i]&&(o+="="+t[i].split(";")[0]));D.cookie=e+"="+n+o},getItem:function(e){for(const n of D.cookie.split("; ")){const t=n.split("=");if(e===t[0].replace(/(%[\da-f]{2})+/gi,decodeURIComponent))return t[1]||""}},removeItem:function(e,n){s.setItem(e,"",n)}})},storageOptions:function(){const 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,n){var t=u.get.storageOptions();s===w.localStorage&&t.expires&&(u.debug("Storing expiration value in localStorage",e,t.expires),s.setItem(e+o.expirationKey,t.expires)),u.debug("Value stored",e,n);try{s.setItem(e,n,t)}catch(e){u.error(c.setItem,e)}},get:function(e){let n;var t;return n=s.getItem(e),s===w.localStorage&&null!=(t=s.getItem(e+o.expirationKey))&&new Date(t)<new Date&&(u.debug("Value in localStorage has expired. Deleting key",e),u.storage.remove(e),n=null),n="undefined"!==n&&"null"!==n&&void 0!==n&&null!==n?n:void 0},remove:function(e){const n=u.get.storageOptions();n.expires=u.get.expirationDate(-1),s===w.localStorage&&s.removeItem(e+o.expirationKey),s.removeItem(e,n)}},setting:function(e,n){if(u.debug("Changing setting",e,n),x.isPlainObject(e))x.extend(!0,o,e);else{if(void 0===n)return o[e];x.isPlainObject(o[e])?x.extend(!0,o[e],n):o[e]=n}},internal:function(e,n){if(x.isPlainObject(e))x.extend(!0,u,e);else{if(void 0===n)return u[e];u[e]=n}},debug:function(...e){!o.silent&&o.debug&&(o.performance?u.performance.log(e):(u.debug=Function.prototype.bind.call(console.info,console,o.name+":"),u.debug.apply(console,e)))},verbose:function(...e){!o.silent&&o.verbose&&o.debug&&(o.performance?u.performance.log(e):(u.verbose=Function.prototype.bind.call(console.info,console,o.name+":"),u.verbose.apply(console,e)))},error:function(...e){o.silent||(u.error=Function.prototype.bind.call(console.error,console,o.name+":"),u.error.apply(console,e))},performance:{log:function(e){var n,t;o.performance&&(t=(n=Date.now())-(p||n),p=n,m.push({Name:e[0],Arguments:e.slice(1),Element:l,"Execution Time":t})),clearTimeout(u.performance.timer),u.performance.timer=setTimeout(function(){u.performance.display()},500)},display:function(){var e=o.name+":";let t=0;p=!1,clearTimeout(u.performance.timer),x.each(m,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",0<m.length&&(console.groupCollapsed(e),console.table(m),console.groupEnd()),m=[]}},invoke:function(o,e=b,n=l){let i=d,a,r,t;var s;return"string"==typeof o&&void 0!==i&&(o=o.split(/[ .]/),a=o.length-1,x.each(o,function(e,n){var t=e!==a?n+o[e+1].charAt(0).toUpperCase()+o[e+1].slice(1):o;if(x.isPlainObject(i[t])&&e!==a)i=i[t];else{if(void 0!==i[t])return r=i[t],!1;{if(!x.isPlainObject(i[n])||e===a)return void 0!==i[n]?r=i[n]:u.error(c.method,o),!1;i=i[n]}}})),"function"==typeof(s=r)&&"number"!=typeof s.nodeType?t=r.apply(n,e):void 0!==r&&(t=r),Array.isArray(y)?y.push(t):void 0!==y?y=[y,t]:void 0!==t&&(y=t),r}};h?(void 0===d&&u.initialize(),u.invoke(f)):(void 0!==d&&d.invoke("destroy"),u.initialize())}),void 0!==y?y:this},x.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:{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(){}},x.extend(x.easing,{easeOutQuad:function(e){return 1-(1-e)*(1-e)}})}(jQuery,window,document);
|