Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GitHub extension

  • Loading branch information...
commit 403ca638d8833b3f5b20a4d2336e22139f6ea033 1 parent 45a1ba4
@dbushell dbushell authored
Showing with 60 additions and 1 deletion.
  1. +3 −1 README.md
  2. +57 −0 extensions/socialite.github.js
View
4 README.md
@@ -28,7 +28,7 @@ Supported widgets are currently:
* Facebook: `facebook-like`
* Twitter: `twitter-share`, `twitter-follow`, `twitter-mention`, `twitter-hashtag` and `twitter-embed` (for individual tweets)
-* Google+: `googleplus-one`, `googleplus-share`
+* Google+: `googleplus-one`, `googleplus-share`, `googleplus-badge`
* LinkedIn: `linkedin-share`, `linkedin-recommend`
Also available as extensions:
@@ -36,6 +36,7 @@ Also available as extensions:
* Pinterest: `pinterest-pinit`
* Spotify: `spotify-play`
* Hacker News: `hackernews-share`
+* GitHub: `github-watch`, `github-fork`, `github-follow`
For all individual button configurations visit [Twitter](https://twitter.com/about/resources/buttons/), [Google+](https://developers.google.com/+/plugins/+1button/), [Facebook](http://developers.facebook.com/docs/reference/plugins/like/), [LinkedIn](http://developer.linkedin.com/plugins/share-button/), [Pinterest](http://pinterest.com/about/goodies/), and [Spotify](https://developer.spotify.com/technologies/spotify-play-button/). **Important:** don't include the scripts provided by these networks, Socialite does that for you! Include socialite.js right at the end of your document and activate with the options below.
@@ -138,6 +139,7 @@ Thanks,
### 2.0.3 - 11th June 2012
+* added [GitHub Buttons](http://markdotto.github.com/github-buttons/) extension
* Google+ `window.gapi.render()` now used on inner gplus div to avoid inline styles on the `socialite` element
### 2.0.2 - 10th June 2012
View
57 extensions/socialite.github.js
@@ -0,0 +1,57 @@
+/*!
+ * Socialite v2.0 - GitHub 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://markdotto.github.com/github-buttons/
+ // https://github.com/markdotto/github-buttons/
+
+ Socialite.network('github');
+
+ // github.size[size][type][has_count][dimension]
+ Socialite.setup({
+ github: {
+ size: [
+ {
+ watch : [ [ 62,20], [110,20] ],
+ fork : [ [ 53,20], [ 95,20] ],
+ follow : [ [150,20], [200,20] ]
+ },
+ {
+ watch : [ [100,30], [170,30] ],
+ fork : [ [80, 30], [155,30] ],
+ follow : [ [200,30], [300,30] ]
+ }
+ ]
+ }
+ });
+
+ var initGitHub = function(instance)
+ {
+ var type = instance.el.getAttribute('data-type'),
+ size = instance.el.getAttribute('data-size') === 'large' ? 1 : 0,
+ count = instance.el.getAttribute('data-count') === 'true' ? 1 : 0,
+ data = Socialite.settings.github.size;
+
+ type = (type && data[size].hasOwnProperty(type)) ? type : 'watch';
+
+ instance.el.setAttribute('data-type', type);
+ instance.el.setAttribute('data-count', !!count);
+
+ Socialite.processInstance(instance);
+ var src = 'http://markdotto.github.com/github-buttons/github-btn.html?' + Socialite.getDataAttributes(instance.el, true);
+ var iframe = Socialite.createIframe(src, instance);
+ iframe.style.width = data[size][type][count][0] + 'px';
+ iframe.style.height = data[size][type][count][1] + 'px';
+ instance.el.appendChild(iframe);
+ Socialite.activateInstance(instance);
+ };
+
+ Socialite.widget('github', 'watch', { process: null, init: initGitHub });
+ Socialite.widget('github', 'fork', { process: null, init: initGitHub });
+ Socialite.widget('github', 'follow', { process: null, init: initGitHub });
+
+})(window, window.document, window.Socialite);
Please sign in to comment.
Something went wrong with that request. Please try again.