social-share-button 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ == 0.0.4
2
+
3
+ * Add image support for Weibo share.
4
+
5
+ == 0.0.3
6
+
7
+ * Facebook, Twitter, Weibo, Douban, QQZone 分享功能;
@@ -3,12 +3,14 @@ window.SocialShareButton =
3
3
  window.open(url)
4
4
  false
5
5
 
6
- share : (site, title) ->
6
+ share : (el) ->
7
+ site = $(el).data('site')
8
+ title = encodeURIComponent($(el).parent().data('title'))
9
+ img = encodeURIComponent($(el).parent().data("img"))
7
10
  url = encodeURIComponent(location.href)
8
- title = encodeURIComponent(title)
9
11
  switch site
10
12
  when "weibo"
11
- SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&title=#{title}&content=utf-8")
13
+ SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
12
14
  when "twitter"
13
15
  SocialShareButton.openUrl("https://twitter.com/home?status=#{title}: #{url}")
14
16
  when "douban"
@@ -16,5 +18,5 @@ window.SocialShareButton =
16
18
  when "facebook"
17
19
  SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{url}")
18
20
  when "qq"
19
- SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}")
21
+ SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}")
20
22
  false
@@ -4,14 +4,14 @@ module SocialShareButton
4
4
  def social_share_button_tag(title = "", opts = {})
5
5
  rel = opts[:rel]
6
6
  html = []
7
- html << "<div class='social-share-button' data-title='#{title}'>"
7
+ html << "<div class='social-share-button' data-title='#{title}' data-img='#{opts[:image]}'>"
8
8
 
9
9
  SocialShareButton.config.allow_sites.each do |name|
10
10
  link_title = [t("social_share_button.share_to"),t("social_share_button.#{name.downcase}")].join("")
11
11
  html << link_to("","#", :rel => "nofollow #{rel}",
12
12
  "data-site" => name,
13
13
  :class => "social-share-button-#{name}",
14
- :onclick => "return SocialShareButton.share($(this).data('site'), $(this).parent().data('title'));",
14
+ :onclick => "return SocialShareButton.share(this);",
15
15
  :title => h(link_title))
16
16
  end
17
17
  html << "</div>"
@@ -1,3 +1,3 @@
1
1
  module SocialShareButton
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social-share-button
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-04 00:00:00.000000000Z
12
+ date: 2012-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70322809236260 !ruby/object:Gem::Requirement
16
+ requirement: &70134693282500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70322809236260
24
+ version_requirements: *70134693282500
25
25
  description: Helper for add social share feature in your Rails app. Twitter, Facebook,
26
26
  Weibo, Douban, QQ ...
27
27
  email:
@@ -32,6 +32,7 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - .DS_Store
34
34
  - .gitignore
35
+ - Changelogs.md
35
36
  - Gemfile
36
37
  - README.markdown
37
38
  - Rakefile
@@ -61,7 +62,6 @@ files:
61
62
  - social-share-button.gemspec
62
63
  homepage: http://github.com/huacnlee/social-share-button
63
64
  licenses: []
64
- metadata: {}
65
65
  post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths:
@@ -80,9 +80,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 1.8.10
83
+ rubygems_version: 1.8.11
84
84
  signing_key:
85
- specification_version: 4
85
+ specification_version: 3
86
86
  summary: Helper for add social share feature in your Rails app. Twitter, Facebook,
87
87
  Weibo, Douban, QQ ...
88
88
  test_files: []