Advertisement
Guest User

Untitled

a guest
May 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Outputting div
  2. <div class="postButtons pw-server-widget" data-id="wid-oq19btvv"></div>
  3.  
  4. // Post's JS is included with PHP, but here's the jist of it:
  5. $js = <<<JS
  6.     (function () {
  7.       var s = document.createElement("script");
  8.       s.type = "text/javascript";
  9.       s.async = true;
  10.       s.src = ('https:' == document.location.protocol ? 'https://s' : 'http://i')
  11.         + '.po.st/static/v4/post-widget.js#publisherKey=$pub_key';
  12.       var x = document.getElementsByTagName("script")[0];
  13.       x.parentNode.insertBefore(s,x);
  14.     })();
  15. JS;
  16.  
  17. // This is just me testing out some of the JS methods, is this on the right track?
  18. // The setTimeout is just for testing.
  19. setTimeout(function () {
  20.   window.postPlatform.init('.pw-server-widget');
  21.     console.log(window.postPlatform, 'window.postPlatform');
  22. }, 2000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement