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
1.6 KiB
1 lines
1.6 KiB
!function(a,b,c,d){a.fn.starReview=function(b){var c=a.extend(!0,{},a.fn.starReview.settings,b),e=arguments||!1;return a(this).each(function(){var b,f=a(this),g=f.find(c.selector.star),h=c.className,i=c.namespace,j=f.data("module");return b={settings:c,initialize:function(){c.rateable&&(a.fn.state!==d&&(f.state(),g.state()),g.bind("mouseenter."+i,b.event.mouseenter).bind("mouseleave."+i,b.event.mouseleave).bind("click."+i,b.event.click)),f.addClass(h.initialize).data("module",b)},setRating:function(b){var d=g.eq(b-1);f.removeClass(h.hover),g.removeClass(h.hover),d.nextAll().removeClass(h.active),d.addClass(h.active).prevAll().addClass(h.active),a.proxy(c.onRate,f)()},event:{mouseenter:function(){var b=a(this);b.nextAll().removeClass(h.hover),f.addClass(h.hover),b.addClass(h.hover).prevAll().addClass(h.hover)},mouseleave:function(){g.removeClass(h.hover)},click:function(){var c=a(this);b.setRating(g.index(c)+1)}},error:function(a){console.warn(c.moduleName+": "+a)},invoke:function(e,f,g){var h;return g=g||Array.prototype.slice.call(arguments,2),"string"==typeof e&&j!==d&&(e=e.split("."),a.each(e,function(d,e){return a.isPlainObject(j[e])?(j=j[e],!0):a.isFunction(j[e])?(h=j[e],!0):(b.error(c.errors.method),!1)})),a.isFunction(h)?h.apply(f,g):!1}},j!==d&&e?("invoke"==e[0]&&(e=Array.prototype.slice.call(e,1)),b.invoke(e[0],this,Array.prototype.slice.call(e,1))):(b.initialize(),void 0)}),this},a.fn.starReview.settings={moduleName:"Star",namespace:"star",rateable:!0,onRate:function(){},className:{initialize:"initialize",loading:"loading",active:"active",hover:"hover",down:"down"},selector:{star:"i"}}}(jQuery,window,document);
|