!function(a){"use strict";window.jnews.like=window.jnews.like||{},window.jnews.like={init:function(e){var i=this;i.container=void 0===e?a("body"):e,i.container.find(".jeg_meta_like > a").off("click").on("click",(function(e){e.preventDefault(),a(this).hasClass("clicked")||(i.element=i.container.find(".jeg_meta_like > a[data-id="+a(this).attr("data-id")+"][data-type="+a(this).attr("data-type")+"]"),i.parent=i.element.parent(),i.like=i.parent.find(".like"),i.dislike=i.parent.find(".dislike"),i.ajax_request())}))},ajax_request:function(){var e=this;e.parent.addClass("clicked").find(".fa").addClass("fa-pulse"),a.ajax({url:jnews_ajax_url,type:"post",dataType:"json",data:{post_id:e.element.attr("data-id"),type:e.element.attr("data-type"),action:"like_handler"}}).done((function(i){if(-1===i.response){var t=window.jnews.loginregister;a("#jeg_loginform form").find("h3").html(i.message),a.magnificPopup.open({removalDelay:500,midClick:!0,mainClass:"mfp-zoom-out",type:"inline",items:{src:"#jeg_loginform"},callbacks:{beforeOpen:function(){this.st.mainClass="mfp-zoom-out",a("body").removeClass("jeg_show_menu")},change:function(){var e=this.content.find(".g-recaptcha"),i=this.content.find("form").data("type"),n=e.data("sitekey");this.content.find(".form-message p").remove(),t.validateCaptcha=!1,1==jnewsoption.recaptcha&&e.length&&(e.hasClass("loaded")?grecaptcha.reset(t.captcha[i]):(t.captcha[i]=grecaptcha.render(e.get(0),{sitekey:n,callback:t.validateResponse.bind(t)}),a(e).addClass("loaded")))}}})}else 1===i.value&&(e.like.html("<i class='fa fa-thumbs-up'></i> <span>"+i.like+"</span>"),e.dislike.html("<i class='fa fa-thumbs-o-down fa-flip-horizontal'></i> <span>"+i.dislike+"</span>")),-1===i.value&&(e.like.html("<i class='fa fa-thumbs-o-up'></i> <span>"+i.like+"</span>"),e.dislike.html("<i class='fa fa-thumbs-down fa-flip-horizontal'></i> <span>"+i.dislike+"</span>")),0===i.value&&(e.like.html("<i class='fa fa-thumbs-o-up'></i> <span>"+i.like+"</span>"),e.dislike.html("<i class='fa fa-thumbs-o-down fa-flip-horizontal'></i> <span>"+i.dislike+"</span>"))})).fail((function(a,e,i){"error"===e?alert(i.toString()):"timeout"===e&&alert("Execution Timeout")})).always((function(a,i,t){e.element.attr("data-message",a.message),e.parent.removeClass("clicked").find(".fa").removeClass("fa-pulse")}))}},a(document).on("ready jnews-ajax-load",(function(a,e){jnews.like.init()}))}(jQuery);