Skip to content

Instantly share code, notes, and snippets.

Created January 10, 2014 07:29
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
CoffeeScript to load Twitter's twitter-wjs JavaScript. Tip: Any link that goes to an intent URL (like acts like a Twitter button with all the Widget-wjs functionality with events, so you can customize the look of your button without having to use the Twitter generated iFrame buttons.
# Load Twitter Widgets
window.twttr = ((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
unless d.getElementById(id)
js = d.createElement(s) = id
js.src = "//"
fjs.parentNode.insertBefore js, fjs
window.twttr || t = { _e: [], ready: (f)-> t._e.push(f) }
) document, "script", "twitter-wjs"
# Twitter Ready
# Twitter Events
# Event: Tweet 'tweet', (event) ->
alert "Twitter tweet just happened!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment