From f4f4b3fa25ef9041647a947a7e5c36dbe5520e57 Mon Sep 17 00:00:00 2001 From: Vadim Kunitsyn Date: Sun, 29 Nov 2020 18:43:07 +0300 Subject: [PATCH] v4.0.5 --- jllike/helper.php | 4 ++-- jllike/jllike.xml | 4 ++-- jllike/js/buttons.js | 4 ++-- jllike/js/buttons.min.js | 2 +- pkg_jllike.xml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jllike/helper.php b/jllike/helper.php index b7ec03d..e4ed800 100644 --- a/jllike/helper.php +++ b/jllike/helper.php @@ -258,14 +258,14 @@ function loadScriptAndStyle($isCategory = 1) JHtml::_('jquery.framework'); - $doc->addScript(JURI::base() . "plugins/content/jllike/js/buttons.min.js?11"); + $doc->addScript(JURI::base() . "plugins/content/jllike/js/buttons.min.js?12"); if ($this->params->get('enable_twit', 0)) { $doc->addScript(JURI::base() . "plugins/content/jllike/js/twit.min.js"); } - $doc->addStyleSheet(JURI::base() . "plugins/content/jllike/js/buttons.min.css?11"); + $doc->addStyleSheet(JURI::base() . "plugins/content/jllike/js/buttons.min.css?12"); $btn_border_radius = (int) $this->params->get('btn_border_radius', 15); $btn_dimensions = (int) $this->params->get('btn_dimensions', 30); diff --git a/jllike/jllike.xml b/jllike/jllike.xml index 34bb737..e543043 100644 --- a/jllike/jllike.xml +++ b/jllike/jllike.xml @@ -2,12 +2,12 @@ JL Like JoomLine - 11.02.2020 + 29.11.2020 (C) 2012-2020 by Artem Zhukov, Arkadiy Sedelnikov and Vadim Kunicin(https://joomline.ru) GNU/GPL: http://www.gnu.org/copyleft/gpl.html sale@joomline.ru https://joomline.ru - 4.0.4 + 4.0.5 PLG_JLLIKE_DESC_ALL js diff --git a/jllike/js/buttons.js b/jllike/js/buttons.js index 7089527..3737b9c 100644 --- a/jllike/js/buttons.js +++ b/jllike/js/buttons.js @@ -339,9 +339,9 @@ jQuery.noConflict(); }, getShareLink: function () { - var url = 'https://www.facebook.com/sharer/sharer.php?app_id=114545895322903&sdk=joey&u=' + var url = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(this.linkToShare) - + '&display=popup&ref=plugin&src=share_button'; + + '&display=popup'; //var url = 'https://www.facebook.com/sharer/sharer.php?s=100'; //url += '&p[url]=' + encodeURIComponent(this.linkToShare); //url += '&p[title]=' + encodeURIComponent(this.title); diff --git a/jllike/js/buttons.min.js b/jllike/js/buttons.min.js index e9163aa..a877c68 100644 --- a/jllike/js/buttons.min.js +++ b/jllike/js/buttons.min.js @@ -1 +1 @@ -var socialButtonCountObjects={},jllikeproShareUrls={mail:{},pinteres:{},linkedin:{}};jQuery.noConflict(),function(t,e,n,i){function o(t){if(t){var e=top.location.search.replace(/^\?/,"").split("&");for(var n in e){var i=e[n],o=i.match(/([^=]*)=(\w*)/);if(o[1]===t)return decodeURIComponent(o[2])}}return!1}var r=function(e){return e?t.extend(!0,r.defaults,e):r.defaults};r.defaults={selectors:{facebookButton:".l-fb",twitterButton:".l-tw",vkontakteButton:".l-vk",odnoklassnikiButton:".l-ok",mailButton:".l-ml",linButton:".l-ln",pinteresButton:".l-pinteres",LivejournalButton:".l-lj",BloggerButton:".l-bl",WeiboButton:".l-wb",TelegramButton:".l-tl",WhatsappButton:".l-wa",ViberButton:".l-vi",count:".l-count",ico:".l-ico",shareTitle:"h2:eq(0)",shareSumary:"p:eq(0)",shareImages:"img[src]"},buttonDepth:2,alternativeImage:"",alternativeSummary:"",alternativeTitle:"",forceAlternativeImage:!1,forceAlternativeSummary:!1,forceAlternativeTitle:!1,classes:{countVisibleClass:"like-not-empty"},keys:{shareLinkParam:"href"},popupWindowOptions:["left=0","top=0","width=500","height=400","personalbar=0","toolbar=0","scrollbars=1","resizable=1"]};var s=function(){};s.lastIndex=0,s.prototype={init:function(e,n,i){this.config=n,this.index=i,this.id=t(e).attr("id"),this.$context=e,this.$count=t(this.config.selectors.count,this.$context),this.$ico=t(this.config.selectors.ico,this.$context),this.collectShareInfo(),this.bindEvents(),this.ajaxRequest=this.countLikes()},bindEvents:function(){this.$context.bind("click",s.returnFalse),this.$ico.parent().bind("click",this,this.openShareWindow)},setCountValue:function(t){this.$context.addClass(this.config.classes.countVisibleClass),this.$count.text(t)},getCountLink:function(t){return this.countServiceUrl+encodeURIComponent(t)},collectShareInfo:function(){var o=this.$context,r=this;o=jQuery(jllickeproSettings.parentContayner).length>0?o.parents(jllickeproSettings.parentContayner).parent():o.parents(".jllikeproSharesContayner").parent();var s,l,c=t("input.link-to-share",o).val(),u=t("input.share-title",o).val(),h=t("input.share-image",o).val(),p=(jllickeproSettings.url,t(this.config.selectors.shareTitle,o));if(p.length||(p=t(this.config.selectors.shareTitle,s)),l=t("input.share-desc",o).val(),l.length||(l=t(this.config.selectors.shareSumary,o).text()),l.length||(l=o.text()),l.length||(l=o.parent().text()),this.domenhref=e.location.protocol+"//"+e.location.host,this.linkhref=jllickeproSettings.url+e.location.pathname+e.location.search,this.linkToShare=c||this.linkhref,this.title=""!=u?u:p.text(),this.config.forceAlternativeTitle?this.title=this.config.alternativeTitle:""==this.title&&this.config.alternativeTitle?this.title=this.config.alternativeTitle:""==this.title&&(this.title=n.title),l.length>0?this.summary=l:this.summary=this.config.alternativeSummary?this.config.alternativeSummary:"",this.summary=this.summary.length>200?a(this.summary,200)+"...":this.summary,this.images=[],void 0!==h&&h.length)this.images[0]=h;else{var d=t(this.config.selectors.shareImages,o);if(s=o,!d.length)for(var f=0;0==d.length&&f<20;)f++,s=s.parent(),d=t(this.config.selectors.shareImages,s).not("#waitimg");d.length>0&!this.config.forceAlternativeImage?(d.each(function(t,e){r.images[t]=e.src}),this.images=r.images):this.images[0]=this.config.alternativeImage?this.config.alternativeImage:i}},getPopupOptions:function(){return this.config.popupWindowOptions.join(",")},plusOne:function(){var e=t("#"+this.id),n=t("span.l-count",e),i=n.text();i=""==i?0:parseInt(i),e.addClass("like-not-empty"),n.text(i+1)},disableMoreLikes:function(){if(jllickeproSettings.disableMoreLikes){var e=t("#"+this.id).parents(".jllikeproSharesContayner"),n=e.children(".share-id").val(),i=new Date((new Date).getTime()+2592e6);document.cookie="jllikepro_article_"+n+"=1; path=/; expires="+i.toUTCString();var o=t("
").addClass("disable_more_likes");e.prepend(o)}},openShareWindow:function(t){var n=t.data,i=n.getShareLink(),o=n.getPopupOptions(),r=e.open(i,"",o);n.plusOne(),n.disableMoreLikes(),e.focus&&r.focus()},linkToShare:null,title:n.title,summary:null,images:[],countServiceUrl:null,$context:null,$count:null,$ico:null},s=t.extend(s,{returnFalse:function(t){return!1}});var a=function(e,n){var i="";return e.split(" ").every(function(e){var o=t.trim(e);return i.length+o.length<=n&&(""!=o&&(i+=" "+o),!0)}),i},l=function(t,e,n){this.init(t,e,n),this.type="facebook"};l.prototype=new s,l.prototype=t.extend(l.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){var e=this.getCountLink(this.linkToShare),n=this.id;return t.ajax({url:e,dataType:"jsonp",success:function(e,i,o){if("success"==i&&void 0!==e.engagement&&void 0!==e.engagement.share_count&&e.engagement.share_count>0){var r=t("#"+n);r.addClass("like-not-empty"),t("span.l-count",r).text(e.engagement.share_count),w(r)}}})}},getShareLink:function(){var t="https://www.facebook.com/sharer/sharer.php?app_id=114545895322903&sdk=joey&u="+encodeURIComponent(this.linkToShare)+"&display=popup&ref=plugin&src=share_button";return t},countServiceUrl:"https://graph.facebook.com/v4.0/?access_token=112243502800823|oj4WG8tofQaE5avNxB86XB4GkLE&fields=engagement&id="});var c=function(t,e,n){this.init(t,e,n),this.type="twitter"};c.prototype=new s,c.prototype=t.extend(c.prototype,{countLikes:function(){},getShareLink:function(){var t=a(this.summary,140-this.title.length-this.linkToShare.length);return"https://twitter.com/intent/tweet?url="+encodeURIComponent(this.linkToShare)+"&text="+encodeURIComponent(this.title+". "+t)},countServiceUrl:"https://urls.api.twitter.com/1/urls/count.json?url="});var u=function(t,e,n){this.init(t,e,n),this.type="vkontakte"};u.prototype=new s,u.prototype=t.extend(u.prototype,{countLikes:function(){function n(n,i){if(i>0){var o=e.socialButtonCountObjects[n].id,r=t("#"+o);r.addClass("like-not-empty"),t("span.l-count",r).text(i),w(r)}}if(jllickeproSettings.enableCounters){e.socialButtonCountObjects[this.index]=this;var i=this.getCountLink(this.linkToShare)+"&index="+this.index;if(void 0===e.VK&&(e.VK={}),void 0===e.VK.Share&&(e.VK.Share={}),void 0===e.VK.Share.count)e.VK.Share.count=function(t,e){n(t,e)};else{var o=e.VK.Share.count;e.VK.Share.count=function(t,i){n(t,i),o.call(e.VK.Share,t,i)}}return t.ajax({url:i,dataType:"jsonp"})}},getShareLink:function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.linkToShare)},countServiceUrl:"https://vk.com/share.php?act=count&url="});var h=function(t,e,n){this.init(t,e,n),this.type="odnoklassniki"};h.prototype=new s,h.prototype=t.extend(h.prototype,{countLikes:function(){function n(e,n){if(n>0){var i=t("#"+e);i.addClass("like-not-empty"),t("span.l-count",i).text(n),w(i)}}if(jllickeproSettings.enableCounters){var i=this.getCountLink(this.id,this.linkToShare);if(e.ODKL){var o=ODKL.updateCount;ODKL.updateCount=function(t,e){n(t,e),o(t,e)}}else e.ODKL={updateCount:function(t,e){n(t,e)}};this.id;return t.ajax({url:i,dataType:"jsonp"})}},getShareLink:function(){return"https://connect.ok.ru/offer?url="+this.linkToShare+"&description="+encodeURIComponent(this.summary)},getCountLink:function(t,e){return this.countServiceUrl+t+"&ref="+encodeURIComponent(e)},countServiceUrl:"https://connect.ok.ru/dk?st.cmd=extLike&uid="});var p=function(t,e,n){this.init(t,e,n),this.type="mailButton"};p.prototype=new s,p.prototype=t.extend(p.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){var e=this.id,n=this.getCountLink(this.linkToShare);return t.ajax({url:n,dataType:"jsonp",success:function(n,i,o){if("success"==i&&void 0!==n.share_mm&&n.share_mm>0){var r=t("#"+e);r.addClass("like-not-empty"),t("span.l-count",r).text(n.share_mm),w(r)}}})}},getCountLink:function(t){return this.countServiceUrl+encodeURIComponent(t.replace("http://","").replace("https://",""))},getShareLink:function(){return url="https://connect.mail.ru/share?url="+encodeURIComponent(this.linkToShare)+"&image_url="+encodeURIComponent(this.images[0])+"&title="+encodeURIComponent(this.title)+"&description="+encodeURIComponent(this.summary)},countServiceUrl:"https://appsmail.ru/share/count/"});var d=function(t,e,n){this.init(t,e,n),this.type="linButton"};d.prototype=new s,d.prototype=t.extend(d.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){jllikeproShareUrls.linkedin[this.linkToShare]=this.id,e.setLinkedInCount=function(e){if(jllikeproShareUrls.linkedin.hasOwnProperty(e.url)){var n=jllikeproShareUrls.linkedin[e.url],i=e.count;if(i>0){var o=t("#"+n);o.addClass("like-not-empty"),t("span.l-count",o).text(i),w(o)}}};var n=this.getCountLink(this.linkToShare);return t.ajax({url:n,dataType:"jsonp"})}},getShareLink:function(){return"http://www.linkedin.com/shareArticle?mini=true&ro=false&trk=bookmarklet&url="+this.linkToShare},countServiceUrl:"https://www.linkedin.com/countserv/count/share?&callback=setLinkedInCount&format=jsonp&url="});var f=function(t,e,n){this.init(t,e,n),this.type="pinteresButton"};f.prototype=new s,f.prototype=t.extend(f.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters)return jllikeproShareUrls.pinteres[this.linkToShare]=this.id,e.setPinteresCount=function(e){if(e.hasOwnProperty("count")){if(!jllikeproShareUrls.pinteres.hasOwnProperty(e.url))return;var n=jllikeproShareUrls.pinteres[e.url];if(e.count>0){var i=t("#"+n);i.addClass("like-not-empty"),t("span.l-count",i).text(e.count),w(i)}}},serviceURI=this.getCountLink(this.linkToShare),t.ajax({url:serviceURI,dataType:"jsonp"})},getShareLink:function(){var t=this.images[0]!=i?this.images[0]:"";return"http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(this.linkToShare)+"&media="+t+"&description="+this.summary},countServiceUrl:"https://api.pinterest.com/v1/urls/count.json?callback=setPinteresCount&url="});var m=function(t,e,n){this.init(t,e,n),this.type="livejournal"};m.prototype=new s,m.prototype=t.extend(m.prototype,{countLikes:function(){},getShareLink:function(){return"http://livejournal.com/update.bml?subject="+encodeURIComponent(this.title)+"&event="+encodeURIComponent(''+this.title+" "+this.summary)},countServiceUrl:"http://livejournal.com/"});var k=function(t,e,n){this.init(t,e,n),this.type="Blogger"};k.prototype=new s,k.prototype=t.extend(k.prototype,{countLikes:function(){},getShareLink:function(){return"https://www.blogger.com/blog-this.g?u="+encodeURIComponent(this.linkToShare)+"&n="+encodeURIComponent(this.title)},countServiceUrl:"https://www.blogger.com/"});var g=function(t,e,n){this.init(t,e,n),this.type="Weibo"};g.prototype=new s,g.prototype=t.extend(g.prototype,{countLikes:function(){},getShareLink:function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.linkToShare)+"&title="+encodeURIComponent(this.title)},countServiceUrl:"http://service.weibo.com/"});var v=function(t,e,n){this.init(t,e,n),this.type="Telegram"};v.prototype=new s,v.prototype=t.extend(v.prototype,{countLikes:function(){},getShareLink:function(){return"tg://share?url="+encodeURIComponent(this.linkToShare)+"&text="+encodeURIComponent(this.title)},countServiceUrl:"https://t.me/"});var y=function(t,e,n){this.init(t,e,n),this.type="Whatsapp"};y.prototype=new s,y.prototype=t.extend(y.prototype,{countLikes:function(){},getShareLink:function(){return"https://api.whatsapp.com/send?text="+encodeURIComponent(this.title)+" - "+encodeURIComponent(this.linkToShare)},countServiceUrl:"https://api.whatsapp.com"});var S=function(t,e,n){this.init(t,e,n),this.type="Viber"};S.prototype=new s,S.prototype=t.extend(S.prototype,{countLikes:function(){},getShareLink:function(){return"viber://forward?text="+encodeURIComponent(this.linkToShare)},countServiceUrl:"https://viber.com"});var w=function(e){var n,i=t(e).parents(".jllikeproSharesContayner"),o=i.find("span.l-all-count"),r=0;i.find(".l-count").not(".l-all-count").each(function(){n=t(this).text(),""!=n&&(r+=parseInt(n))}),o.text(r)};t.fn.socialButton=function(e){return this.each(function(n,i){setTimeout(function(){var n=t(i),o=new r(e),a=!1;s.lastIndex++,n.is(o.selectors.facebookButton)?a=new l(n,o,s.lastIndex):n.is(o.selectors.twitterButton)?a=new c(n,o,s.lastIndex):n.is(o.selectors.vkontakteButton)?a=new u(n,o,s.lastIndex):n.is(o.selectors.odnoklassnikiButton)?a=new h(n,o,s.lastIndex):n.is(o.selectors.mailButton)?a=new p(n,o,s.lastIndex):n.is(o.selectors.linButton)?a=new d(n,o,s.lastIndex):n.is(o.selectors.pinteresButton)?a=new f(n,o,s.lastIndex):n.is(o.selectors.LivejournalButton)?a=new m(n,o,s.lastIndex):n.is(o.selectors.BloggerButton)?a=new k(n,o,s.lastIndex):n.is(o.selectors.WeiboButton)?a=new g(n,o,s.lastIndex):n.is(o.selectors.TelegramButton)?a=new v(n,o,s.lastIndex):n.is(o.selectors.WhatsappButton)?a=new y(n,o,s.lastIndex):n.is(o.selectors.ViberButton)&&(a=new S(n,o,s.lastIndex)),t.when(a.ajaxRequest).then(function(){n.trigger("socialButton.done",[a.type])},function(){n.trigger("socialButton.done",[a.type])})},0)}),this},t.scrollToButton=function(n,i){if(!e.location.hash&&e.location.search){var r=o(n);if(r){var s=t("#"+r);s.length>0&&t("html,body").animate({scrollTop:s.offset().top,scrollLeft:s.offset().left},i||1e3)}}return this}}(jQuery,window,document),jQuery(document).ready(function(t){t(".like").socialButton();var e=t("div.jllikeproSharesContayner"),n=jllickeproSettings.buttonsContayner;""!=n&&t(n).length>0&&e.length>0&&0==jllickeproSettings.isCategory&&(e.remove(),t(n).html(e))}); \ No newline at end of file +var socialButtonCountObjects={},jllikeproShareUrls={mail:{},pinteres:{},linkedin:{}};jQuery.noConflict(),function($,w,d,undefined){function getParam(key){if(key){var pairs=top.location.search.replace(/^\?/,"").split("&");for(var i in pairs){var current,match=pairs[i].match(/([^=]*)=(\w*)/);if(match[1]===key)return decodeURIComponent(match[2])}}return!1}var ButtonConfiguration=function(params){return params?$.extend(!0,ButtonConfiguration.defaults,params):ButtonConfiguration.defaults};ButtonConfiguration.defaults={selectors:{facebookButton:".l-fb",twitterButton:".l-tw",vkontakteButton:".l-vk",odnoklassnikiButton:".l-ok",mailButton:".l-ml",linButton:".l-ln",pinteresButton:".l-pinteres",LivejournalButton:".l-lj",BloggerButton:".l-bl",WeiboButton:".l-wb",TelegramButton:".l-tl",WhatsappButton:".l-wa",ViberButton:".l-vi",count:".l-count",ico:".l-ico",shareTitle:"h2:eq(0)",shareSumary:"p:eq(0)",shareImages:"img[src]"},buttonDepth:2,alternativeImage:"",alternativeSummary:"",alternativeTitle:"",forceAlternativeImage:!1,forceAlternativeSummary:!1,forceAlternativeTitle:!1,classes:{countVisibleClass:"like-not-empty"},keys:{shareLinkParam:"href"},popupWindowOptions:["left=0","top=0","width=500","height=400","personalbar=0","toolbar=0","scrollbars=1","resizable=1"]};var Button=function(){};Button.lastIndex=0,Button.prototype={init:function($context,conf,index){this.config=conf,this.index=index,this.id=$($context).attr("id"),this.$context=$context,this.$count=$(this.config.selectors.count,this.$context),this.$ico=$(this.config.selectors.ico,this.$context),this.collectShareInfo(),this.bindEvents(),this.ajaxRequest=this.countLikes()},bindEvents:function(){this.$context.bind("click",Button.returnFalse),this.$ico.parent().bind("click",this,this.openShareWindow)},setCountValue:function(count){this.$context.addClass(this.config.classes.countVisibleClass),this.$count.text(count)},getCountLink:function(url){return this.countServiceUrl+encodeURIComponent(url)},collectShareInfo:function(){var $parent=this.$context,button=this;$parent=jQuery(jllickeproSettings.parentContayner).length>0?$parent.parents(jllickeproSettings.parentContayner).parent():$parent.parents(".jllikeproSharesContayner").parent();var $tmpParent,href=$("input.link-to-share",$parent).val(),title=$("input.share-title",$parent).val(),image=$("input.share-image",$parent).val(),origin=jllickeproSettings.url,$title=$(this.config.selectors.shareTitle,$parent),$summary;if($title.length||($title=$(this.config.selectors.shareTitle,$tmpParent)),($summary=$("input.share-desc",$parent).val()).length||($summary=$(this.config.selectors.shareSumary,$parent).text()),$summary.length||($summary=$parent.text()),$summary.length||($summary=$parent.parent().text()),this.domenhref=w.location.protocol+"//"+w.location.host,this.linkhref=jllickeproSettings.url+w.location.pathname+w.location.search,this.linkToShare=href||this.linkhref,this.title=""!=title?title:$title.text(),this.config.forceAlternativeTitle?this.title=this.config.alternativeTitle:""==this.title&&this.config.alternativeTitle?this.title=this.config.alternativeTitle:""==this.title&&(this.title=d.title),$summary.length>0?this.summary=$summary:this.summary=this.config.alternativeSummary?this.config.alternativeSummary:"",this.summary=this.summary.length>200?cropText(this.summary,200)+"...":this.summary,this.images=[],void 0!==image&&image.length)this.images[0]=image;else{var $images=$(this.config.selectors.shareImages,$parent);if($tmpParent=$parent,!$images.length)for(var $i=0;0==$images.length&&$i<20;)$i++,$tmpParent=$tmpParent.parent(),$images=$(this.config.selectors.shareImages,$tmpParent).not("#waitimg");$images.length>0&!this.config.forceAlternativeImage?($images.each((function(index,element){button.images[index]=element.src})),this.images=button.images):this.images[0]=this.config.alternativeImage?this.config.alternativeImage:void 0}},getPopupOptions:function(){return this.config.popupWindowOptions.join(",")},plusOne:function(){var parent=$("#"+this.id),counter=$("span.l-count",parent),count=counter.text();count=""==count?0:parseInt(count),parent.addClass("like-not-empty"),counter.text(count+1)},disableMoreLikes:function(){if(jllickeproSettings.disableMoreLikes){var parent=$("#"+this.id).parents(".jllikeproSharesContayner"),id=parent.children(".share-id").val(),date=new Date((new Date).getTime()+2592e6);document.cookie="jllikepro_article_"+id+"=1; path=/; expires="+date.toUTCString();var div=$("
").addClass("disable_more_likes");parent.prepend(div)}},openShareWindow:function(e){var button=e.data,shareUri=button.getShareLink(),windowOptions=button.getPopupOptions(),newWindow=w.open(shareUri,"",windowOptions);button.plusOne(),button.disableMoreLikes(),w.focus&&newWindow.focus()},linkToShare:null,title:d.title,summary:null,images:[],countServiceUrl:null,$context:null,$count:null,$ico:null},Button=$.extend(Button,{returnFalse:function(e){return!1}});var cropText=function(text,length){var result="";return text.split(" ").every((function(item){var tmp=$.trim(item);return result.length+tmp.length<=length&&(""!=tmp&&(result+=" "+tmp),!0)})),result},FacebookButton=function($context,conf,index){this.init($context,conf,index),this.type="facebook"};FacebookButton.prototype=new Button,FacebookButton.prototype=$.extend(FacebookButton.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){var serviceURI=this.getCountLink(this.linkToShare),id=this.id;return $.ajax({url:serviceURI,dataType:"jsonp",success:function(data,status,jqXHR){if("success"==status&&void 0!==data.engagement&&void 0!==data.engagement.share_count&&data.engagement.share_count>0){var elem=$("#"+id);elem.addClass("like-not-empty"),$("span.l-count",elem).text(data.engagement.share_count),jllikeproAllCouner(elem)}}})}},getShareLink:function(){var url;return"https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.linkToShare)+"&display=popup"},countServiceUrl:"https://graph.facebook.com/v4.0/?access_token=112243502800823|oj4WG8tofQaE5avNxB86XB4GkLE&fields=engagement&id="});var TwitterButton=function($context,conf,index){this.init($context,conf,index),this.type="twitter"};TwitterButton.prototype=new Button,TwitterButton.prototype=$.extend(TwitterButton.prototype,{countLikes:function(){},getShareLink:function(){var text=cropText(this.summary,140-this.title.length-this.linkToShare.length);return"https://twitter.com/intent/tweet?url="+encodeURIComponent(this.linkToShare)+"&text="+encodeURIComponent(this.title+". "+text)},countServiceUrl:"https://urls.api.twitter.com/1/urls/count.json?url="});var VkontakteButton=function($context,conf,index){this.init($context,conf,index),this.type="vkontakte"};VkontakteButton.prototype=new Button,VkontakteButton.prototype=$.extend(VkontakteButton.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){w.socialButtonCountObjects[this.index]=this;var serviceURI=this.getCountLink(this.linkToShare)+"&index="+this.index;if(void 0===w.VK&&(w.VK={}),void 0===w.VK.Share&&(w.VK.Share={}),void 0===w.VK.Share.count)w.VK.Share.count=function(index,count){vkShare(index,count)};else{var originalVkCount=w.VK.Share.count;w.VK.Share.count=function(index,count){vkShare(index,count),originalVkCount.call(w.VK.Share,index,count)}}return $.ajax({url:serviceURI,dataType:"jsonp"})}function vkShare(index,count){if(count>0){var id=w.socialButtonCountObjects[index].id,elem=$("#"+id);elem.addClass("like-not-empty"),$("span.l-count",elem).text(count),jllikeproAllCouner(elem)}}},getShareLink:function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.linkToShare)},countServiceUrl:"https://vk.com/share.php?act=count&url="});var odnoklassnikiButton=function($context,conf,index){this.init($context,conf,index),this.type="odnoklassniki"};odnoklassnikiButton.prototype=new Button,odnoklassnikiButton.prototype=$.extend(odnoklassnikiButton.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){var serviceURI=this.getCountLink(this.id,this.linkToShare);if(w.ODKL){var originalOdCount=ODKL.updateCount;ODKL.updateCount=function(elementId,count){odklShare(elementId,count),originalOdCount(elementId,count)}}else w.ODKL={updateCount:function(elementId,count){odklShare(elementId,count)}};var id=this.id;return $.ajax({url:serviceURI,dataType:"jsonp"})}function odklShare(elementId,count){if(count>0){var elem=$("#"+elementId);elem.addClass("like-not-empty"),$("span.l-count",elem).text(count),jllikeproAllCouner(elem)}}},getShareLink:function(){return"https://connect.ok.ru/offer?url="+this.linkToShare+"&description="+encodeURIComponent(this.summary)},getCountLink:function(id,linkToShare){return this.countServiceUrl+id+"&ref="+encodeURIComponent(linkToShare)},countServiceUrl:"https://connect.ok.ru/dk?st.cmd=extLike&uid="});var mailButton=function($context,conf,index){this.init($context,conf,index),this.type="mailButton"};mailButton.prototype=new Button,mailButton.prototype=$.extend(mailButton.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){var id=this.id,serviceURI=this.getCountLink(this.linkToShare);return $.ajax({url:serviceURI,dataType:"jsonp",success:function(data,status,jqXHR){if("success"==status&&void 0!==data.share_mm&&data.share_mm>0){var elem=$("#"+id);elem.addClass("like-not-empty"),$("span.l-count",elem).text(data.share_mm),jllikeproAllCouner(elem)}}})}},getCountLink:function(linkToShare){return this.countServiceUrl+encodeURIComponent(linkToShare.replace("http://","").replace("https://",""))},getShareLink:function(){return url="https://connect.mail.ru/share?url="+encodeURIComponent(this.linkToShare)+"&image_url="+encodeURIComponent(this.images[0])+"&title="+encodeURIComponent(this.title)+"&description="+encodeURIComponent(this.summary)},countServiceUrl:"https://appsmail.ru/share/count/"});var linButton=function($context,conf,index){this.init($context,conf,index),this.type="linButton"};linButton.prototype=new Button,linButton.prototype=$.extend(linButton.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters){jllikeproShareUrls.linkedin[this.linkToShare]=this.id,w.setLinkedInCount=function(data){if(jllikeproShareUrls.linkedin.hasOwnProperty(data.url)){var id=jllikeproShareUrls.linkedin[data.url],shares=data.count;if(shares>0){var elem=$("#"+id);elem.addClass("like-not-empty"),$("span.l-count",elem).text(shares),jllikeproAllCouner(elem)}}};var serviceURI=this.getCountLink(this.linkToShare);return $.ajax({url:serviceURI,dataType:"jsonp"})}},getShareLink:function(){return"http://www.linkedin.com/shareArticle?mini=true&ro=false&trk=bookmarklet&url="+this.linkToShare},countServiceUrl:"https://www.linkedin.com/countserv/count/share?&callback=setLinkedInCount&format=jsonp&url="});var pinteresButton=function($context,conf,index){this.init($context,conf,index),this.type="pinteresButton"};pinteresButton.prototype=new Button,pinteresButton.prototype=$.extend(pinteresButton.prototype,{countLikes:function(){if(jllickeproSettings.enableCounters)return jllikeproShareUrls.pinteres[this.linkToShare]=this.id,w.setPinteresCount=function(data){if(data.hasOwnProperty("count")){if(!jllikeproShareUrls.pinteres.hasOwnProperty(data.url))return;var id=jllikeproShareUrls.pinteres[data.url];if(data.count>0){var elem=$("#"+id);elem.addClass("like-not-empty"),$("span.l-count",elem).text(data.count),jllikeproAllCouner(elem)}}},serviceURI=this.getCountLink(this.linkToShare),$.ajax({url:serviceURI,dataType:"jsonp"})},getShareLink:function(){var media=null!=this.images[0]?this.images[0]:"";return"http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(this.linkToShare)+"&media="+media+"&description="+this.summary},countServiceUrl:"https://api.pinterest.com/v1/urls/count.json?callback=setPinteresCount&url="});var LivejournalButton=function($context,conf,index){this.init($context,conf,index),this.type="livejournal"};LivejournalButton.prototype=new Button,LivejournalButton.prototype=$.extend(LivejournalButton.prototype,{countLikes:function(){},getShareLink:function(){return"http://livejournal.com/update.bml?subject="+encodeURIComponent(this.title)+"&event="+encodeURIComponent(''+this.title+" "+this.summary)},countServiceUrl:"http://livejournal.com/"});var BloggerButton=function($context,conf,index){this.init($context,conf,index),this.type="Blogger"};BloggerButton.prototype=new Button,BloggerButton.prototype=$.extend(BloggerButton.prototype,{countLikes:function(){},getShareLink:function(){return"https://www.blogger.com/blog-this.g?u="+encodeURIComponent(this.linkToShare)+"&n="+encodeURIComponent(this.title)},countServiceUrl:"https://www.blogger.com/"});var WeiboButton=function($context,conf,index){this.init($context,conf,index),this.type="Weibo"};WeiboButton.prototype=new Button,WeiboButton.prototype=$.extend(WeiboButton.prototype,{countLikes:function(){},getShareLink:function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.linkToShare)+"&title="+encodeURIComponent(this.title)},countServiceUrl:"http://service.weibo.com/"});var TelegramButton=function($context,conf,index){this.init($context,conf,index),this.type="Telegram"};TelegramButton.prototype=new Button,TelegramButton.prototype=$.extend(TelegramButton.prototype,{countLikes:function(){},getShareLink:function(){return"tg://share?url="+encodeURIComponent(this.linkToShare)+"&text="+encodeURIComponent(this.title)},countServiceUrl:"https://t.me/"});var WhatsappButton=function($context,conf,index){this.init($context,conf,index),this.type="Whatsapp"};WhatsappButton.prototype=new Button,WhatsappButton.prototype=$.extend(WhatsappButton.prototype,{countLikes:function(){},getShareLink:function(){return"https://api.whatsapp.com/send?text="+encodeURIComponent(this.title)+" - "+encodeURIComponent(this.linkToShare)},countServiceUrl:"https://api.whatsapp.com"});var ViberButton=function($context,conf,index){this.init($context,conf,index),this.type="Viber"};ViberButton.prototype=new Button,ViberButton.prototype=$.extend(ViberButton.prototype,{countLikes:function(){},getShareLink:function(){return"viber://forward?text="+encodeURIComponent(this.linkToShare)},countServiceUrl:"https://viber.com"});var jllikeproAllCouner=function(element){var parent=$(element).parents(".jllikeproSharesContayner"),counterSpan=parent.find("span.l-all-count"),counterValue=0,tmpVal;parent.find(".l-count").not(".l-all-count").each((function(){""!=(tmpVal=$(this).text())&&(counterValue+=parseInt(tmpVal))})),counterSpan.text(counterValue)};$.fn.socialButton=function(config){return this.each((function(index,element){setTimeout((function(){var $element=$(element),conf=new ButtonConfiguration(config),b=!1;Button.lastIndex++,$element.is(conf.selectors.facebookButton)?b=new FacebookButton($element,conf,Button.lastIndex):$element.is(conf.selectors.twitterButton)?b=new TwitterButton($element,conf,Button.lastIndex):$element.is(conf.selectors.vkontakteButton)?b=new VkontakteButton($element,conf,Button.lastIndex):$element.is(conf.selectors.odnoklassnikiButton)?b=new odnoklassnikiButton($element,conf,Button.lastIndex):$element.is(conf.selectors.mailButton)?b=new mailButton($element,conf,Button.lastIndex):$element.is(conf.selectors.linButton)?b=new linButton($element,conf,Button.lastIndex):$element.is(conf.selectors.pinteresButton)?b=new pinteresButton($element,conf,Button.lastIndex):$element.is(conf.selectors.LivejournalButton)?b=new LivejournalButton($element,conf,Button.lastIndex):$element.is(conf.selectors.BloggerButton)?b=new BloggerButton($element,conf,Button.lastIndex):$element.is(conf.selectors.WeiboButton)?b=new WeiboButton($element,conf,Button.lastIndex):$element.is(conf.selectors.TelegramButton)?b=new TelegramButton($element,conf,Button.lastIndex):$element.is(conf.selectors.WhatsappButton)?b=new WhatsappButton($element,conf,Button.lastIndex):$element.is(conf.selectors.ViberButton)&&(b=new ViberButton($element,conf,Button.lastIndex)),$.when(b.ajaxRequest).then((function(){$element.trigger("socialButton.done",[b.type])}),(function(){$element.trigger("socialButton.done",[b.type])}))}),0)})),this},$.scrollToButton=function(hashParam,duration){if(!w.location.hash&&w.location.search){var currentHash=getParam(hashParam);if(currentHash){var $to=$("#"+currentHash);$to.length>0&&$("html,body").animate({scrollTop:$to.offset().top,scrollLeft:$to.offset().left},duration||1e3)}}return this}}(jQuery,window,document),jQuery(document).ready((function($){$(".like").socialButton();var likes=$("div.jllikeproSharesContayner"),contayner=jllickeproSettings.buttonsContayner;""!=contayner&&$(contayner).length>0&&likes.length>0&&0==jllickeproSettings.isCategory&&(likes.remove(),$(contayner).html(likes))})); \ No newline at end of file diff --git a/pkg_jllike.xml b/pkg_jllike.xml index 0d7fac8..4bf583c 100644 --- a/pkg_jllike.xml +++ b/pkg_jllike.xml @@ -3,12 +3,12 @@ JL Like jllike JoomLine - 11.02.2020 + 29.11.2020 (C) 2012-2020 by Artem Zhukov, Arkadiy Sedelnikov and Vadim Kunicin(https://joomline.ru) GNU/GPL: http://www.gnu.org/copyleft/gpl.html sale@joomline.ru https://joomline.ru - 4.0.4 + 4.0.5 https://joomline.ru JoomLine.ru https://joomline.ru