How to add buttons to share in social networks VK and OK?
1 Like
You can also try
<script type="text/discourse-plugin" version="0.4">
api.decorateWidget('topic-map:before', dec => {
const link = window.location.href;
const urlfb = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(link);
const urlok = "http://www.ok.ru/dk?st.cmd=addShare&st.s=1&st._surl=" + encodeURIComponent(link);
const urlvk = "https://vk.com/share.php?url=" + encodeURIComponent(link);
return dec.rawHtml(`
<div class="test"><a class="fb" href="${urlfb}" target="_blank"><i class="fa fa-facebook fa-lg" aria-hidden="true"></i></a>
<a class="ok" href="${urlok}" target="_blank"><i class="fa fa-odnoklassniki fa-lg" aria-hidden="true"></i></a>
<a class="vk" href="${urlvk}" target="_blank"><i class="fa fa-vk fa-lg" aria-hidden="true"></i></a>
</div>`);
});
</script>
CSS -
.test {
display: inline-block;
margin-top: -50px;
position: absolute;
}
.test a.ok{
margin-left: 15px;
margin-right: 15px;
}
.test a{color: #999;}
.test a:hover{color: #666;}
I tried it, do not know right or wrong. Div are, you can change the design as you wish…
1 Like
The theme component to add an extra social button is now ready
6 Likes
This topic was automatically closed after 5 hours. New replies are no longer allowed.