Browse files

use active to render HN widgets

  • Loading branch information...
1 parent a8cfdef commit 73d7d945110fcf7a2a1f81a517755d9f06c17a60 @igrigorik igrigorik committed Jun 10, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 extensions/socialite.hackernews.js
View
16 extensions/socialite.hackernews.js
@@ -1,5 +1,7 @@
+//
// Hacker News
// https://github.com/igrigorik/hackernews-button
+//
(function(window, document, Socialite, undefined)
{
@@ -9,14 +11,20 @@
}
});
- var hackernewsInit = function(instance)
- {
+ var hackernewsInit = function(instance) {
var el = document.createElement('a');
el.className = 'hn-share-button';
Socialite.copyDataAttributes(instance.el, el);
instance.el.appendChild(el);
};
- Socialite.widget('hackernews', 'share', { init: hackernewsInit });
+ Socialite.widget('hackernews', 'share', {
+ init: hackernewsInit,
+ activate: function(instance) {
+ if (window.HN) {
+ window.HN.render(instance.el);
+ }
+ }
+ });
-})(window, window.document, window.Socialite);
+})(window, window.document, window.Socialite);

0 comments on commit 73d7d94

Please sign in to comment.