Created
August 6, 2013 00:34
-
-
Save takahiro47/6160970 to your computer and use it in GitHub Desktop.
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
$ -> | |
## | |
## Social Plugins ## | |
# Facebook 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" | |
# Twitter Tweet Button | |
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" | |
# Google Analytics | |
root = exports ? @ | |
root._gaq = [ | |
['_setAccount', 'UA-12344578-1'], | |
['_setDomainName', 'ドメイン.jp'], | |
['_trackPageview'] | |
] | |
insertGAScript = -> | |
ga = document.createElement 'script' | |
ga.type = 'text/javascript' | |
ga.async = true | |
proto = document.location.protocol | |
proto = if (proto is 'https:') then 'https://ssl' else 'http://www' | |
ga.src = "#{proto}.google-analytics.com/ga.js" | |
s = document.getElementsByTagName 'script' | |
s[0].parentNode.insertBefore ga, s | |
insertGAScript() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment