Permalink
Browse files

bufferapp extension

  • Loading branch information...
dbushell committed Jun 9, 2012
1 parent 1cd1139 commit 161e860f36482d91a59b908f57124f7843bc05fb
Showing with 42 additions and 0 deletions.
  1. +42 −0 extensions/socialite.bufferapp.js
@@ -0,0 +1,42 @@
+/*!
+ * Socialite v2.0 - Bufferapp extension
+ * http://socialitejs.com
+ * Copyright (c) 2011 David Bushell
+ * Dual-licensed under the BSD or MIT licenses: http://socialitejs.com/license.txt
+ */
+(function(window, document, Socialite, undefined)
+{
+ // http://bufferapp.com/extras/button
+
+ Socialite.network('bufferapp', {
+ script: {
+ src: '//static.bufferapp.com/js/button.js'
+ }
+ });
+
+ Socialite.widget('bufferapp', 'button', {
+ reappend: null,
+ init: function(instance)
+ {
+ var el = document.createElement('a');
+ el.className = 'buffer-add-button';
+ Socialite.copyDataAttributes(instance.el, el);
+ el.setAttribute('href', instance.el.getAttribute('data-default-href'));
+ instance.el.appendChild(el);
+ },
+ activate: function(instance)
+ {
+ var w = instance.widget,
+ n = w.network.name;
+ if (Socialite.networkReady(n)) {
+ if (w.reappend) {
+ clearTimeout(w.reappend);
+ }
+ w.reappend = setTimeout(function() {
+ Socialite.reloadNetwork(n);
+ }, 50);
+ }
+ }
+ });
+
+})(window, window.document, window.Socialite);

0 comments on commit 161e860

Please sign in to comment.