Skip to content

Instantly share code, notes, and snippets.

@dylansm
Forked from zeke/buttons.coffee
Created November 2, 2012 18:49
Show Gist options
  • Save dylansm/4003521 to your computer and use it in GitHub Desktop.
Save dylansm/4003521 to your computer and use it in GitHub Desktop.
Haml + Coffeescript Tweet button and Like button
((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
return if d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"
fjs.parentNode.insertBefore js, fjs
) document, "script", "facebook-jssdk"
not ((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
unless d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = "//platform.twitter.com/widgets.js"
fjs.parentNode.insertBefore js, fjs
) document, "script", "twitter-wjs"
%a.twitter-share-button{"data-related" => "YourUserNameOnTwitter", "data-size" => "large", "data-text" => "I just tweeted about this site!", "data-via" => "YourUserNameOnTWitter", :href => "https://twitter.com/share"} Tweet
.fb-like{"data-action" => "like", "data-colorscheme" => "light", "data-layout" => "standard", "data-send" => "false", "data-show-faces" => "false", "data-width" => "450"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment