NikolayRys / Likely

The social sharing buttons that aren’t shabby
ISC License
395 stars 61 forks source link

кнопка постила с postila.ru #191

Closed MilaFabio closed 4 years ago

MilaFabio commented 4 years ago

Может, кто подскажет, как добавить кнопку для репоста в postila.ru, чтоб было гармонично с likely?

на сайте у них (https://postila.ru/page/button) такой код:

< a href="javascript:void((function(){if(document.pnctLoadStarted)return;var%20d=document.createElement('div');d.setAttribute('id','pnctPreloader');d.setAttribute('style','position:fixed;top:0;bottom:0;left:0;right:0;z-index:100501;background-color:rgba(255,255,255,.9);padding:20px;text-align:center;font-family:helvetica;font-size:20px;font-weight:bold;');d.innerHTML='%3C%3F%3DYii%3A%3At%28%22uniprogy%22%2C+%22Loading%22%29%3F%3E...<a%20id=&quot;pnctCancelBtn&quot;%20href=&quot;#&quot;%20style=&quot;float:right;width:24px;height:24px;text-decoration:none;border:1px%20solid%20#ccc;border-radius:5px&quot;>< img src=&quot;//postila.ru/images/window_close.png&quot; alt=&quot;x&quot;/></a>';document.body.appendChild(d);document.pnctLoadStarted=(new%20Date()).getTime();document.pnctCnclLoad=function(){document.pnctLoadStarted=0;pl=document.getElementById('pnctPreloader');if(pl)pl.parentNode.removeChild(pl)};document.getElementById('pnctCancelBtn').addEventListener('click',function(e){e.preventDefault();document.pnctCnclLoad()});setTimeout(function(){var%20st=document.pnctLoadStarted;if(st>0&amp;&amp;((new%20Date()).getTime()-st>=14000)){document.pnctCnclLoad();alert('%3C%3F%3DYii%3A%3At%28%22uniprogy%22%2C+%22Unfortunately%2C+the+image+search+is+not+available.%22%29%3F%3E')}},15000);var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//postila.ru/post.js?ver=1&m=b&rnd='+Math.random()*99999999);document.body.appendChild(e)})());">< img alt="" border="0" src="http://postila.ru/images/buttons/32x32.png" /></a>

NikolayRys commented 4 years ago

Hello, we plan to add support for custom buttons and a proper guide on how to do it a button in version 3.0, which will be released sometime later this year.

Here's a quick and dirty way. Place it inside the top likely block:

<div class="likely__widget" >
    <a class="likely__button" style="color:black" href="javascript:void((function(){if(document.pnctLoadStarted)return;var%20d=document.createElement('div');d.setAttribute('id','pnctPreloader');d.setAttribute('style','position:fixed;top:0;bottom:0;left:0;right:0;z-index:100501;background-color:rgba(255,255,255,.9);padding:20px;text-align:center;font-family:helvetica;font-size:20px;font-weight:bold;');d.innerHTML='%3C%3F%3DYii%3A%3At%28%22uniprogy%22%2C+%22Loading%22%29%3F%3E...<a%20id=&quot;pnctCancelBtn&quot;%20href=&quot;#&quot;%20style=&quot;float:right;width:24px;height:24px;text-decoration:none;border:1px%20solid%20#ccc;border-radius:5px&quot;><img src=&quot;//postila.ru/images/window_close.png&quot; alt=&quot;x&quot;/></a>';document.body.appendChild(d);document.pnctLoadStarted=(new%20Date()).getTime();document.pnctCnclLoad=function(){document.pnctLoadStarted=0;pl=document.getElementById('pnctPreloader');if(pl)pl.parentNode.removeChild(pl)};document.getElementById('pnctCancelBtn').addEventListener('click',function(e){e.preventDefault();document.pnctCnclLoad()});setTimeout(function(){var%20st=document.pnctLoadStarted;if(st>0&amp;&amp;((new%20Date()).getTime()-st>=14000)){document.pnctCnclLoad();alert('%3C%3F%3DYii%3A%3At%28%22uniprogy%22%2C+%22Unfortunately%2C+the+image+search+is+not+available.%22%29%3F%3E')}},15000);var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//postila.ru/post.js?ver=1&amp;m=b&amp;rnd='+Math.random()*99999999);document.body.appendChild(e)})());"><img class="likely__icon" alt="" border="0" src="http://postila.ru/images/buttons/16x16.png"> Post
</a>
</div>

Here's what I get: image

NikolayRys commented 4 years ago

Closing because of inactivity.