You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/3rdParty/Semantic-UI-CSS-master/components/rating.min.js

1 line
5.2 KiB

!function(C,e,n,T){"use strict";e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),C.fn.rating=function(m){var f,v=C(this),p=v.selector||"",b=(new Date).getTime(),h=[],y=m,x="string"==typeof y,R=[].slice.call(arguments,1);return v.each(function(){var e,i,a=C.isPlainObject(m)?C.extend(!0,{},C.fn.rating.settings,m):C.extend({},C.fn.rating.settings),n=a.namespace,o=a.className,t=a.metadata,r=a.selector,s=(a.error,"."+n),l="module-"+n,c=this,u=C(this).data(l),d=C(this),g=d.find(r.icon);i={initialize:function(){i.verbose("Initializing rating module",a),0===g.length&&i.setup.layout(),a.interactive?i.enable():i.disable(),i.set.initialLoad(),i.set.rating(i.get.initialRating()),i.remove.initialLoad(),i.instantiate()},instantiate:function(){i.verbose("Instantiating module",a),u=i,d.data(l,i)},destroy:function(){i.verbose("Destroying previous instance",u),i.remove.events(),d.removeData(l)},refresh:function(){g=d.find(r.icon)},setup:{layout:function(){var e=i.get.maxRating(),n=C.fn.rating.settings.templates.icon(e);i.debug("Generating icon html dynamically"),d.html(n),i.refresh()}},event:{mouseenter:function(){var e=C(this);e.nextAll().removeClass(o.selected),d.addClass(o.selected),e.addClass(o.selected).prevAll().addClass(o.selected)},mouseleave:function(){d.removeClass(o.selected),g.removeClass(o.selected)},click:function(){var e=C(this),n=i.get.rating(),t=g.index(e)+1;("auto"==a.clearable?1===g.length:a.clearable)&&n==t?i.clearRating():i.set.rating(t)}},clearRating:function(){i.debug("Clearing current rating"),i.set.rating(0)},bind:{events:function(){i.verbose("Binding events"),d.on("mouseenter"+s,r.icon,i.event.mouseenter).on("mouseleave"+s,r.icon,i.event.mouseleave).on("click"+s,r.icon,i.event.click)}},remove:{events:function(){i.verbose("Removing events"),d.off(s)},initialLoad:function(){e=!1}},enable:function(){i.debug("Setting rating to interactive mode"),i.bind.events(),d.removeClass(o.disabled)},disable:function(){i.debug("Setting rating to read-only mode"),i.remove.events(),d.addClass(o.disabled)},is:{initialLoad:function(){return e}},get:{initialRating:function(){return d.data(t.rating)!==T?(d.removeData(t.rating),d.data(t.rating)):a.initialRating},maxRating:function(){return d.data(t.maxRating)!==T?(d.removeData(t.maxRating),d.data(t.maxRating)):a.maxRating},rating:function(){var e=g.filter("."+o.active).length;return i.verbose("Current rating retrieved",e),e}},set:{rating:function(e){var n=0<=e-1?e-1:0,t=g.eq(n);d.removeClass(o.selected),g.removeClass(o.selected).removeClass(o.active),0<e&&(i.verbose("Setting current rating to",e),t.prevAll().addBack().addClass(o.active)),i.is.initialLoad()||a.onRate.call(c,e)},initialLoad:function(){e=!0}},setting:function(e,n){if(i.debug("Changing setting",e,n),C.isPlainObject(e))C.extend(!0,a,e);else{if(n===T)return a[e];C.isPlainObject(a[e])?C.extend(!0,a[e],n):a[e]=n}},internal:function(e,n){if(C.isPlainObject(e))C.extend(!0,i,e);else{if(n===T)return i[e];i[e]=n}},debug:function(){!a.silent&&a.debug&&(a.performance?i.performance.log(arguments):(i.debug=Function.prototype.bind.call(console.info,console,a.name+":"),i.debug.apply(console,arguments)))},verbose:function(){!a.silent&&a.verbose&&a.debug&&(a.performance?i.performance.log(arguments):(i.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),i.verbose.apply(console,arguments)))},error:function(){a.silent||(i.error=Function.prototype.bind.call(console.error,console,a.name+":"),i.error.apply(console,arguments))},performance:{log:function(e){var n,t;a.performance&&(t=(n=(new Date).getTime())-(b||n),b=n,h.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:c,"Execution Time":t})),clearTimeout(i.performance.timer),i.performance.timer=setTimeout(i.performance.display,500)},display:function(){var e=a.name+":",t=0;b=!1,clearTimeout(i.performance.timer),C.each(h,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",p&&(e+=" '"+p+"'"),1<v.length&&(e+=" ("+v.length+")"),(console.group!==T||console.table!==T)&&0<h.length&&(console.groupCollapsed(e),console.table?console.table(h):C.each(h,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),h=[]}},invoke:function(i,e,n){var a,o,t,r=u;return e=e||R,n=c||n,"string"==typeof i&&r!==T&&(i=i.split(/[\. ]/),a=i.length-1,C.each(i,function(e,n){var t=e!=a?n+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(C.isPlainObject(r[t])&&e!=a)r=r[t];else{if(r[t]!==T)return o=r[t],!1;if(!C.isPlainObject(r[n])||e==a)return r[n]!==T&&(o=r[n]),!1;r=r[n]}})),C.isFunction(o)?t=o.apply(n,e):o!==T&&(t=o),C.isArray(f)?f.push(t):f!==T?f=[f,t]:t!==T&&(f=t),o}},x?(u===T&&i.initialize(),i.invoke(y)):(u!==T&&u.invoke("destroy"),i.initialize())}),f!==T?f:this},C.fn.rating.settings={name:"Rating",namespace:"rating",slent:!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",noMaximum:"No maximum rating specified. Cannot generate HTML automatically"},metadata:{rating:"rating",maxRating:"maxRating"},className:{active:"active",disabled:"disabled",selected:"selected",loading:"loading"},selector:{icon:".icon"},templates:{icon:function(e){for(var n=1,t="";n<=e;)t+='<i class="icon"></i>',n++;return t}}}}(jQuery,window,document);