3 lines
2.4 KiB
JavaScript
3 lines
2.4 KiB
JavaScript
|
/*! shareon v1.6.3 */
|
||
|
var shareon=function(){"use strict";var t={facebook:function(t){return"https://www.facebook.com/sharer/sharer.php?u="+t.url},linkedin:function(t){return"https://www.linkedin.com/sharing/share-offsite/?url="+t.url},mastodon:function(t){return"https://toot.kytta.dev/?text="+t.title+"%0D%0A"+t.url+(t.text?"%0D%0A%0D%0A"+t.text:"")+(t.via?"%0D%0A%0D%0A"+t.via:"")},messenger:function(t){return"https://www.facebook.com/dialog/send?app_id="+t.fbAppId+"&link="+t.url+"&redirect_uri="+t.url},odnoklassniki:function(t){return"https://connect.ok.ru/offer?url="+t.url+"&title="+t.title+(t.media?"&imageUrl="+t.media:"")},pinterest:function(t){return"https://pinterest.com/pin/create/button/?url="+t.url+"&description="+t.title+(t.media?"&media="+t.media:"")},pocket:function(t){return"https://getpocket.com/edit.php?url="+t.url},reddit:function(t){return"https://www.reddit.com/submit?title="+t.title+"&url="+t.url},telegram:function(t){return"https://telegram.me/share/url?url="+t.url+(t.text?"&text="+t.text:"")},twitter:function(t){return"https://twitter.com/intent/tweet?url="+t.url+"&text="+t.title+(t.via?"&via="+t.via:"")},viber:function(t){return"viber://forward?text="+t.title+"%0D%0A"+t.url+(t.text?"%0D%0A%0D%0A"+t.text:"")},vkontakte:function(t){return"https://vk.com/share.php?url="+t.url+"&title="+t.title+(t.media?"&image="+t.media:"")},whatsapp:function(t){return"https://wa.me/?text="+t.title+"%0D%0A"+t.url+(t.text?"%0D%0A%0D%0A"+t.text:"")}},e=function(){for(var e=document.getElementsByClassName("shareon"),r=0;r<e.length;r+=1)for(var n=e[r],i=0;i<n.children.length;i+=1){var a=n.children[i];if(a)for(var o=a.classList.length,u=0;u<o;u+=1){var l=a.classList.item(u);if(Object.prototype.hasOwnProperty.call(t,l)){var s={url:encodeURIComponent(a.dataset.url||n.dataset.url||window.location.href),title:encodeURIComponent(a.dataset.title||n.dataset.title||document.title),media:encodeURIComponent(a.dataset.media||n.dataset.media||""),text:encodeURIComponent(a.dataset.text||n.dataset.text||""),via:encodeURIComponent(a.dataset.via||n.dataset.via||""),fbAppId:encodeURIComponent(a.dataset.fbAppId||n.dataset.fbAppId||"")},d=t[l](s);if("a"===a.tagName.toLowerCase())a.setAttribute("href",d),a.setAttribute("rel","noopener noreferrer"),a.setAttribute("target","_blank");else{a.addEventListener("click",function(t){return function(){window.open(t,"_blank","noopener,noreferrer")}}(d))}break}}}};return window.onload=function(){e()},e}();
|