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.
1 lines
3.0 KiB
1 lines
3.0 KiB
!function(a,b,c,d){a.fn.starReview=function(b){var c,e=a(this),f=e.selector||"",g=a.extend(!0,{},a.fn.starReview.settings,b),h=g.namespace,i=g.className,j=g.selector,k=g.error,l="."+h,m="module-"+h,n=(new Date).getTime(),o=[],p=arguments[0],q="string"==typeof p,r=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),h=e.find(j.star),s=this,t=e.data(m);b={initialize:function(){g.rateable&&(a.fn.state!==d&&(e.state(),h.state()),h.bind("mouseenter"+l,b.event.mouseenter).bind("mouseleave"+l,b.event.mouseleave).bind("click"+l,b.event.click)),e.addClass(i.initialize),b.instantiate()},instantiate:function(){e.data(m,b)},setRating:function(b){var c=h.eq(b-1);e.removeClass(i.hover),h.removeClass(i.hover),c.nextAll().removeClass(i.active),c.addClass(i.active).prevAll().addClass(i.active),a.proxy(g.onRate,e)()},event:{mouseenter:function(){var b=a(this);b.nextAll().removeClass(i.hover),e.addClass(i.hover),b.addClass(i.hover).prevAll().addClass(i.hover)},mouseleave:function(){h.removeClass(i.hover)},click:function(){var c=a(this);b.setRating(h.index(c)+1)}},setting:function(b,c){return c===d?g[b]:(a.isPlainObject(b)?a.extend(!0,g,b):g[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){g.debug&&(g.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,g.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;g.performance&&(c=(new Date).getTime(),e=n||c,d=c-e,n=c,o.push({Element:s,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=g.moduleName+":",e=0;n=!1,clearTimeout(b.performance.timer),a.each(o,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",f&&(c+=" '"+f+"'"),(console.group!==d||console.table!==d)&&o.length>0&&(console.groupCollapsed(c),console.table?console.table(o):a.each(o,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),o=[]}},invoke:function(c,e,f){var g,h,i=t;return e=e||r,f=s||f,"string"==typeof c&&i!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(i[e])&&c!=g?(i=i[e],!0):i[e]!==d?(h=i[e],!0):(b.error(k.method),!1)})),a.isFunction(h)?h.apply(f,e):h||!1}},q?(t===d&&b.initialize(),c=b.invoke(p)):(t!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.starReview.settings={moduleName:"Star",namespace:"star",rateable:!0,onRate:function(){},error:{method:"The method you called is not defined"},className:{initialize:"initialize",loading:"loading",active:"active",hover:"hover",down:"down"},selector:{star:"i"}}}(jQuery,window,document);
|