/* * # Fomantic UI - 2.8.8 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2021 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(A,e,n,T){"use strict";A.isFunction=A.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),A.fn.rating=function(f){var v,p=A(this),b=p.selector||"",h=(new Date).getTime(),y=[],C=f,x="string"==typeof C,R=[].slice.call(arguments,1);return p.each(function(){var e,o,r=A.isPlainObject(f)?A.extend(!0,{},A.fn.rating.settings,f):A.extend({},A.fn.rating.settings),n=r.namespace,s=r.className,t=r.metadata,i=r.selector,l=r.cssVars,a="."+n,c="module-"+n,u=this,d=A(this).data(c),g=A(this),m=g.find(i.icon);o={initialize:function(){o.verbose("Initializing rating module",r),0===m.length&&o.setup.layout(),r.interactive&&!o.is.disabled()?o.enable():o.disable(),o.set.initialLoad(),o.set.rating(o.get.initialRating()),o.remove.initialLoad(),o.instantiate()},instantiate:function(){o.verbose("Instantiating module",r),d=o,g.data(c,o)},destroy:function(){o.verbose("Destroying previous instance",d),o.remove.events(),g.removeData(c)},refresh:function(){m=g.find(i.icon)},setup:{layout:function(){var e=o.get.maxRating(),n=o.get.icon(),t=A.fn.rating.settings.templates.icon(e,n);o.debug("Generating icon html dynamically"),g.html(t),o.refresh()}},event:{mouseenter:function(){var e=A(this);e.nextAll().removeClass(s.selected),g.addClass(s.selected),e.addClass(s.selected).prevAll().addClass(s.selected)},mouseleave:function(){g.removeClass(s.selected),m.removeClass(s.selected)},click:function(){var e=A(this),n=o.get.rating(),t=m.index(e)+1;("auto"==r.clearable?1===m.length:r.clearable)&&n==t?o.clearRating():o.set.rating(t)}},clearRating:function(){o.debug("Clearing current rating"),o.set.rating(0)},bind:{events:function(){o.verbose("Binding events"),g.on("mouseenter"+a,i.icon,o.event.mouseenter).on("mouseleave"+a,i.icon,o.event.mouseleave).on("click"+a,i.icon,o.event.click)}},remove:{events:function(){o.verbose("Removing events"),g.off(a)},initialLoad:function(){e=!1}},enable:function(){o.debug("Setting rating to interactive mode"),o.bind.events(),g.removeClass(s.disabled)},disable:function(){o.debug("Setting rating to read-only mode"),o.remove.events(),g.addClass(s.disabled)},is:{initialLoad:function(){return e},disabled:function(){return g.hasClass(s.disabled)}},get:{icon:function(){var e=g.data(t.icon);return e&&g.removeData(t.icon),e||r.icon},initialRating:function(){return g.data(t.rating)!==T?(g.removeData(t.rating),g.data(t.rating)):r.initialRating},maxRating:function(){return g.data(t.maxRating)!==T?(g.removeData(t.maxRating),g.data(t.maxRating)):r.maxRating},rating:function(){var e=m.filter("."+s.active).length;return o.verbose("Current rating retrieved",e),e}},set:{rating:function(e){var n=Math.floor(0<=e-1?e-1:0),t=m.eq(n),i=e<=1?t:t.next(),a=e%1*100;g.removeClass(s.selected),m.removeClass(s.selected).removeClass(s.active).removeClass(s.partiallyActive),0',t++;return i}}}}(jQuery,window,document);