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,e,A){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,V.fn.progress=function(...e){const t=V(this);let m=Date.now(),b=[];const h=e[0],x="string"==typeof h,y=e.slice(1);let w;return t.each(function(){const i=V.isPlainObject(h)?V.extend(!0,{},V.fn.progress.settings,h):V.extend({},V.fn.progress.settings),r=i.className,t=i.metadata;var e=i.namespace,n=i.selector;const l=i.error,a="."+e,o="module-"+e,u=V(this),d=V(this).find(n.bar),s=V(this).find(n.progress),c=V(this).find(n.label),p=this;let v=u.data(o),g=!1;const f={helper:{sum:function(e){return Array.isArray(e)?e.reduce(function(e,t){return e+Number(t)},0):0},derivePrecision:function(e,t){let r=0,n=1,a=e/t;for(;r<10&&!(1<(a*=n));)n=10**r++;return n},forceArray:function(e){return Array.isArray(e)?e:Number.isNaN(Number(e))?"string"==typeof e?e.split(","):[]:[e]}},initialize:function(){f.set.duration(),f.debug(p),f.read.metadata(),f.read.settings(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of progress",f),v=f,u.data(o,f)},destroy:function(){f.verbose("Destroying previous progress for",u),clearInterval(v.interval),f.remove.state(),u.removeData(o),v=void 0},reset:function(){f.remove.nextValue(),f.update.progress(0)},complete:function(e){(void 0===f.percent||f.percent<100)&&(f.remove.progressPoll(),!0!==e&&f.set.percent(100))},read:{metadata:function(){var e={percent:f.helper.forceArray(u.data(t.percent)),total:u.data(t.total),value:f.helper.forceArray(u.data(t.value))};void 0!==e.total&&(f.debug("Total value set from metadata",e.total),f.set.total(e.total)),0<e.value.length&&(f.debug("Current value set from metadata",e.value),f.set.value(e.value),f.set.progress(e.value)),0<e.percent.length&&(f.debug("Current percent value set from metadata",e.percent),f.set.percent(e.percent))},settings:function(){!1!==i.total&&(f.debug("Current total set in settings",i.total),f.set.total(i.total)),!1!==i.value&&(f.debug("Current value set in settings",i.value),f.set.value(i.value),f.set.progress(f.value)),!1!==i.percent&&(f.debug("Current percent set in settings",i.percent),f.set.percent(i.percent))}},bind:{transitionEnd:function(t){d.one("transitionend"+a,function(e){clearTimeout(f.failSafeTimer),t.call(this,e)}),f.failSafeTimer=setTimeout(function(){d.triggerHandler("transitionend")},i.duration+i.failSafeDelay),f.verbose("Adding fail safe timer",f.timer)}},increment:function(e){let t;var r;e=f.has.total()?(t=f.get.value(),e||1):(t=f.get.percent(),e||f.get.randomValue()),r=t+e,f.debug("Incrementing percentage by",t,r,e),r=f.get.normalizedValue(r),f.set.progress(r)},decrement:function(e){let t,r;f.get.total()?(t=f.get.value(),e=e||1,r=t-e,f.debug("Decrementing value by",e,t)):(t=f.get.percent(),e=e||f.get.randomValue(),r=t-e,f.debug("Decrementing percentage by",e,t)),r=f.get.normalizedValue(r),f.set.progress(r)},has:{progressPoll:function(){return f.progressPoll},total:function(){return!1!==f.get.total()}},get:{text:function(e="",t=0){var r=f.get.value(t),n=f.get.total(),a=g?f.get.displayPercent(t):f.get.percent(t),o=!1!==n?Math.max(0,n-r):100-a;return e=e.replace("{value}",r).replace("{total}",n||0).replace("{left}",o).replace("{percent}",a).replace("{bar}",i.text.bars[t]||""),f.verbose("Adding variables to progress bar text",e),e},normalizedValue:function(e){if(e<0)return f.debug("Value cannot decrement below 0"),0;if(f.has.total()){if(e>f.total)return f.debug("Value cannot increment above total",f.total),f.total}else if(100<e)return f.debug("Value cannot increment above 100 percent"),100;return e},updateInterval:function(){return"auto"===i.updateInterval?i.duration:i.updateInterval},randomValue:function(){return f.debug("Generating random increment percentage"),Math.floor(Math.random()*i.random.max+i.random.min)},numericValue:function(e){return"string"==typeof e?""!==e.replace(/[^\d.]/g,"")&&+e.replace(/[^\d.]/g,""):e},displayPercent:function(e){const t=V(d[e]);var e=t.width(),r=u.width(),e=Number.parseInt(t.css("min-width"),10)<e?e/r*100:f.percent;return 0<i.precision?Math.round(e*(10*i.precision))/(10*i.precision):Math.round(e)},percent:function(e){return f.percent&&f.percent[e||0]||0},value:function(e){return f.nextValue||f.value&&f.value[e||0]||0},total:function(){return void 0!==f.total&&f.total}},create:{progressPoll:function(){f.progressPoll=setTimeout(function(){f.update.toNextValue(),f.remove.progressPoll()},f.get.updateInterval())}},is:{complete:function(){return f.is.success()||f.is.warning()||f.is.error()},success:function(){return u.hasClass(r.success)},warning:function(){return u.hasClass(r.warning)},error:function(){return u.hasClass(r.error)},active:function(){return u.hasClass(r.active)},visible:function(){return u.is(":visible")}},remove:{progressPoll:function(){f.verbose("Removing progress poll timer"),f.progressPoll&&(clearTimeout(f.progressPoll),delete f.progressPoll)},nextValue:function(){f.verbose("Removing progress value stored for next update"),delete f.nextValue},state:function(){f.verbose("Removing stored state"),delete f.total,delete f.percent,delete f.value},active:function(){f.verbose("Removing active state"),u.removeClass(r.active)},success:function(){f.verbose("Removing success state"),u.removeClass(r.success)},warning:function(){f.verbose("Removing warning state"),u.removeClass(r.warning)},error:function(){f.verbose("Removing error state"),u.removeClass(r.error)}},set:{barWidth:function(e){f.debug("set bar width with ",e),e=f.helper.forceArray(e);let a=-1,o=-1;const i=f.helper.sum(e),s=d.length,l=1<s;var t,r,n=e.map(function(e,t){var r=t===s-1&&0===i;const n=V(d[t]);return 0===e&&l&&!r?n.css("display","none"):(l&&r&&n.css("background","transparent"),-1===a&&(a=t),o=t,n.css({display:"block",width:e+"%"})),Number.parseFloat(e)});for([t,r]of e.entries()){const c=V(d[t]);c.css({borderTopLeftRadius:t===a?"":"0",borderBottomLeftRadius:t===a?"":"0",borderTopRightRadius:t===o?"":"0",borderBottomRightRadius:t===o?"":"0"})}u.attr("data-percent",n)},duration:function(e=i.duration){e="number"==typeof e?e+"ms":e,f.verbose("Setting progress bar transition duration",e),d.css({"transition-duration":e})},percent:function(e){e=f.helper.forceArray(e).map(function(e){return e="string"==typeof e?+e.replace("%",""):e,i.limitValues?Math.max(0,Math.min(100,e)):e});var t=f.has.total(),r=f.helper.sum(e),n=1<e.length&&t,a=f.helper.sum(f.helper.forceArray(f.value));if(n&&a>f.total)f.error(l.sumExceedsTotal,a,f.total);else if(!n&&100<r)f.error(l.tooHigh,r);else if(r<0)f.error(l.tooLow,r);else{const o=0<i.precision?i.precision:n?f.helper.derivePrecision(Math.min.apply(null,f.value),f.total):0;a=e.map(function(e){return 0<o?Math.round(e*(10*o))/(10*o):Math.round(e)});f.percent=a,t&&(f.value=e.map(function(e){return 0<o?Math.round(e/100*f.total*(10*o))/(10*o):Math.round(e/100*f.total*10)/10})),f.set.barWidth(e),f.set.labelInterval()}i.onChange.call(p,e,f.value,f.total)},labelInterval:function(){clearInterval(f.interval),f.bind.transitionEnd(function(){f.verbose("Bar finished animating, removing continuous label updates"),clearInterval(f.interval),g=!1,f.set.labels()}),g=!0,f.interval=setInterval(function(){A.documentElement.contains(p)||(clearInterval(f.interval),g=!1),f.set.labels()},i.framerate)},labels:function(){f.verbose("Setting both bar progress and outer label text"),f.set.barLabel(),f.set.state()},label:function(e){e&&(e=f.get.text(e),f.verbose("Setting label to text",e),c.text(e))},state:function(e=f.helper.sum(f.percent)){100===e?i.autoSuccess&&1===d.length&&!(f.is.warning()||f.is.error()||f.is.success())?(f.set.success(),f.debug("Automatically triggering success at 100%")):(f.verbose("Reached 100% removing active state"),f.remove.active(),f.remove.progressPoll()):0<e?(f.verbose("Adjusting active progress bar label",e),f.set.active()):(f.remove.active(),f.remove.warning(),f.remove.error(),f.remove.success(),f.set.label(i.text.active))},barLabel:function(n){s.each(function(e,t){const r=V(t);void 0!==n?r.text(f.get.text(n,e)):"ratio"===i.label&&f.has.total()?(f.verbose("Adding ratio to bar label"),r.text(f.get.text(i.text.ratio,e))):"percent"===i.label&&(f.verbose("Adding percentage to bar label"),r.text(f.get.text(i.text.percent,e)))})},active:function(e=i.text.active){f.debug("Setting active state"),i.showActivity&&!f.is.active()&&u.addClass(r.active),f.remove.warning(),f.remove.error(),f.remove.success(),(e=i.onLabelUpdate("active",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onActive.call(p,f.value,f.total)})},success:function(e=i.text.success||i.text.active,t=!1){f.debug("Setting success state"),u.addClass(r.success),f.remove.active(),f.remove.warning(),f.remove.error(),f.complete(t),e=i.text.success?i.onLabelUpdate("success",e,f.value,f.total):i.onLabelUpdate("active",e,f.value,f.total),f.set.label(e),f.bind.transitionEnd(function(){i.onSuccess.call(p,f.total)})},warning:function(e=i.text.warning,t=!1){f.debug("Setting warning state"),u.addClass(r.warning),f.remove.active(),f.remove.success(),f.remove.error(),f.complete(t),(e=i.onLabelUpdate("warning",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onWarning.call(p,f.value,f.total)})},error:function(e=i.text.error,t=!1){f.debug("Setting error state"),u.addClass(r.error),f.remove.active(),f.remove.success(),f.remove.warning(),f.complete(t),(e=i.onLabelUpdate("error",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onError.call(p,f.value,f.total)})},total:function(e){f.total=e},value:function(e){f.value=f.helper.forceArray(e)},progress:function(e){f.has.progressPoll()?(f.debug("Updated within interval, setting next update to use new value",e),f.set.nextValue(e)):(f.debug("First update in progress update interval, immediately updating",e),f.update.progress(e),f.create.progressPoll())},nextValue:function(e){f.nextValue=e}},update:{toNextValue:function(){var e=f.nextValue;e&&(f.debug("Update interval complete using last updated value",e),f.update.progress(e),f.remove.nextValue())},progress:function(e){const r=f.has.total();r&&f.set.value(e);e=f.helper.forceArray(e).map(function(e){let t;return!1===(e=f.get.numericValue(e))&&f.error(l.nonNumeric,e),e=f.get.normalizedValue(e),r?(t=0<f.total?e/f.total*100:100,f.debug("Calculating percent complete from total",t)):(t=e,f.debug("Setting value to exact percentage value",t)),t});f.set.percent(e)}},setting:function(e,t){if(f.debug("Changing setting",e,t),V.isPlainObject(e))V.extend(!0,i,e);else{if(void 0===t)return i[e];V.isPlainObject(i[e])?V.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},debug:function(...e){!i.silent&&i.debug&&(i.performance?f.performance.log(e):(f.debug=Function.prototype.bind.call(console.info,console,i.name+":"),f.debug.apply(console,e)))},verbose:function(...e){!i.silent&&i.verbose&&i.debug&&(i.performance?f.performance.log(e):(f.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),f.verbose.apply(console,e)))},error:function(...e){i.silent||(f.error=Function.prototype.bind.call(console.error,console,i.name+":"),f.error.apply(console,e))},performance:{log:function(e){var t,r;i.performance&&(r=(t=Date.now())-(m||t),m=t,b.push({Name:e[0],Arguments:e.slice(1),Element:p,"Execution Time":r})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(function(){f.performance.display()},500)},display:function(){var e=i.name+":";let r=0;m=!1,clearTimeout(f.performance.timer),V.each(b,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",0<b.length&&(console.groupCollapsed(e),console.table(b),console.groupEnd()),b=[]}},invoke:function(n,e=y,t=p){let a=v,o,i,r;var s;return"string"==typeof n&&void 0!==a&&(n=n.split(/[ .]/),o=n.length-1,V.each(n,function(e,t){var r=e!==o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(V.isPlainObject(a[r])&&e!==o)a=a[r];else{if(void 0!==a[r])return i=a[r],!1;{if(!V.isPlainObject(a[t])||e===o)return void 0!==a[t]?i=a[t]:f.error(l.method,n),!1;a=a[t]}}})),"function"==typeof(s=i)&&"number"!=typeof s.nodeType?r=i.apply(t,e):void 0!==i&&(r=i),Array.isArray(w)?w.push(r):void 0!==w?w=[w,r]:void 0!==r&&(w=r),i}};x?(void 0===v&&f.initialize(),f.invoke(h)):(void 0!==v&&v.invoke("destroy"),f.initialize())}),void 0!==w?w:this},V.fn.progress.settings={name:"Progress",namespace:"progress",silent:!1,debug:!1,verbose:!1,performance:!0,random:{min:2,max:5},duration:300,updateInterval:"auto",autoSuccess:!0,showActivity:!0,limitValues:!0,label:"percent",precision:0,framerate:1e3/30,percent:!1,total:!1,value:!1,failSafeDelay:100,onLabelUpdate:function(e,t,r,n){return t},onChange:function(e,t,r){},onSuccess:function(e){},onActive:function(e,t){},onError:function(e,t){},onWarning:function(e,t){},error:{method:"The method you called is not defined.",nonNumeric:"Progress value is non numeric",tooHigh:"Value specified is above 100%",tooLow:"Value specified is below 0%",sumExceedsTotal:"Sum of multiple values exceed total"},regExp:{variable:/{\$*[\da-z]+}/gi},metadata:{percent:"percent",total:"total",value:"value"},selector:{bar:"> .bar",label:"> .label",progress:".bar > .progress"},text:{active:!1,error:!1,success:!1,warning:!1,percent:"{percent}%",ratio:"{value} of {total}",bars:[""]},className:{active:"active",error:"error",success:"success",warning:"warning"}}}(jQuery,window,document);
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Fomantic-UI 2.9.4 - Rating
|
|
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.rating = function (...args) {
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
|
|
25
|
+
let time = Date.now();
|
|
26
|
+
let performance = [];
|
|
27
|
+
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
|
+
let returnedValue;
|
|
32
|
+
$allModules.each(function () {
|
|
33
|
+
const settings = $.isPlainObject(parameters)
|
|
34
|
+
? $.extend(true, {}, $.fn.rating.settings, parameters)
|
|
35
|
+
: $.extend({}, $.fn.rating.settings);
|
|
36
|
+
|
|
37
|
+
const namespace = settings.namespace;
|
|
38
|
+
const className = settings.className;
|
|
39
|
+
const error = settings.error;
|
|
40
|
+
const metadata = settings.metadata;
|
|
41
|
+
const selector = settings.selector;
|
|
42
|
+
const cssVars = settings.cssVars;
|
|
43
|
+
|
|
44
|
+
const eventNamespace = '.' + namespace;
|
|
45
|
+
const moduleNamespace = 'module-' + namespace;
|
|
46
|
+
|
|
47
|
+
const element = this;
|
|
48
|
+
let instance = $(this).data(moduleNamespace);
|
|
49
|
+
|
|
50
|
+
const $module = $(this);
|
|
51
|
+
let $icon = $module.find(selector.icon);
|
|
52
|
+
|
|
53
|
+
let initialLoad;
|
|
54
|
+
|
|
55
|
+
const module = {
|
|
56
|
+
|
|
57
|
+
initialize: function () {
|
|
58
|
+
module.verbose('Initializing rating module', settings);
|
|
59
|
+
|
|
60
|
+
if ($icon.length === 0) {
|
|
61
|
+
module.setup.layout();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (settings.interactive && !module.is.disabled()) {
|
|
65
|
+
module.enable();
|
|
66
|
+
} else {
|
|
67
|
+
module.disable();
|
|
68
|
+
}
|
|
69
|
+
module.set.initialLoad();
|
|
70
|
+
module.set.rating(module.get.initialRating());
|
|
71
|
+
module.remove.initialLoad();
|
|
72
|
+
module.instantiate();
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
instantiate: function () {
|
|
76
|
+
module.verbose('Instantiating module', settings);
|
|
77
|
+
instance = module;
|
|
78
|
+
$module
|
|
79
|
+
.data(moduleNamespace, module);
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
destroy: function () {
|
|
83
|
+
module.verbose('Destroying previous instance', instance);
|
|
84
|
+
module.remove.events();
|
|
85
|
+
$module
|
|
86
|
+
.removeData(moduleNamespace);
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
refresh: function () {
|
|
90
|
+
$icon = $module.find(selector.icon);
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
setup: {
|
|
94
|
+
layout: function () {
|
|
95
|
+
const maxRating = module.get.maxRating();
|
|
96
|
+
const icon = module.get.icon();
|
|
97
|
+
const html = $.fn.rating.settings.templates.icon(maxRating, icon);
|
|
98
|
+
module.debug('Generating icon html dynamically');
|
|
99
|
+
$module
|
|
100
|
+
.html(html);
|
|
101
|
+
module.refresh();
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
event: {
|
|
106
|
+
mouseenter: function () {
|
|
107
|
+
const $activeIcon = $(this);
|
|
108
|
+
$activeIcon
|
|
109
|
+
.nextAll()
|
|
110
|
+
.removeClass(className.selected);
|
|
111
|
+
$module
|
|
112
|
+
.addClass(className.selected);
|
|
113
|
+
$activeIcon
|
|
114
|
+
.addClass(className.selected)
|
|
115
|
+
.prevAll()
|
|
116
|
+
.addClass(className.selected);
|
|
117
|
+
},
|
|
118
|
+
mouseleave: function () {
|
|
119
|
+
$module
|
|
120
|
+
.removeClass(className.selected);
|
|
121
|
+
$icon
|
|
122
|
+
.removeClass(className.selected);
|
|
123
|
+
},
|
|
124
|
+
click: function () {
|
|
125
|
+
const $activeIcon = $(this);
|
|
126
|
+
const currentRating = module.get.rating();
|
|
127
|
+
const rating = $icon.index($activeIcon) + 1;
|
|
128
|
+
const canClear = settings.clearable === 'auto'
|
|
129
|
+
? $icon.length === 1
|
|
130
|
+
: settings.clearable;
|
|
131
|
+
if (canClear && currentRating === rating) {
|
|
132
|
+
module.clearRating();
|
|
133
|
+
} else {
|
|
134
|
+
module.set.rating(rating);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
clearRating: function () {
|
|
140
|
+
module.debug('Clearing current rating');
|
|
141
|
+
module.set.rating(0);
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
bind: {
|
|
145
|
+
events: function () {
|
|
146
|
+
module.verbose('Binding events');
|
|
147
|
+
$module
|
|
148
|
+
.on('mouseenter' + eventNamespace, selector.icon, module.event.mouseenter)
|
|
149
|
+
.on('mouseleave' + eventNamespace, selector.icon, module.event.mouseleave)
|
|
150
|
+
.on('click' + eventNamespace, selector.icon, module.event.click);
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
remove: {
|
|
155
|
+
events: function () {
|
|
156
|
+
module.verbose('Removing events');
|
|
157
|
+
$module
|
|
158
|
+
.off(eventNamespace);
|
|
159
|
+
},
|
|
160
|
+
initialLoad: function () {
|
|
161
|
+
initialLoad = false;
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
enable: function () {
|
|
166
|
+
module.debug('Setting rating to interactive mode');
|
|
167
|
+
module.bind.events();
|
|
168
|
+
$module
|
|
169
|
+
.removeClass(className.disabled);
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
disable: function () {
|
|
173
|
+
module.debug('Setting rating to read-only mode');
|
|
174
|
+
module.remove.events();
|
|
175
|
+
$module
|
|
176
|
+
.addClass(className.disabled);
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
is: {
|
|
180
|
+
initialLoad: function () {
|
|
181
|
+
return initialLoad;
|
|
182
|
+
},
|
|
183
|
+
disabled: function () {
|
|
184
|
+
return $module.hasClass(className.disabled);
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
get: {
|
|
189
|
+
icon: function () {
|
|
190
|
+
const icon = $module.data(metadata.icon);
|
|
191
|
+
if (icon) {
|
|
192
|
+
$module.removeData(metadata.icon);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return icon || settings.icon;
|
|
196
|
+
},
|
|
197
|
+
initialRating: function () {
|
|
198
|
+
if ($module.data(metadata.rating) !== undefined) {
|
|
199
|
+
$module.removeData(metadata.rating);
|
|
200
|
+
|
|
201
|
+
return $module.data(metadata.rating);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return settings.initialRating;
|
|
205
|
+
},
|
|
206
|
+
maxRating: function () {
|
|
207
|
+
if ($module.data(metadata.maxRating) !== undefined) {
|
|
208
|
+
$module.removeData(metadata.maxRating);
|
|
209
|
+
|
|
210
|
+
return $module.data(metadata.maxRating);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return settings.maxRating;
|
|
214
|
+
},
|
|
215
|
+
rating: function () {
|
|
216
|
+
const currentRating = $icon.filter('.' + className.active).length;
|
|
217
|
+
module.verbose('Current rating retrieved', currentRating);
|
|
218
|
+
|
|
219
|
+
return currentRating;
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
set: {
|
|
224
|
+
rating: function (rating) {
|
|
225
|
+
const ratingIndex = Math.floor(
|
|
226
|
+
Math.max(rating - 1, 0)
|
|
227
|
+
);
|
|
228
|
+
const $activeIcon = $icon.eq(ratingIndex);
|
|
229
|
+
const $partialActiveIcon = rating <= 1
|
|
230
|
+
? $activeIcon
|
|
231
|
+
: $activeIcon.next();
|
|
232
|
+
const filledPercentage = (rating % 1) * 100;
|
|
233
|
+
$module
|
|
234
|
+
.removeClass(className.selected);
|
|
235
|
+
$icon
|
|
236
|
+
.removeClass(className.selected)
|
|
237
|
+
.removeClass(className.active)
|
|
238
|
+
.removeClass(className.partiallyActive);
|
|
239
|
+
if (rating > 0) {
|
|
240
|
+
module.verbose('Setting current rating to', rating);
|
|
241
|
+
$activeIcon
|
|
242
|
+
.prevAll()
|
|
243
|
+
.addBack()
|
|
244
|
+
.addClass(className.active);
|
|
245
|
+
if ($activeIcon.next() && rating % 1 !== 0) {
|
|
246
|
+
$partialActiveIcon
|
|
247
|
+
.addClass(className.partiallyActive)
|
|
248
|
+
.addClass(className.active);
|
|
249
|
+
$partialActiveIcon
|
|
250
|
+
.css(cssVars.filledCustomPropName, filledPercentage + '%');
|
|
251
|
+
if ($partialActiveIcon.css('backgroundColor') === 'transparent') {
|
|
252
|
+
$partialActiveIcon
|
|
253
|
+
.removeClass(className.partiallyActive)
|
|
254
|
+
.removeClass(className.active);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (!module.is.initialLoad()) {
|
|
259
|
+
settings.onRate.call(element, rating);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
initialLoad: function () {
|
|
263
|
+
initialLoad = true;
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
setting: function (name, value) {
|
|
268
|
+
module.debug('Changing setting', name, value);
|
|
269
|
+
if ($.isPlainObject(name)) {
|
|
270
|
+
$.extend(true, settings, name);
|
|
271
|
+
} else if (value !== undefined) {
|
|
272
|
+
if ($.isPlainObject(settings[name])) {
|
|
273
|
+
$.extend(true, settings[name], value);
|
|
274
|
+
} else {
|
|
275
|
+
settings[name] = value;
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
return settings[name];
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
internal: function (name, value) {
|
|
282
|
+
if ($.isPlainObject(name)) {
|
|
283
|
+
$.extend(true, module, name);
|
|
284
|
+
} else if (value !== undefined) {
|
|
285
|
+
module[name] = value;
|
|
286
|
+
} else {
|
|
287
|
+
return module[name];
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
debug: function (...args) {
|
|
291
|
+
if (!settings.silent && settings.debug) {
|
|
292
|
+
if (settings.performance) {
|
|
293
|
+
module.performance.log(args);
|
|
294
|
+
} else {
|
|
295
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
296
|
+
module.debug.apply(console, args);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
verbose: function (...args) {
|
|
301
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
|
302
|
+
if (settings.performance) {
|
|
303
|
+
module.performance.log(args);
|
|
304
|
+
} else {
|
|
305
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
306
|
+
module.verbose.apply(console, args);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
error: function (...args) {
|
|
311
|
+
if (!settings.silent) {
|
|
312
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
313
|
+
module.error.apply(console, args);
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
performance: {
|
|
317
|
+
log: function (message) {
|
|
318
|
+
let currentTime;
|
|
319
|
+
let executionTime;
|
|
320
|
+
let previousTime;
|
|
321
|
+
if (settings.performance) {
|
|
322
|
+
currentTime = Date.now();
|
|
323
|
+
previousTime = time || currentTime;
|
|
324
|
+
executionTime = currentTime - previousTime;
|
|
325
|
+
time = currentTime;
|
|
326
|
+
performance.push({
|
|
327
|
+
Name: message[0],
|
|
328
|
+
Arguments: message.slice(1),
|
|
329
|
+
Element: element,
|
|
330
|
+
'Execution Time': executionTime,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
clearTimeout(module.performance.timer);
|
|
334
|
+
module.performance.timer = setTimeout(function () {
|
|
335
|
+
module.performance.display();
|
|
336
|
+
}, 500);
|
|
337
|
+
},
|
|
338
|
+
display: function () {
|
|
339
|
+
let title = settings.name + ':';
|
|
340
|
+
let totalTime = 0;
|
|
341
|
+
time = false;
|
|
342
|
+
clearTimeout(module.performance.timer);
|
|
343
|
+
$.each(performance, function (index, data) {
|
|
344
|
+
totalTime += data['Execution Time'];
|
|
345
|
+
});
|
|
346
|
+
title += ' ' + totalTime + 'ms';
|
|
347
|
+
if ($allModules.length > 1) {
|
|
348
|
+
title += ' (' + $allModules.length + ')';
|
|
349
|
+
}
|
|
350
|
+
if (performance.length > 0) {
|
|
351
|
+
console.groupCollapsed(title);
|
|
352
|
+
console.table(performance);
|
|
353
|
+
console.groupEnd();
|
|
354
|
+
}
|
|
355
|
+
performance = [];
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
invoke: function (query, passedArguments = queryArguments, context = element) {
|
|
359
|
+
let object = instance;
|
|
360
|
+
let maxDepth;
|
|
361
|
+
let found;
|
|
362
|
+
let response;
|
|
363
|
+
if (typeof query === 'string' && object !== undefined) {
|
|
364
|
+
query = query.split(/[ .]/);
|
|
365
|
+
maxDepth = query.length - 1;
|
|
366
|
+
$.each(query, function (depth, value) {
|
|
367
|
+
const camelCaseValue = depth !== maxDepth
|
|
368
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
369
|
+
: query;
|
|
370
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
371
|
+
object = object[camelCaseValue];
|
|
372
|
+
} else if (object[camelCaseValue] !== undefined) {
|
|
373
|
+
found = object[camelCaseValue];
|
|
374
|
+
|
|
375
|
+
return false;
|
|
376
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
|
377
|
+
object = object[value];
|
|
378
|
+
} else if (object[value] !== undefined) {
|
|
379
|
+
found = object[value];
|
|
380
|
+
|
|
381
|
+
return false;
|
|
382
|
+
} else {
|
|
383
|
+
module.error(error.method, query);
|
|
384
|
+
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
if (isFunction(found)) {
|
|
390
|
+
response = found.apply(context, passedArguments);
|
|
391
|
+
} else if (found !== undefined) {
|
|
392
|
+
response = found;
|
|
393
|
+
}
|
|
394
|
+
if (Array.isArray(returnedValue)) {
|
|
395
|
+
returnedValue.push(response);
|
|
396
|
+
} else if (returnedValue !== undefined) {
|
|
397
|
+
returnedValue = [returnedValue, response];
|
|
398
|
+
} else if (response !== undefined) {
|
|
399
|
+
returnedValue = response;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return found;
|
|
403
|
+
},
|
|
404
|
+
};
|
|
405
|
+
if (methodInvoked) {
|
|
406
|
+
if (instance === undefined) {
|
|
407
|
+
module.initialize();
|
|
408
|
+
}
|
|
409
|
+
module.invoke(parameters);
|
|
410
|
+
} else {
|
|
411
|
+
if (instance !== undefined) {
|
|
412
|
+
instance.invoke('destroy');
|
|
413
|
+
}
|
|
414
|
+
module.initialize();
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
return returnedValue !== undefined
|
|
419
|
+
? returnedValue
|
|
420
|
+
: this;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
$.fn.rating.settings = {
|
|
424
|
+
|
|
425
|
+
name: 'Rating',
|
|
426
|
+
namespace: 'rating',
|
|
427
|
+
|
|
428
|
+
icon: 'star',
|
|
429
|
+
|
|
430
|
+
silent: false,
|
|
431
|
+
debug: false,
|
|
432
|
+
verbose: false,
|
|
433
|
+
performance: true,
|
|
434
|
+
|
|
435
|
+
initialRating: 0,
|
|
436
|
+
interactive: true,
|
|
437
|
+
maxRating: 4,
|
|
438
|
+
clearable: 'auto',
|
|
439
|
+
|
|
440
|
+
fireOnInit: false,
|
|
441
|
+
|
|
442
|
+
onRate: function (rating) {},
|
|
443
|
+
|
|
444
|
+
error: {
|
|
445
|
+
method: 'The method you called is not defined',
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
metadata: {
|
|
449
|
+
rating: 'rating',
|
|
450
|
+
maxRating: 'maxRating',
|
|
451
|
+
icon: 'icon',
|
|
452
|
+
},
|
|
453
|
+
|
|
454
|
+
className: {
|
|
455
|
+
active: 'active',
|
|
456
|
+
disabled: 'disabled',
|
|
457
|
+
selected: 'selected',
|
|
458
|
+
loading: 'loading',
|
|
459
|
+
partiallyActive: 'partial',
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
cssVars: {
|
|
463
|
+
filledCustomPropName: '--full',
|
|
464
|
+
},
|
|
465
|
+
|
|
466
|
+
selector: {
|
|
467
|
+
icon: '.icon',
|
|
468
|
+
},
|
|
469
|
+
|
|
470
|
+
templates: {
|
|
471
|
+
escape: function (string) {
|
|
472
|
+
const escapeMap = {
|
|
473
|
+
'"': '"',
|
|
474
|
+
'&': '&',
|
|
475
|
+
"'": ''',
|
|
476
|
+
'<': '<',
|
|
477
|
+
'>': '>',
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
|
481
|
+
},
|
|
482
|
+
icon: function (maxRating, iconClass) {
|
|
483
|
+
let icon = 1;
|
|
484
|
+
let html = '';
|
|
485
|
+
const escape = $.fn.rating.settings.templates.escape;
|
|
486
|
+
while (icon <= maxRating) {
|
|
487
|
+
html += '<i class="' + escape(iconClass) + ' icon"></i>';
|
|
488
|
+
icon++;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return html;
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
};
|
|
496
|
+
})(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(R,e){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,R.fn.rating=function(...e){const f=R(this);let p=Date.now(),b=[];const h=e[0],y="string"==typeof h,C=e.slice(1);let x;return f.each(function(){const a=R.isPlainObject(h)?R.extend(!0,{},R.fn.rating.settings,h):R.extend({},R.fn.rating.settings);var e=a.namespace;const o=a.className,l=a.error,t=a.metadata,n=a.selector,r=a.cssVars,i="."+e,s="module-"+e,c=this;let d=R(this).data(s);const u=R(this);let g=u.find(n.icon),m;const v={initialize:function(){v.verbose("Initializing rating module",a),0===g.length&&v.setup.layout(),a.interactive&&!v.is.disabled()?v.enable():v.disable(),v.set.initialLoad(),v.set.rating(v.get.initialRating()),v.remove.initialLoad(),v.instantiate()},instantiate:function(){v.verbose("Instantiating module",a),d=v,u.data(s,v)},destroy:function(){v.verbose("Destroying previous instance",d),v.remove.events(),u.removeData(s)},refresh:function(){g=u.find(n.icon)},setup:{layout:function(){var e=v.get.maxRating(),t=v.get.icon(),e=R.fn.rating.settings.templates.icon(e,t);v.debug("Generating icon html dynamically"),u.html(e),v.refresh()}},event:{mouseenter:function(){const e=R(this);e.nextAll().removeClass(o.selected),u.addClass(o.selected),e.addClass(o.selected).prevAll().addClass(o.selected)},mouseleave:function(){u.removeClass(o.selected),g.removeClass(o.selected)},click:function(){var e=R(this),t=v.get.rating(),e=g.index(e)+1;("auto"===a.clearable?1===g.length:a.clearable)&&t===e?v.clearRating():v.set.rating(e)}},clearRating:function(){v.debug("Clearing current rating"),v.set.rating(0)},bind:{events:function(){v.verbose("Binding events"),u.on("mouseenter"+i,n.icon,v.event.mouseenter).on("mouseleave"+i,n.icon,v.event.mouseleave).on("click"+i,n.icon,v.event.click)}},remove:{events:function(){v.verbose("Removing events"),u.off(i)},initialLoad:function(){m=!1}},enable:function(){v.debug("Setting rating to interactive mode"),v.bind.events(),u.removeClass(o.disabled)},disable:function(){v.debug("Setting rating to read-only mode"),v.remove.events(),u.addClass(o.disabled)},is:{initialLoad:function(){return m},disabled:function(){return u.hasClass(o.disabled)}},get:{icon:function(){var e=u.data(t.icon);return e&&u.removeData(t.icon),e||a.icon},initialRating:function(){return void 0!==u.data(t.rating)?(u.removeData(t.rating),u.data(t.rating)):a.initialRating},maxRating:function(){return void 0!==u.data(t.maxRating)?(u.removeData(t.maxRating),u.data(t.maxRating)):a.maxRating},rating:function(){var e=g.filter("."+o.active).length;return v.verbose("Current rating retrieved",e),e}},set:{rating:function(e){var t=Math.floor(Math.max(e-1,0));const n=g.eq(t),i=e<=1?n:n.next();t=e%1*100;u.removeClass(o.selected),g.removeClass(o.selected).removeClass(o.active).removeClass(o.partiallyActive),0<e&&(v.verbose("Setting current rating to",e),n.prevAll().addBack().addClass(o.active),n.next()&&e%1!=0&&(i.addClass(o.partiallyActive).addClass(o.active),i.css(r.filledCustomPropName,t+"%"),"transparent"===i.css("backgroundColor")&&i.removeClass(o.partiallyActive).removeClass(o.active))),v.is.initialLoad()||a.onRate.call(c,e)},initialLoad:function(){m=!0}},setting:function(e,t){if(v.debug("Changing setting",e,t),R.isPlainObject(e))R.extend(!0,a,e);else{if(void 0===t)return a[e];R.isPlainObject(a[e])?R.extend(!0,a[e],t):a[e]=t}},internal:function(e,t){if(R.isPlainObject(e))R.extend(!0,v,e);else{if(void 0===t)return v[e];v[e]=t}},debug:function(...e){!a.silent&&a.debug&&(a.performance?v.performance.log(e):(v.debug=Function.prototype.bind.call(console.info,console,a.name+":"),v.debug.apply(console,e)))},verbose:function(...e){!a.silent&&a.verbose&&a.debug&&(a.performance?v.performance.log(e):(v.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),v.verbose.apply(console,e)))},error:function(...e){a.silent||(v.error=Function.prototype.bind.call(console.error,console,a.name+":"),v.error.apply(console,e))},performance:{log:function(e){var t,n;a.performance&&(n=(t=Date.now())-(p||t),p=t,b.push({Name:e[0],Arguments:e.slice(1),Element:c,"Execution Time":n})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(function(){v.performance.display()},500)},display:function(){let e=a.name+":",n=0;p=!1,clearTimeout(v.performance.timer),R.each(b,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",1<f.length&&(e+=" ("+f.length+")"),0<b.length&&(console.groupCollapsed(e),console.table(b),console.groupEnd()),b=[]}},invoke:function(i,e=C,t=c){let a=d,o,r,n;var s;return"string"==typeof i&&void 0!==a&&(i=i.split(/[ .]/),o=i.length-1,R.each(i,function(e,t){var n=e!==o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(R.isPlainObject(a[n])&&e!==o)a=a[n];else{if(void 0!==a[n])return r=a[n],!1;{if(!R.isPlainObject(a[t])||e===o)return void 0!==a[t]?r=a[t]:v.error(l.method,i),!1;a=a[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}};y?(void 0===d&&v.initialize(),v.invoke(h)):(void 0!==d&&d.invoke("destroy"),v.initialize())}),void 0!==x?x:this},R.fn.rating.settings={name:"Rating",namespace:"rating",icon:"star",silent:!1,debug:!1,verbose:!1,performance:!0,initialRating:0,interactive:!0,maxRating:4,clearable:"auto",fireOnInit:!1,onRate:function(e){},error:{method:"The method you called is not defined"},metadata:{rating:"rating",maxRating:"maxRating",icon:"icon"},className:{active:"active",disabled:"disabled",selected:"selected",loading:"loading",partiallyActive:"partial"},cssVars:{filledCustomPropName:"--full"},selector:{icon:".icon"},templates:{escape:function(e){const t={'"':""","&":"&","'":"'","<":"<",">":">"};return String(e).replace(/["&'<>]/g,e=>t[e])},icon:function(e,t){let n=1,i="";const a=R.fn.rating.settings.templates.escape;for(;n<=e;)i+='<i class="'+a(t)+' icon"></i>',n++;return i}}}}(jQuery,window,document);
|