WP ULike - Version 4.5.2

Version Description

  • Fixed: JS conflict issue with buddypress activity stream.
Download this release

Release Info

Developer alimir
Plugin Icon 128x128 WP ULike
Version 4.5.2
Comparing to
See all releases

Code changes from version 4.5.1 to 4.5.2

assets/js/wp-ulike.js CHANGED
@@ -1024,7 +1024,7 @@
1024
 
1025
  // Init on buddypress activity stream
1026
  $('#buddypress').on('bp_ajax_request', '[data-bp-list="activity"]', function () {
1027
- ulp_main_elements();
1028
  });
1029
 
1030
  })(jQuery);
1024
 
1025
  // Init on buddypress activity stream
1026
  $('#buddypress').on('bp_ajax_request', '[data-bp-list="activity"]', function () {
1027
+ $(".wpulike").WordpressUlike();
1028
  });
1029
 
1030
  })(jQuery);
assets/js/wp-ulike.min.js CHANGED
@@ -2,4 +2,4 @@
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
5
- !function(t){t.fn.WordpressUlikeTooltip=function(e){if(this.length>1)return this.each((function(){t(this).WordpressUlikeTooltip(e)})),this;if(void 0===this||1!==this.length)return!1;const i=t(this);e=t.extend({},t.WordpressUlikeTooltip.defaults,e,i.data());let s=i.attr("title");void 0!==s&&s.length&&(e.title=s),e.class+=" ulf-"+e.theme+"-theme",e.class+=" ulf-"+e.size,e.trigger=e.trigger.toLowerCase().trim();let n={dom:this,dom_wrapped:i,position_debug:e.position_debug,trigger:e.trigger,id:e.id,title:e.title,content:e.title,child_class:e.child,theme:e.theme,class:e.class,position:e.position,close_on_outside_click:e.close_on_outside_click,singleton:e.singleton,dataAttr:"ulike-tooltip",createTooltipHTML:function(){return`<div class='ulf-tooltip ${n.class}' role='tooltip'><div class='ulf-arrow'></div><div class='ulf-content'>${n.content}</div></div>`},destroy:function(){const e=n.dom_wrapped.data(n.dataAttr);null!=e&&(e.dom_wrapped.off("touchstart mouseenter",e.show),e.dom_wrapped.off("click",e.preventDefaultHandler),t(window).off("resize",e.onResize),e.isVisible()&&e.hide(),e.dom_wrapped.data(e.dataAttr,null))},initialize:function(){return n.dom_wrapped.on("touchstart mouseenter",n.show),n.dom_wrapped.on("click",n.preventDefaultHandler),t.WordpressUlikeTooltip.body_click_initialized||(t(document).on("touchstart mousedown",n.onClickOutside),t.WordpressUlikeTooltip.bodyClickInitialized=!0),n.dom_wrapped.data(n.dataAttr,n),t(document).on("WordpressUlikeLikersMarkupUpdated",(function(t,e,i,s){if("popover"==i)if(s.length)n.show();else{let t=e.data(n.dataAttr);null!=t&&t.destroy()}})),n.dom},preventDefaultHandler:function(t){return t.preventDefault(),!1},show:function(e){if(n.isVisible())return!1;n.singleton&&n.hideAllVisible();const i=t("body");(void 0===e||e)&&"function"==typeof n.title&&(n.content=n.title(n.dom_wrapped,n)),i.append(n.createTooltipHTML()),n.tooltip=t(".ulf-tooltip:last"),n.positionTooltip(),t(window).on("resize",n.onResize);const s="ulp-dom-"+n.id;n.tooltip.attr("id",s),n.dom.attr("aria-describedby",s),t.WordpressUlikeTooltip.visible.push(n),(void 0===e||e)&&n.dom.trigger("ulf-show",[n.tooltip,n.hide]),t("body").on("DOMSubtreeModified",n.positionTooltip)},isVisible:function(){return t.inArray(n,t.WordpressUlikeTooltip.visible)>-1},hideAllVisible:function(){return t.each(t.WordpressUlikeTooltip.visible,(function(t,e){e.dom_wrapped.hasClass("ulf-focused")||e.hide()})),this},hide:function(e){t("body").off("DOMSubtreeModified",n.positionTooltip),t(window).off("resize",n.onResize),n.dom.attr("aria-describedby",null),n.tooltip&&n.tooltip.length&&n.tooltip.remove(),(void 0===e||e)&&n.dom.trigger("ulf-hide"),"click"!==n.trigger&&n.dom_wrapped.off("touchstart mousedown",n.hide);var i=t.inArray(n,t.WordpressUlikeTooltip.visible);return t.WordpressUlikeTooltip.visible.splice(i,1),n.dom},onResize:function(){n.hide(!1),n.show(!1)},onClickOutside:function(e){const i=t(e.target);i.hasClass("ulf-tooltip")||i.parents(".ulf-tooltip:first").length||t.each(t.WordpressUlikeTooltip.visible,(function(t,e){void 0!==e&&e.close_on_outside_click&&(i!==e.dom_wrapped||"focus"!==e.trigger&&"hoverfocus"!==e.trigger)&&e.hide()}))},positionTooltip:function(){n.positionDebug("-- Start positioning --"),n.dom_wrapped.length&&n.dom_wrapped.is(":visible")||(n.positionDebug("Elem no longer exists. Removing tooltip"),n.hide(!0));let t=n.tooltip.find(".ulf-arrow"),[e,i,s,o,l,a]=n.calculateSafePosition(n.position);return void 0===l&&"auto"!==n.position&&(n.positionDebug("Couldn't fit preferred position"),[e,i,s,o,l,a]=n.calculateSafePosition("auto")),void 0===l?(n.positionDebug("Doesn't appear to fit. Displaying centered"),n.tooltip.addClass("ulf-centered").css({top:"50%",left:"50%","margin-left":-s/2,"margin-top":-o/2}),t&&t.length&&t.remove(),void n.positionDebug("-- Done positioning --")):(n.positionDebug({"Setting Position":{Left:l,Top:a}}),n.tooltip.css("left",l),n.tooltip.css("top",a),i<60&&(n.positionDebug("Element is less than "+i+"px. Setting arrow to hug the side tighter"),e+=" ulf-arrow-super-hug"),t.addClass("ulf-arrow-"+e),n.positionDebug("-- Done positioning --"),n)},calculateSafePosition:function(t){let e,i,s,o=n.tooltip.find(".ulf-arrow"),l=n.dom_wrapped.offset(),a=n.dom_wrapped.outerHeight(),r=n.dom_wrapped.outerWidth(),p=n.tooltip.outerWidth(),d=n.tooltip.outerHeight(),u=document.querySelector("body").offsetWidth,h=document.querySelector("body").offsetHeight,g=o.is(":visible")?o.outerHeight():0,c=o.is(":visible")?o.outerWidth():0,m={};if(m.below=h-(d+a+l.top)>5,m.above=l.top-d>5,m.vertical_half=l.top+r/2-d/2>5,m.right=u-(p+r+l.left)>5,m.right_half=u-l.left-r/2-p/2>5,m.right_full=u-l.left-p>5,m.left=l.left-p>5,m.left_half=l.left+r/2-p/2>5,m.left_full=l.left-p>5,n.positionDebug({"Clicked Element":{Left:l.left,Top:l.top}}),n.positionDebug({"Element Dimensions":{Height:a,Width:r},"Tooltip Dimensions":{Height:d,Width:p},"Window Dimensions":{Height:h,Width:u},"Arrow Dimensions":{Height:g,Width:c}}),n.positionDebug(m),("auto"===t||"bottom"===t)&&m.below&&m.left_half&&m.right_half)n.positionDebug("Displaying below, centered"),e="top",i=l.left-p/2+r/2,s=l.top+a+g/2;else if(("auto"===t||"top"===t)&&m.above&&m.left_half&&m.right_half){if(n.positionDebug("Displaying above, centered"),e="bottom",n.child_class){let t=n.dom_wrapped.find(n.child_class).first();i=t.offset().left-p/2+t.width()/2}else i=l.left-p/2+r/2;s=l.top-d-g/2}else("auto"===t||"left"===t)&&m.left&&m.vertical_half?(n.positionDebug("Displaying left, centered"),e="right",i=l.left-p-c/2,s=l.top+a/2-d/2):("auto"===t||"right"===t)&&m.right&&m.vertical_half?(n.positionDebug("Displaying right, centered"),e="left",i=l.left+r+c/2,s=l.top+a/2-d/2):("auto"===t||"bottom"===t)&&m.below&&m.right_full?(n.positionDebug("Displaying below, to the right"),e="top ulf-arrow-hug-left",i=l.left,s=l.top+a+g/2):("auto"===t||"bottom"===t)&&m.below&&m.left_full?(n.positionDebug("Displaying below, to the left"),e="top ulf-arrow-hug-right",i=l.left+r-p,s=l.top+a+g/2):("auto"===t||"top"===t)&&m.above&&m.right_full?(n.positionDebug("Displaying above, to the right"),e="bottom ulf-arrow-hug-left",i=l.left,s=l.top-d-g/2):("auto"===t||"top"===t)&&m.above&&m.left_full&&(n.positionDebug("Displaying above, to the left"),e="bottom ulf-arrow-hug-right",i=l.left+r-p,s=l.top-d-g/2);return[e,r,p,d,i,s]},positionDebug:function(t){return!!n.position_debug&&("object"==typeof t?console.table(t):console.log("Position: "+t))}};return n.destroy(),n.initialize()},t.WordpressUlikeTooltip={},t.WordpressUlikeTooltip.visible=[],t.WordpressUlikeTooltip.body_click_initialized=!1,t.WordpressUlikeTooltip.defaults={id:Date.now(),title:"",trigger:"hoverfocus",position:"auto",class:"",theme:"black",size:"small",singleton:!0,close_on_outside_click:!0}}(jQuery),function(t,e,i,s){"use strict";var n={messageType:"success",messageText:"Hello World!",timeout:8e3,messageElement:"wpulike-message",notifContainer:"wpulike-notification"};function o(e,i){this.element=e,this.$element=t(e),this.settings=t.extend({},n,i),this._defaults=n,this._name="WordpressUlikeNotifications",this.init()}t.extend(o.prototype,{init:function(){this._message(),this._container(),this._append(),this._remove()},_message:function(){this.$messageElement=t("<div/>").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){t("."+this.settings.notifContainer).length||this.$element.append(t("<div/>").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.WordpressUlikeNotifications=function(t){return this.each((function(){new o(this,t)}))}}(jQuery,window,document),function(t,e,i,s){"use strict";t(e);var n=t(i),o={ID:0,nonce:0,type:"",append:"",appendTimeout:2e3,displayLikers:!1,counterValue:"",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-counter-value":"counterValue","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 s in this.element=e,this.$element=t(e),this.settings=t.extend({},o,i),this._defaults=o,this._name="WordpressUlike",this.buttonElement=this.$element.find(this.settings.buttonSelector),l){var n=this.buttonElement.data(s);void 0!==n&&(this.settings[l[s]]=n)}this.generalElement=this.$element.find(this.settings.generalSelector),""!==this.settings.counterValue&&this.buttonElement.each(function(e,i){void 0===t(i).data("ulike-counter-value")||t(i).next(this.settings.counterSelector).length||t(i).after(t("<span/>").addClass(this.settings.counterSelector.split(".").join("")).html(t(i).data("ulike-counter-value")))}.bind(this)),this.counterElement=this.generalElement.find(this.settings.counterSelector),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&&(t.data.status<5&&(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;default: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){"object"!=typeof t?this.counterElement.html(t):this.settings.isTotal&&void 0!==t.sub?this.counterElement.html(t.sub):"down"===this.settings.factor?(this.counterElement.html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).html(t.up)):(this.counterElement.html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).html(t.down)),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")?(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&&("object"!=typeof t?this.buttonElement.find("span").html(t):"down"===this.settings.factor?(this.buttonElement.find("span").html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.up)):(this.buttonElement.find("span").html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.down)))},_sendNotification:function(e,s){t(i.body).WordpressUlikeNotifications({messageType:e,messageText:s})}}),t.fn.WordpressUlike=function(e){return this.each((function(){t.data(this,"plugin_WordpressUlike")||t.data(this,"plugin_WordpressUlike",new a(this,e))}))}}(jQuery,window,document),function(t){t((function(){t(".wpulike").WordpressUlike()})),t(".wpulike").WordpressUlike(),t(document).ajaxComplete((function(){t(".wpulike").WordpressUlike()})),t("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',(function(){ulp_main_elements()}))}(jQuery);
2
  * https://wpulike.com
3
  * TechnoWich 2021;
4
  */
5
+ !function(t){t.fn.WordpressUlikeTooltip=function(e){if(this.length>1)return this.each((function(){t(this).WordpressUlikeTooltip(e)})),this;if(void 0===this||1!==this.length)return!1;const i=t(this);e=t.extend({},t.WordpressUlikeTooltip.defaults,e,i.data());let s=i.attr("title");void 0!==s&&s.length&&(e.title=s),e.class+=" ulf-"+e.theme+"-theme",e.class+=" ulf-"+e.size,e.trigger=e.trigger.toLowerCase().trim();let n={dom:this,dom_wrapped:i,position_debug:e.position_debug,trigger:e.trigger,id:e.id,title:e.title,content:e.title,child_class:e.child,theme:e.theme,class:e.class,position:e.position,close_on_outside_click:e.close_on_outside_click,singleton:e.singleton,dataAttr:"ulike-tooltip",createTooltipHTML:function(){return`<div class='ulf-tooltip ${n.class}' role='tooltip'><div class='ulf-arrow'></div><div class='ulf-content'>${n.content}</div></div>`},destroy:function(){const e=n.dom_wrapped.data(n.dataAttr);null!=e&&(e.dom_wrapped.off("touchstart mouseenter",e.show),e.dom_wrapped.off("click",e.preventDefaultHandler),t(window).off("resize",e.onResize),e.isVisible()&&e.hide(),e.dom_wrapped.data(e.dataAttr,null))},initialize:function(){return n.dom_wrapped.on("touchstart mouseenter",n.show),n.dom_wrapped.on("click",n.preventDefaultHandler),t.WordpressUlikeTooltip.body_click_initialized||(t(document).on("touchstart mousedown",n.onClickOutside),t.WordpressUlikeTooltip.bodyClickInitialized=!0),n.dom_wrapped.data(n.dataAttr,n),t(document).on("WordpressUlikeLikersMarkupUpdated",(function(t,e,i,s){if("popover"==i)if(s.length)n.show();else{let t=e.data(n.dataAttr);null!=t&&t.destroy()}})),n.dom},preventDefaultHandler:function(t){return t.preventDefault(),!1},show:function(e){if(n.isVisible())return!1;n.singleton&&n.hideAllVisible();const i=t("body");(void 0===e||e)&&"function"==typeof n.title&&(n.content=n.title(n.dom_wrapped,n)),i.append(n.createTooltipHTML()),n.tooltip=t(".ulf-tooltip:last"),n.positionTooltip(),t(window).on("resize",n.onResize);const s="ulp-dom-"+n.id;n.tooltip.attr("id",s),n.dom.attr("aria-describedby",s),t.WordpressUlikeTooltip.visible.push(n),(void 0===e||e)&&n.dom.trigger("ulf-show",[n.tooltip,n.hide]),t("body").on("DOMSubtreeModified",n.positionTooltip)},isVisible:function(){return t.inArray(n,t.WordpressUlikeTooltip.visible)>-1},hideAllVisible:function(){return t.each(t.WordpressUlikeTooltip.visible,(function(t,e){e.dom_wrapped.hasClass("ulf-focused")||e.hide()})),this},hide:function(e){t("body").off("DOMSubtreeModified",n.positionTooltip),t(window).off("resize",n.onResize),n.dom.attr("aria-describedby",null),n.tooltip&&n.tooltip.length&&n.tooltip.remove(),(void 0===e||e)&&n.dom.trigger("ulf-hide"),"click"!==n.trigger&&n.dom_wrapped.off("touchstart mousedown",n.hide);var i=t.inArray(n,t.WordpressUlikeTooltip.visible);return t.WordpressUlikeTooltip.visible.splice(i,1),n.dom},onResize:function(){n.hide(!1),n.show(!1)},onClickOutside:function(e){const i=t(e.target);i.hasClass("ulf-tooltip")||i.parents(".ulf-tooltip:first").length||t.each(t.WordpressUlikeTooltip.visible,(function(t,e){void 0!==e&&e.close_on_outside_click&&(i!==e.dom_wrapped||"focus"!==e.trigger&&"hoverfocus"!==e.trigger)&&e.hide()}))},positionTooltip:function(){n.positionDebug("-- Start positioning --"),n.dom_wrapped.length&&n.dom_wrapped.is(":visible")||(n.positionDebug("Elem no longer exists. Removing tooltip"),n.hide(!0));let t=n.tooltip.find(".ulf-arrow"),[e,i,s,o,l,a]=n.calculateSafePosition(n.position);return void 0===l&&"auto"!==n.position&&(n.positionDebug("Couldn't fit preferred position"),[e,i,s,o,l,a]=n.calculateSafePosition("auto")),void 0===l?(n.positionDebug("Doesn't appear to fit. Displaying centered"),n.tooltip.addClass("ulf-centered").css({top:"50%",left:"50%","margin-left":-s/2,"margin-top":-o/2}),t&&t.length&&t.remove(),void n.positionDebug("-- Done positioning --")):(n.positionDebug({"Setting Position":{Left:l,Top:a}}),n.tooltip.css("left",l),n.tooltip.css("top",a),i<60&&(n.positionDebug("Element is less than "+i+"px. Setting arrow to hug the side tighter"),e+=" ulf-arrow-super-hug"),t.addClass("ulf-arrow-"+e),n.positionDebug("-- Done positioning --"),n)},calculateSafePosition:function(t){let e,i,s,o=n.tooltip.find(".ulf-arrow"),l=n.dom_wrapped.offset(),a=n.dom_wrapped.outerHeight(),r=n.dom_wrapped.outerWidth(),p=n.tooltip.outerWidth(),d=n.tooltip.outerHeight(),u=document.querySelector("body").offsetWidth,h=document.querySelector("body").offsetHeight,g=o.is(":visible")?o.outerHeight():0,c=o.is(":visible")?o.outerWidth():0,m={};if(m.below=h-(d+a+l.top)>5,m.above=l.top-d>5,m.vertical_half=l.top+r/2-d/2>5,m.right=u-(p+r+l.left)>5,m.right_half=u-l.left-r/2-p/2>5,m.right_full=u-l.left-p>5,m.left=l.left-p>5,m.left_half=l.left+r/2-p/2>5,m.left_full=l.left-p>5,n.positionDebug({"Clicked Element":{Left:l.left,Top:l.top}}),n.positionDebug({"Element Dimensions":{Height:a,Width:r},"Tooltip Dimensions":{Height:d,Width:p},"Window Dimensions":{Height:h,Width:u},"Arrow Dimensions":{Height:g,Width:c}}),n.positionDebug(m),("auto"===t||"bottom"===t)&&m.below&&m.left_half&&m.right_half)n.positionDebug("Displaying below, centered"),e="top",i=l.left-p/2+r/2,s=l.top+a+g/2;else if(("auto"===t||"top"===t)&&m.above&&m.left_half&&m.right_half){if(n.positionDebug("Displaying above, centered"),e="bottom",n.child_class){let t=n.dom_wrapped.find(n.child_class).first();i=t.offset().left-p/2+t.width()/2}else i=l.left-p/2+r/2;s=l.top-d-g/2}else("auto"===t||"left"===t)&&m.left&&m.vertical_half?(n.positionDebug("Displaying left, centered"),e="right",i=l.left-p-c/2,s=l.top+a/2-d/2):("auto"===t||"right"===t)&&m.right&&m.vertical_half?(n.positionDebug("Displaying right, centered"),e="left",i=l.left+r+c/2,s=l.top+a/2-d/2):("auto"===t||"bottom"===t)&&m.below&&m.right_full?(n.positionDebug("Displaying below, to the right"),e="top ulf-arrow-hug-left",i=l.left,s=l.top+a+g/2):("auto"===t||"bottom"===t)&&m.below&&m.left_full?(n.positionDebug("Displaying below, to the left"),e="top ulf-arrow-hug-right",i=l.left+r-p,s=l.top+a+g/2):("auto"===t||"top"===t)&&m.above&&m.right_full?(n.positionDebug("Displaying above, to the right"),e="bottom ulf-arrow-hug-left",i=l.left,s=l.top-d-g/2):("auto"===t||"top"===t)&&m.above&&m.left_full&&(n.positionDebug("Displaying above, to the left"),e="bottom ulf-arrow-hug-right",i=l.left+r-p,s=l.top-d-g/2);return[e,r,p,d,i,s]},positionDebug:function(t){return!!n.position_debug&&("object"==typeof t?console.table(t):console.log("Position: "+t))}};return n.destroy(),n.initialize()},t.WordpressUlikeTooltip={},t.WordpressUlikeTooltip.visible=[],t.WordpressUlikeTooltip.body_click_initialized=!1,t.WordpressUlikeTooltip.defaults={id:Date.now(),title:"",trigger:"hoverfocus",position:"auto",class:"",theme:"black",size:"small",singleton:!0,close_on_outside_click:!0}}(jQuery),function(t,e,i,s){"use strict";var n={messageType:"success",messageText:"Hello World!",timeout:8e3,messageElement:"wpulike-message",notifContainer:"wpulike-notification"};function o(e,i){this.element=e,this.$element=t(e),this.settings=t.extend({},n,i),this._defaults=n,this._name="WordpressUlikeNotifications",this.init()}t.extend(o.prototype,{init:function(){this._message(),this._container(),this._append(),this._remove()},_message:function(){this.$messageElement=t("<div/>").addClass(this.settings.messageElement+" wpulike-"+this.settings.messageType).text(this.settings.messageText)},_container:function(){t("."+this.settings.notifContainer).length||this.$element.append(t("<div/>").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.WordpressUlikeNotifications=function(t){return this.each((function(){new o(this,t)}))}}(jQuery,window,document),function(t,e,i,s){"use strict";t(e);var n=t(i),o={ID:0,nonce:0,type:"",append:"",appendTimeout:2e3,displayLikers:!1,counterValue:"",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-counter-value":"counterValue","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 s in this.element=e,this.$element=t(e),this.settings=t.extend({},o,i),this._defaults=o,this._name="WordpressUlike",this.buttonElement=this.$element.find(this.settings.buttonSelector),l){var n=this.buttonElement.data(s);void 0!==n&&(this.settings[l[s]]=n)}this.generalElement=this.$element.find(this.settings.generalSelector),""!==this.settings.counterValue&&this.buttonElement.each(function(e,i){void 0===t(i).data("ulike-counter-value")||t(i).next(this.settings.counterSelector).length||t(i).after(t("<span/>").addClass(this.settings.counterSelector.split(".").join("")).html(t(i).data("ulike-counter-value")))}.bind(this)),this.counterElement=this.generalElement.find(this.settings.counterSelector),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&&(t.data.status<5&&(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;default: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){"object"!=typeof t?this.counterElement.html(t):this.settings.isTotal&&void 0!==t.sub?this.counterElement.html(t.sub):"down"===this.settings.factor?(this.counterElement.html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).html(t.up)):(this.counterElement.html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.counterSelector).html(t.down)),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")?(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&&("object"!=typeof t?this.buttonElement.find("span").html(t):"down"===this.settings.factor?(this.buttonElement.find("span").html(t.down),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.up)):(this.buttonElement.find("span").html(t.up),this.siblingElement.length&&this.siblingElement.find(this.settings.buttonSelector).find("span").html(t.down)))},_sendNotification:function(e,s){t(i.body).WordpressUlikeNotifications({messageType:e,messageText:s})}}),t.fn.WordpressUlike=function(e){return this.each((function(){t.data(this,"plugin_WordpressUlike")||t.data(this,"plugin_WordpressUlike",new a(this,e))}))}}(jQuery,window,document),function(t){t((function(){t(".wpulike").WordpressUlike()})),t(".wpulike").WordpressUlike(),t(document).ajaxComplete((function(){t(".wpulike").WordpressUlike()})),t("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',(function(){t(".wpulike").WordpressUlike()}))}(jQuery);
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: like, marketing, elementor, user profile, statistics, favorite, rating, bu
6
  Requires PHP: 5.6
7
  Requires at least: 5.0
8
  Tested up to: 5.7.2
9
- Stable tag: 4.5.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -140,6 +140,9 @@ Yes, WP ULike is compatible with Apache, Nginx, Microsoft IIS et LiteSpeed web s
140
 
141
  == Changelog ==
142
 
 
 
 
143
  = 4.5.1 =
144
  * Updated: Display counter and likers list by DOM insertion to prevent post excerpt issues.
145
  * Updated: Add interval time support on counter shortcode.
6
  Requires PHP: 5.6
7
  Requires at least: 5.0
8
  Tested up to: 5.7.2
9
+ Stable tag: 4.5.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
140
 
141
  == Changelog ==
142
 
143
+ = 4.5.2 =
144
+ * Fixed: JS conflict issue with buddypress activity stream.
145
+
146
  = 4.5.1 =
147
  * Updated: Display counter and likers list by DOM insertion to prevent post excerpt issues.
148
  * Updated: Add interval time support on counter shortcode.
wp-ulike.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP ULike
4
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
5
  * Description: Receiving feedback is crucial as a content creator, but unfortunately, the pieces of content you can collect it on are limited by default. However, with the help of the WP ULike plugin, it is possible to cast voting to any type of content you may have on your website. With outstanding and eye-catching widgets, you can have Like and Dislike Button on all of your content would it be a post, comment, BuddyPress activity, bbPress topics, WooCommerce products, you name it. Now you can feel your users Love for each part of your work.
6
- * Version: 4.5.1
7
  * Author: TechnoWich
8
  * Author URI: https://technowich.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
9
  * Text Domain: wp-ulike
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
27
 
28
  // Do not change these values
29
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
30
- define( 'WP_ULIKE_VERSION' , '4.5.1' );
31
  define( 'WP_ULIKE_DB_VERSION' , '2.1' );
32
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
33
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
3
  * Plugin Name: WP ULike
4
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
5
  * Description: Receiving feedback is crucial as a content creator, but unfortunately, the pieces of content you can collect it on are limited by default. However, with the help of the WP ULike plugin, it is possible to cast voting to any type of content you may have on your website. With outstanding and eye-catching widgets, you can have Like and Dislike Button on all of your content would it be a post, comment, BuddyPress activity, bbPress topics, WooCommerce products, you name it. Now you can feel your users Love for each part of your work.
6
+ * Version: 4.5.2
7
  * Author: TechnoWich
8
  * Author URI: https://technowich.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
9
  * Text Domain: wp-ulike
27
 
28
  // Do not change these values
29
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
30
+ define( 'WP_ULIKE_VERSION' , '4.5.2' );
31
  define( 'WP_ULIKE_DB_VERSION' , '2.1' );
32
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
33
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));