Sha256: efc0473c5db2577be803540649cd991826e8a7bc0cbff0797110ea64c084150e

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

window.SocialShareButton =
  openUrl : (url) ->
    window.open(url)
    false
    
  share : (site, title) ->
    url = encodeURIComponent(location.href)
    title = encodeURIComponent(title)
    switch site
      when "weibo"
        SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&title=#{title}&content=utf-8")
      when "twitter"
        SocialShareButton.openUrl("https://twitter.com/home?status=#{title}: #{url}")
      when "douban"
        SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&v=1&r=1")
      when "facebook"
        SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{url}")
      when "qq"
        SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}")
    false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
social-share-button-0.0.3 lib/assets/javascripts/social-share-button.coffee