Created
September 22, 2012 17:24
-
-
Save rpearce/3766937 to your computer and use it in GitHub Desktop.
AddThis Static, Provided Solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
events: { | |
'click .facebook-share' : 'postToFeed', | |
}, | |
postToFeed: function() { | |
FB.init({appId: fb_app_id, status: true, cookie: true}); | |
// calling the API ... | |
var obj = { | |
method: 'feed', | |
link: 'http://www.google.com', | |
picture: 'http://athena.cornell.edu/images/rovers/rover_sundial.jpg', | |
name: 'My text about ' + this.model.get('something_interesting'), | |
caption: '', | |
description: 'Sweet! This is so great and about something interesting!', | |
redirect_uri: 'your redirect URI' | |
}; | |
var self = this; | |
FB.ui(obj, function(response) { | |
self.callback(response); | |
}); | |
}, | |
callback: function(response) { | |
// callback where you do something with the response | |
} | |
// ... | |
var fb_app_id = 'your facebook application id'; | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GeneralMixins = { | |
preventHref: function(e) { | |
e.preventDefault(); | |
} | |
}; | |
// ... | |
// note: the view is titled ShareLinks | |
// ... | |
events: { | |
'click .facebook-share' : 'postToFeed', | |
'click a[href="#"]' : 'preventHref' | |
} | |
// ... | |
_.extend(ShareLinks.prototype, GeneralMixins); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- AddThis Button BEGIN --> | |
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"> | |
<a class="addthis_button_preferred_1"></a> | |
<a class="addthis_button_preferred_2"></a> | |
<a class="addthis_button_preferred_3"></a> | |
<a class="addthis_button_preferred_4"></a> | |
<a class="addthis_button_compact"></a> | |
<a class="addthis_counter addthis_bubble_style"></a> | |
</div> | |
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=xa-505de6c2446fedb4"></script> | |
<!-- AddThis Button END --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.facebook-share { float: left; } | |
.facebook-share:hover { | |
-khtml-opacity: 0.7; | |
-moz-opacity: 0.7; | |
opacity: 0.7; | |
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=(70)); | |
} | |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" | |
addthis:url="http://starvingdeveloper.wordpress.com" | |
addthis:title="My custom title!" | |
addthis:description="Sweet! This is my default text about <%= item.get('something_interesting') %>!"> | |
<a class="addthis_button_facebook"></a> | |
<a class="addthis_button_twitter" | |
addthis:title="Sweet! This is my custom Twitter text about <%= item.get('something_interesting') %>!"></a> | |
<a class="addthis_button_linkedin" | |
addthis:description="Sweet! This is my custom LinkedIn text about <%= item.get('something_interesting') %>!"></a> | |
<a class="addthis_button_email"></a> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" | |
addthis:url="http://starvingdeveloper.wordpress.com" | |
addthis:title="My custom title!" | |
addthis:description="Sweet! This is my default text about <%= item.get('something_interesting') %>!"> | |
<div id='fb-root'></div> | |
<a class="facebook-share" href="javascript:void(0)"> | |
<img src="http://starvingdeveloper.files.wordpress.com/2012/09/addthis-facebook.png" /> | |
</a> | |
<a class="addthis_button_twitter" | |
addthis:title="Sweet! This is my custom Twitter text about <%= item.get('something_interesting') %>!"></a> | |
<a class="addthis_button_linkedin" | |
addthis:description="Sweet! This is my custom LinkedIn text about <%= item.get('something_interesting') %>!"></a> | |
<a class="addthis_button_email"></a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment