Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
propublica.views.chiclets = propublica.View.extend({
cssClass : 'social-module',
init: function(attrs){
this.url = window.PP_SHARING_URL || window.location.href;
this._super(attrs);
},
render : function(){
this.digg();
this.facebook();
_.delay(_.bind(this.twitter, this));
this.buzz();
},
facebook : function(){
var el = this.el.find('li.fb-link');
el.html('<iframe src="http://www.facebook.com/plugins/like.php?href='+escape(this.url)+'&amp;layout=button_count&amp;show_faces=true&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>');
},
digg : function(){
var diggEl = propublica.utils.begat('a', {'class': 'digg-link', 'href':'http://digg.com/submit?style=no'});
diggEl.addClass('DiggThisButton').addClass('DiggIcon');
this.el.find('li.digg-link').append(diggEl);
var diggScript = propublica.utils.begat('script', {
type : 'text/javascript',
async : 'true',
src : 'http://widgets.digg.com/buttons.js'
});
$("script").eq(0).before(diggScript);
},
twitter : function(){
window.tweetmeme_style = 'compact';
var el = this.el.find('li.tw-link');
el.writeCapture().html('<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>',{writeOnGetElementById : true});
},
buzz : function(){
var el = this.el.find('li.buzz-link');
window.yahooBuzzBadgeType = 'text-votes';
el.writeCapture().html('<script type="text/javascript" src="http://d.yimg.com/ds/badge2.js"></script>',{writeOnGetElementById : true});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.