codecombat/app/core/services/twitter.coffee

12 lines
405 B
CoffeeScript

module.exports = initializeTwitter = ->
((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
p = (if /^http:/.test(d.location) then 'http' else 'https')
unless d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = p + '://platform.twitter.com/widgets.js'
fjs.parentNode.insertBefore js, fjs
return
) document, 'script', 'twitter-wjs'