").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){t("."+this.settings.notifContainer).length||this.$element.append(t("
").addClass(this.settings.notifContainer)),this.$notifContainer=this.$element.find("."+this.settings.notifContainer)},_append:function(){this.$notifContainer.append(this.$messageElement).trigger("WordpressUlikeNotificationAppend")},_remove:function(){var e=this;this.$messageElement.on("click",(function(){t(this).fadeOut(300,(function(){t(this).remove(),t("."+e.settings.messageElement).length||e.$notifContainer.remove()})).trigger("WordpressUlikeRemoveNotification")})),e.settings.timeout&&setTimeout((function(){e.$messageElement.fadeOut(300,(function(){t(this).remove(),t("."+e.settings.messageElement).length||e.$notifContainer.remove()})).trigger("WordpressUlikeRemoveNotification")}),e.settings.timeout)}}),t.fn[e]=function(t){return this.each((function(){new s(this,t)}))}}(jQuery,window,document),function(t,e,i){"use strict";var s="WordpressUlike",n=(t(e),t(i)),o={ID:0,nonce:0,type:"",append:"",appendTimeout:2e3,displayLikers:!1,likersTemplate:"default",disablePophover:!0,isTotal:!1,factor:"",template:"",counterSelector:".count-box",generalSelector:".wp_ulike_general_class",buttonSelector:".wp_ulike_btn",likersSelector:".wp_ulike_likers_wrapper"},l={"ulike-id":"ID","ulike-nonce":"nonce","ulike-type":"type","ulike-append":"append","ulike-is-total":"isTotal","ulike-display-likers":"displayLikers","ulike-likers-style":"likersTemplate","ulike-disable-pophover":"disablePophover","ulike-append-timeout":"appendTimeout","ulike-factor":"factor","ulike-template":"template"};function a(e,i){for(var n in this.element=e,this.$element=t(e),this.settings=t.extend({},o,i),this._defaults=o,this._name=s,this.buttonElement=this.$element.find(this.settings.buttonSelector),l){var a=this.buttonElement.data(n);undefined!==a&&(this.settings[l[n]]=a)}this.generalElement=this.$element.find(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.counterElement.length&&this.counterElement.each(function(e,i){void 0!==t(i).data("ulike-counter-value")&&t(i).html(t(i).data("ulike-counter-value"))}.bind(this)),this.likersElement=this.$element.find(this.settings.likersSelector),this.init()}t.extend(a.prototype,{init:function(){this.buttonElement.on("click",this._initLike.bind(this)),this.generalElement.one("mouseenter",this._updateLikers.bind(this))},_ajax:function(e,i){t.ajax({url:wp_ulike_params.ajax_url,type:"POST",dataType:"json",data:e}).done(i)},_initLike:function(t){t.stopPropagation(),this._maybeUpdateElements(t),this._updateSameButtons(),this._updateSameLikers(),this.buttonElement.prop("disabled",!0),n.trigger("WordpressUlikeLoading",this.element),this.generalElement.addClass("wp_ulike_is_loading"),this._ajax({action:"wp_ulike_process",id:this.settings.ID,nonce:this.settings.nonce,factor:this.settings.factor,type:this.settings.type,template:this.settings.template,displayLikers:this.settings.displayLikers,likersTemplate:this.settings.likersTemplate},function(t){this.generalElement.removeClass("wp_ulike_is_loading"),t.success?(this._updateMarkup(t),this._appendChild()):t.data.hasToast&&this._sendNotification("error",t.data.message),this.buttonElement.prop("disabled",!1),n.trigger("WordpressUlikeUpdated",this.element)}.bind(this))},_maybeUpdateElements:function(e){this.buttonElement=t(e.currentTarget),this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector),this.settings.factor=this.buttonElement.data("ulike-factor")},_appendChild:function(){if(""!==this.settings.append){var e=t(this.settings.append);this.buttonElement.append(e),this.settings.appendTimeout&&setTimeout((function(){e.detach()}),this.settings.appendTimeout)}},_updateMarkup:function(t){this._setSbilingElement(),this._setSbilingButtons(),this._updateGeneralClassNames(t.data.status),null!==t.data.data&&(5!=t.data.status&&(this.__updateCounter(t.data.data),this.settings.displayLikers&&void 0!==t.data.likers&&this._updateLikersMarkup(t.data.likers)),this._updateButton(t.data.btnText,t.data.status)),t.data.hasToast&&this._sendNotification(t.data.messageType,t.data.message)},_updateGeneralClassNames:function(t){var e="wp_ulike_is_not_liked",i="wp_ulike_is_liked",s="wp_ulike_is_unliked",n="wp_ulike_click_is_disabled";switch(this.siblingElement.length&&this.siblingElement.removeClass(this._arrayToString([i,s])),t){case 1:this.generalElement.addClass(i).removeClass(e),this.generalElement.children().first().addClass(n);break;case 2:this.generalElement.addClass(s).removeClass(i);break;case 3:this.generalElement.addClass(i).removeClass(s);break;case 0:case 5:this.generalElement.addClass(n),this.siblingElement.length&&this.siblingElement.addClass(n)}},_arrayToString:function(t){return t.join(" ")},_setSbilingElement:function(){this.siblingElement=this.generalElement.siblings()},_setSbilingButtons:function(){this.siblingButton=this.buttonElement.siblings(this.settings.buttonSelector)},__updateCounter:function(t){this.counterElement.attr("data-ulike-counter-value",t).html(t),n.trigger("WordpressUlikeCounterUpdated",[this.buttonElement])},_updateLikers:function(t){if(this.settings.displayLikers){if("popover"==this.settings.likersTemplate&&this.$element.data("ulike-tooltip"))return;if("default"==this.settings.likersTemplate&&this.likersElement.length)return;return this.generalElement.addClass("wp_ulike_is_getting_likers_list"),this._ajax({action:"wp_ulike_get_likers",id:this.settings.ID,nonce:this.settings.nonce,type:this.settings.type,displayLikers:this.settings.displayLikers,likersTemplate:this.settings.likersTemplate},function(t){this.generalElement.removeClass("wp_ulike_is_getting_likers_list"),t.success&&this._updateLikersMarkup(t.data)}.bind(this)),t.stopImmediatePropagation(),!1}},_updateLikersMarkup:function(e){"popover"==this.settings.likersTemplate?(this.likersElement=this.$element,e.template&&this.likersElement.WordpressUlikeTooltip({id:this.settings.type.toLowerCase()+"-"+this.settings.ID,title:e.template,position:"top",child:this.settings.generalSelector,theme:"white",size:"tiny",trigger:"hover"})):(this.likersElement.length||(this.likersElement=t(e.template).appendTo(this.$element)),e.template?this.likersElement.show().html(e.template):this.likersElement.hide().empty()),n.trigger("WordpressUlikeLikersMarkupUpdated",[this.likersElement,this.settings.likersTemplate,e.template])},_updateSameButtons:function(){var t=void 0!==this.settings.factor?"_"+this.settings.factor:"";this.sameButtons=n.find(".wp_"+this.settings.type.toLowerCase()+t+"_btn_"+this.settings.ID),this.sameButtons.length>1&&(this.buttonElement=this.sameButtons,this.generalElement=this.buttonElement.closest(this.settings.generalSelector),this.counterElement=this.generalElement.find(this.settings.counterSelector))},_updateSameLikers:function(){this.sameLikers=n.find(".wp_"+this.settings.type.toLowerCase()+"_likers_"+this.settings.ID),this.sameLikers.length>1&&(this.likersElement=this.sameLikers)},_getLikersElement:function(){return this.likersElement},_updateButton:function(t,e){this.buttonElement.hasClass("wp_ulike_put_image")?(4==e?this.buttonElement.addClass("image-unlike wp_ulike_btn_is_active"):this.buttonElement.toggleClass("image-unlike wp_ulike_btn_is_active"),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).removeClass("image-unlike wp_ulike_btn_is_active"),this.siblingButton.length&&this.siblingButton.removeClass("image-unlike wp_ulike_btn_is_active")):this.buttonElement.hasClass("wp_ulike_put_text")&&null!==t&&this.buttonElement.find("span").html(t)},_sendNotification:function(e,s){t(i.body).WordpressUlikeNotifications({messageType:e,messageText:s})}}),t.fn[s]=function(e){return this.each((function(){t.data(this,"plugin_"+s)||t.data(this,"plugin_"+s,new a(this,e))}))}}(jQuery,window,document),function(t){var e,i,s;t(".wpulike").WordpressUlike(),e=".wpulike",i=function(e){t(e).WordpressUlike()},s=t("body")[0],new(window.MutationObserver||window.WebKitMutationObserver)((function(s){s.forEach((function(s){if(s.addedNodes.length)for(var n=t(s.addedNodes).find(e),o=0,l=n.length;o
'),this.focusRetriever=e("#focus_retriever"),this.focusRetrieved=!1,this.isIE8AndOlder){this.focusRetriever.blur(function(r){r.stopPropagation(),r.preventDefault(),e.iframeTracker.windowLoseFocus(r)}),e("body").click(function(r){e(window).focus()}),e("form").click(function(e){e.stopPropagation()});try{e("body").on("click","form",function(e){e.stopPropagation()})}catch(e){console.log("[iframeTracker] Please update jQuery to 1.7 or newer. (exception: "+e.message+")")}}},track:function(r,t){t.target=r,e.iframeTracker.handlersList.push(t),e(r).bind("mouseover",{handler:t},e.iframeTracker.mouseoverListener).bind("mouseout",{handler:t},e.iframeTracker.mouseoutListener)},untrack:function(r){if("function"==typeof Array.prototype.filter){e(r).each(function(r){e(this).unbind("mouseover",e.iframeTracker.mouseoverListener).unbind("mouseout",e.iframeTracker.mouseoutListener)});var t=function(e){return null!==e};for(var i in this.handlersList){for(var o in this.handlersList[i].target)-1!==e.inArray(this.handlersList[i].target[o],r)&&(this.handlersList[i].target[o]=null);this.handlersList[i].target=this.handlersList[i].target.filter(t),0===this.handlersList[i].target.length&&(this.handlersList[i]=null)}this.handlersList=this.handlersList.filter(t)}else console.log("Your browser doesn't support Array filter, untrack disabled")},mouseoverListener:function(r){r.data.handler.over=!0,e.iframeTracker.retrieveFocus();try{r.data.handler.overCallback(this,r)}catch(e){}},mouseoutListener:function(r){r.data.handler.over=!1,e.iframeTracker.retrieveFocus();try{r.data.handler.outCallback(this,r)}catch(e){}},retrieveFocus:function(){document.activeElement&&"IFRAME"===document.activeElement.tagName&&(e.iframeTracker.focusRetriever.focus(),e.iframeTracker.focusRetrieved=!0)},windowLoseFocus:function(e){for(var r in this.handlersList)if(!0===this.handlersList[r].over)try{this.handlersList[r].blurCallback(e)}catch(e){}}},e(document).ready(function(){e.iframeTracker.init()})}(e)})
'}}})()