!function(e,t,n,s){e.fn.dfstarratings=function(t){e.fn.dfstarratings.options=e.extend({ajaxurl:null,nonce:null,func:null,grs:!1,msg:"امتیاز دهید!",fuelspeed:400,thankyou:"متشکریم",error_msg:"مشکلی پیش آمد",tooltip:!1,tooltips:{0:{tip:"ضعیف",color:"red"},1:{tip:"نسبتا بد",color:"brown"},2:{tip:"متوسط",color:"orange"},3:{tip:"خوب",color:"blue"},4:{tip:"عالی",color:"green"}}},e.fn.dfstarratings.options,t||{});var n=[];return this.each(function(){n.push(e(this))}),e.fn.dfstarratings.fetch(n,0,"0%",e.fn.dfstarratings.options.msg,!0),this.each(function(){})},e.fn.dfstarratings.animate=function(a){if(a.hasClass("disabled"))e(".dffr-stars a",a).unbind("click").click(function(){return!1});else{var t=e(".dffr-legend",a).html(),n=e(".dffr-fuel",a).css("width");e(".dffr-stars a",a).hover(function(){var r=e(this).attr("href").split("#")[1];0!=e.fn.dfstarratings.options.tooltip&&(null!=e.fn.dfstarratings.options.tooltips[r-1]?e(".dffr-legend",a).html('<span style="color:'+e.fn.dfstarratings.options.tooltips[r-1].color+'">'+e.fn.dfstarratings.options.tooltips[r-1].tip+"</span>"):e(".dffr-legend",a).html(t)),e(".dffr-fuel",a).stop(!0,!0).css("width","0%"),e(".dffr-stars a",a).each(function(t,n){var s=e(this),f=s.attr("href").split("#")[1];parseInt(f)<=parseInt(r)&&(e(".dffr-stars a",a).stop(!0,!0),s.hide().addClass("dffr-star").addClass("orange").fadeIn("fast"))})},function(){e(".dffr-stars a",a).removeClass("dffr-star").removeClass("orange"),0!=e.fn.dfstarratings.options.tooltip&&e(".dffr-legend",a).html(t),e(".dffr-fuel",a).stop(!0,!0).animate({width:n},e.fn.dfstarratings.options.fuelspeed)}).unbind("click").click(function(){return e.fn.dfstarratings.click(a,e(this).attr("href").split("#")[1])})}},e.fn.dfstarratings.update=function(n,t,s,f,r){"true"==f&&e(".dffr-fuel",n).removeClass("yellow").addClass("orange"),e(".dffr-fuel",n).stop(!0,!0).animate({width:t},e.fn.dfstarratings.options.fuelspeed,"linear",function(){if("true"==f&&(n.addClass("disabled"),e(".dffr-stars a",n).unbind("hover")),e.fn.dfstarratings.options.google_schema_legend&&r)e.fn.dfstarratings.animate(n);else{if(s)var t=s;else t=e.fn.dfstarratings.options.msg;if("true"==t)t=e.fn.dfstarratings.options.msg;e(".dffr-legend",n).stop(!0,!0).hide().html(t).fadeIn("slow",function(){e.fn.dfstarratings.animate(n)})}})},e.fn.dfstarratings.click=function(t,n){e(".dffr-stars a",t).unbind("hover").unbind("click").removeClass("dffr-star").removeClass("orange").click(function(){return!1});var s=e(".dffr-legend",t).html(),f=e(".dffr-fuel",t).css("width");return e.fn.dfstarratings.fetch(t,n,f,s,!1),!1},e.fn.dfstarratings.fetch=function(n,t,f,r,a){var s=[];e.each(n,function(){s.push(e(this).attr("data-id"))}),e.ajax({url:e.fn.dfstarratings.options.ajaxurl,data:"action="+e.fn.dfstarratings.options.func+"&id="+s+"&stars="+t+"&_wpnonce="+e.fn.dfstarratings.options.nonce,type:"post",dataType:"json",beforeSend:function(){e(".dffr-fuel",n).animate({width:"0%"},e.fn.dfstarratings.options.fuelspeed),t&&e(".dffr-legend",n).fadeOut("fast",function(){e(".dffr-legend",n).html('<span style="color: green">'+e.fn.dfstarratings.options.thankyou+"</span>")}).fadeIn("slow")},success:function(s){e.each(n,function(){var t=e(this),n=t.attr("data-id");s[n].success?e.fn.dfstarratings.update(t,s[n].fuel+"%",s[n].legend,s[n].disable,a):e.fn.dfstarratings.update(t,f,r,!1,a)})},complete:function(){},error:function(t){e(".dffr-legend",n).fadeOut("fast",function(){e(".dffr-legend",n).html('<span style="color: red">'+e.fn.dfstarratings.options.error_msg+"</span>")}).fadeIn("slow",function(){e.fn.dfstarratings.update(n,f,r,!1,a)})}})},e.fn.dfstarratings.options={ajaxurl:Ajax_send_dffr_js.ajaxurl,func:Ajax_send_dffr_js.func,nonce:Ajax_send_dffr_js.nonce,google_schema_legend:Ajax_send_dffr_js.google_schema_legend,tooltip:Ajax_send_dffr_js.tooltip,tooltips:Ajax_send_dffr_js.tooltips,msg:Ajax_send_dffr_js.msg,fuelspeed:Ajax_send_dffr_js.fuelspeed,thankyou:Ajax_send_dffr_js.thankyou,error_msg:Ajax_send_dffr_js.error_msg}}(jQuery,window,document),jQuery(document).ready(function(t){t(".df-star-ratings").dfstarratings()});