social-likes-nojq/dist/social-likes.min.js

2 lines
12 KiB
JavaScript
Raw Permalink Normal View History

2016-05-01 14:41:03 +03:00
/*! Social Likes v3.1.0 by Artem Sapegin / Vitaliy Filippov no-jquery - http://github.com/vitalif/social-likes - Licensed MIT */
2016-05-03 10:14:18 +03:00
!function(){"use strict";function a(a,b,c){for(var d=-1,e=!1;-1!=(d=a.className.indexOf(b,d+1));)d&&!/\s/.exec(a.className.charAt(d-1))||d!=a.className.length-b.length&&!/\s/.exec(a.className.charAt(d+b.length))||(e=!0,c&&(a.className=a.className.substr(0,d-1)+a.className.substr(d+b.length)));return e}function b(a,b,c){var d=document.createElement("script");d.type="text/javascript",d.src=a,d.onreadystatechange=function(){"complete"==d.readyState?b&&b():"loaded"==d.readyState&&(d.children,"loading"==d.readyState&&c&&c()),d.parentNode&&d.parentNode.removeChild(d),d=null},d.onload=function(){b&&b(),d.parentNode&&d.parentNode.removeChild(d),d=null},d.onerror=function(){c&&c(),d.parentNode&&d.parentNode.removeChild(d),d=null};var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(d)}function c(){for(var a={},b=document.getElementsByTagName("meta"),c=0;c<b.length;c++){var d=b[c].getAttribute("property");d&&"og:"==d.substr(0,3)&&(a[d.substr(3)]=b[c].getAttribute("content"))}return a}function d(a,b){this.container=a,this.options=b,this.init()}function e(a,b){this.widget=a,this.options={};for(var c in b)this.options[c]=b[c];this.detectService(),this.service&&this.init()}function f(a,b){function c(a,b){return b.toUpper()}for(var d={},e=0;e<a.attributes.length;e++){var f=a.attributes[e].name;if("data-"==f.substr(0,5)){f=f.substr(5);var g=a.attributes[e].value;"yes"===g?g=!0:"no"===g&&(g=!1),d[b?f:f.replace(/-(\w)/g,c)]=g}}return d}function g(a,b){return h(a,b,encodeURIComponent)}function h(a,b,c){return a.replace(/\{([^\}]+)\}/g,function(a,d){return d in b?c?c(b[d]):b[d]:a})}function i(a,b){var c=m+a;return c+" "+c+"_"+b}function j(b,c){function d(e){if("keydown"!==e.type||27===e.which){for(var f=e;f&&f!=b;f=f.parentNode);f!=b&&(a(b,n,!0),removeListener(document,"click",d),removeListener(document,"touchstart",d),removeListener(document,"keydown",d),c())}}addListener(document,"click",d),addListener(document,"touchstart",d),addListener(document,"keydown",d)}function k(a){var b=10;if(document.documentElement.getBoundingClientRect){var c=parseInt(a.style.left,10),d=parseInt(a.style.top,10),e=a[0].getBoundingClientRect();e.left<b?a.stype.left=b-e.left+c+"px":e.right>window.innerWidth-b&&(a.style.left=window.innerWidth-e.right-b+c+"px"),e.top<b?a.style.top=b-e.top+d+"px":e.bottom>window.innerHeight-b&&(a.style.top=window.innerHeight-e.bottom-b+d+"px")}a.className+=" "+n}var l="social-likes",m=l+"__",n=l+"_opened",o="https:"===location.protocol?"https:":"http:",p={facebook:{counterUrl:"https://graph.facebook.com/fql?q=SELECT+total_count+FROM+link_stat+WHERE+url%3D%22{url}%22&callback=?",convertNumber:function(a){return a.data[0].total_count},popupUrl:"https://www.facebook.com/sharer/sharer.php?u={url}",popupWidth:600,popupHeight:359},twitter:{popupUrl:"https://twitter.com/intent/tweet?url={url}&text={title}",popupWidth:600,popupHeight:250,click:function(){return/[\.\?:\-–—]\s*$/.test(this.options.title)||(this.options.title+=":"),!0}},mailru:{counterUrl:o+"//connect.mail.ru/share_count?url_list={url}&callback=1&func=?",convertNumber:function(a){for(var b in a)if(a.hasOwnProperty(b))return a[b].shares},popupUrl:"https://connect.mail.ru/share?share_url={url}&title={title}&image_url={image}",popupWidth:492,popupHeight:500},vkontakte:{counterUrl:"https://vk.com/share.php?act=count&url={url}&index={index}",counter:function(a,c){var d=p.vkontakte;d._||(d._=[],window.VK||(window.VK={}),window.VK.Share={count:function(a,b){d._[a].resolve(b)}});var e=d._.length;d._.push(c),b(g(a,{index:e}),null,function(){c.reject()})},popupUrl:"https://vk.com/share.php?url={url}&title={title}&image={image}",popupWidth:655,popupHeight:450},odnoklassniki:{counterUrl:o+"//connect.ok.ru/dk?st.cmd=extLike&ref={url}&uid={index}",counter:function(a,c){var d=p.odnoklassniki;d._||(d._=[],window.ODKL||(window.ODKL={}),window.ODKL.updateCount=function(a,b){d._[a].resolve(b)});var e=d._.length;d._.push(c),b(g(a,{index:e}),null,function(){c.reject()})},popupUrl:"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&service=odnoklassniki&st.shareUrl={url