!function(i){"use strict";var r={init:function(t){return this.each(function(){this.self=i(this),r.destroy.call(this.self),this.opt=i.extend(!0,{},i.fn.um_raty.defaults,t),r._adjustCallback.call(this),r._adjustNumber.call(this),"img"!==this.opt.starType&&r._adjustStarType.call(this),r._adjustPath.call(this),r._createStars.call(this),this.opt.cancel&&r._createCancel.call(this),this.opt.precision&&r._adjustPrecision.call(this),r._createScore.call(this),r._apply.call(this,this.opt.score),r._target.call(this,this.opt.score),(this.opt.readOnly?r._lock:(this.style.cursor="pointer",r._binds)).call(this),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName","target"],e=0;e",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,e=i("<"+this.opt.starType+" />",{title:this.opt.cancelHint,class:this.opt.cancelClass});"img"===this.opt.starType?e.attr({src:t,alt:"x"}):e.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(e):this.self.append(" ").append(e),this.cancel=e},_createScore:function(){var t=i(this.opt.targetScore);this.score=t.length?t:r._buildScoreField.call(this)},_createStars:function(){for(var t=1;t<=this.opt.number;t++){var e=r._nameForIndex.call(this,t),e={alt:t,src:this.opt.path+this.opt[e]};(e="img"!==this.opt.starType?{"data-alt":t,class:e.src}:e).title=r._getHint.call(this,t),i("<"+this.opt.starType+" />",e).appendTo(this),this.opt.space&&this.self.append(te?(s=this.opt.iconRange[e],i=r._getRangeIcon.call(this,s,n),a<=s.range&&r._setIcon.call(this,o,i),a===s.range&&e++):(i=this.opt[n?"starOn":"starOff"],r._setIcon.call(this,o,i))}},_getRangeIcon:function(t,e){return e?t.on||this.opt.starOn:t.off||this.opt.starOff},_getScoreByPosition:function(t,e){var a,s=parseInt(e.alt||e.getAttribute("data-alt"),10);return this.opt.half&&(a=r._getSize.call(this),t=parseFloat((t.pageX-i(e).offset().left)/a),s=this.opt.precision?s-1+t:s-1+(.5=t?"starOn":"starOff"},_roundStars:function(t){var e,a=(t%1).toFixed(2);a>this.opt.round.down&&(e="starOn",this.opt.halfShow&&a=e.number&&(t=e.number-1,a=10);e=r._getSize.call(this)/10,t=i(this.stars[t]),e=t.offset().left+e*parseInt(a,10),a=i.Event("mousemove",{pageX:e});t.trigger(a)})},readOnly:function(e){return this.each(function(){var t=i(this);t.data("readonly")!==e&&((e?(t.off(".um_raty").children("img").off(".um_raty"),r._lock):(r._binds.call(this),r._unlock)).call(this),t.data("readonly",e))})},reload:function(){return r.set.call(this,{})},score:function(){var t=i(this);return arguments.length?r.setScore.apply(t,arguments):r.getScore.call(t)},set:function(a){return this.each(function(){var t=i(this),e=t.data("options"),e=i.extend({},e,a);t.um_raty(e)})},setScore:function(t){return this.each(function(){!0!==i(this).data("readonly")&&(r._apply.call(this,t),r._target.call(this,t))})}};i.fn.um_raty=function(t){return r[t]?r[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void i.error("Method "+t+" does not exist!"):r.init.apply(this,arguments)},i.fn.um_raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:wp.i18n.__("Cancel this rating!","ultimate-member"),cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:wp.i18n.__("Not rated yet!","ultimate-member"),number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery);