Skip to content

Commit

Permalink
Added DZone submit button
Browse files Browse the repository at this point in the history
  • Loading branch information
samaxes committed May 15, 2013
1 parent bd9f83b commit a7847c6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Also available as extensions:
* Spotify: `spotify-play`
* Hacker News: `hackernews-share`
* GitHub: `github-watch`, `github-fork`, `github-follow`
* DZone: `dzone-submit`

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.

Expand Down
40 changes: 40 additions & 0 deletions extensions/socialite.dzone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*!
* Socialite v2.0 - DZone extension
* http://socialitejs.com
* Copyright (c) 2013 Samuel Santos
* Dual-licensed under the BSD or MIT licenses: http://socialitejs.com/license.txt
*/
(function(window, document, Socialite, undefined) {
// http://www.dzone.com/buttons

Socialite.network('dzone');

Socialite.widget('dzone', 'submit', {
process: null,
init: function(instance) {
Socialite.processInstance(instance);
var src = 'http://widgets.dzone.com/links/widgets/zoneit.html?',
data = {
t : instance.el.getAttribute('data-style') || '1',
url : instance.el.getAttribute('data-url') || location.href,
title : instance.el.getAttribute('data-title') || document.title,
description : instance.el.getAttribute('data-description') || ''
}
params = [];

for (var a in data) {
params.push(a + '=' + encodeURIComponent(data[a] || ''));
}

src += params.join('&') + '&';

var iframe = Socialite.createIframe(src, instance);
iframe.style.width = ((data.t == '2') ? 155 : 50) + 'px';
iframe.style.height = ((data.t == '2') ? 25 : 70) + 'px';
instance.el.appendChild(iframe);

Socialite.activateInstance(instance);
}
});

})(window, window.document, window.Socialite);

0 comments on commit a7847c6

Please sign in to comment.