|
<div class="share-buttons"> |
|
<a class="share-btn-fb" href="http://www.facebook.com/sharer/sharer.php?s=100&p%5Btitle%5D=<?=get_the_title($id)?>&p%5Bsummary%5D=DESC&p%5Burl%5D=<?=$actual_link?>&p%5Bimages%5D%5B0%5D=<?=wp_get_attachment_image_src( get_post_thumbnail_id($id), 'medium' )[0]?>" onclick="return !window.open(this.href, 'Facebook', 'width=640,height=580')"> |
|
<div class="facebook share-block"> |
|
<i class="fa fa-facebook" aria-hidden="true"></i> |
|
</div> |
|
</a> |
|
<a href="http://vk.com/share.php?url=<?=$actual_link?>&title=<?=get_the_title($id)?>&description=<?=get_the_excerpt($id)?>&image=<?=wp_get_attachment_image_src( get_post_thumbnail_id($id), 'medium' )[0]?>&noparse=true" target="_blank" onclick="return Share.me(this);"> |
|
<div class="vk share-block"> |
|
<i class="fa fa-vk" aria-hidden="true"></i> |
|
</div> |
|
</a> |
|
<a href="https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ffiddle.jshell.net%2F_display%2F&text=<?=get_the_title($id)?>&url=<?=$actual_link?>" target="_blank" onclick="return Share.me(this)"> |
|
<div class="twitter share-block"> |
|
<i class="fa fa-twitter" aria-hidden="true"></i> |
|
</div> |
|
</a> |
|
</div> |
|
<script> |
|
$(function () { |
|
$('.share-block').on({ |
|
mouseenter: function () { |
|
$(this).width(55); |
|
}, |
|
mouseleave: function () { |
|
$(this).width(45); |
|
} |
|
}); |
|
|
|
Share = { |
|
vkontakte: function(purl, ptitle, pimg, text) { |
|
url = 'http://vkontakte.ru/share.php?'; |
|
url += 'url=' + encodeURIComponent(purl); |
|
url += '&title=' + encodeURIComponent(ptitle); |
|
url += '&description=' + encodeURIComponent(text); |
|
url += '&image=' + encodeURIComponent(pimg); |
|
url += '&noparse=true'; |
|
Share.popup(url); |
|
}, |
|
facebook: function(purl, ptitle, pimg, text) { |
|
url = 'http://www.facebook.com/sharer.php?s=100'; |
|
url += '&p[title]=' + encodeURIComponent(ptitle); |
|
url += '&p[summary]=' + encodeURIComponent(text); |
|
url += '&p[url]=' + encodeURIComponent(purl); |
|
url += '&p[images][0]=' + encodeURIComponent(pimg); |
|
Share.popup(url); |
|
}, |
|
twitter: function(purl, ptitle) { |
|
url = 'http://twitter.com/share?'; |
|
url += 'text=' + encodeURIComponent(ptitle); |
|
url += '&url=' + encodeURIComponent(purl); |
|
url += '&counturl=' + encodeURIComponent(purl); |
|
Share.popup(url); |
|
}, |
|
|
|
me : function(el){ |
|
console.log(el.href); |
|
Share.popup(el.href); |
|
return false; |
|
}, |
|
|
|
popup: function(url) { |
|
window.open(url,'','toolbar=0,status=0,width=626,height=436'); |
|
} |
|
}; |
|
|
|
}); |