social-share-button 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fb0d48d54bf21bb0da56e7973f240a94c64f45e510b20646df667b9c52ac168
4
- data.tar.gz: 8bc2c37e819b095055ec53e1d41be886754f71f5e65639ca8cffb8ec5275db6b
3
+ metadata.gz: b4267b0eec82550ae92659b03fd96492177b2a1329515b8b2854e56e800304dc
4
+ data.tar.gz: 41e99e649cb78e7f2f7da4b657e6a0636d6966588199e9275757fc8b763654bd
5
5
  SHA512:
6
- metadata.gz: 76295db42df9c0c5b21c5e6fe331dd1852c0c4e39e9e3fdd6387648e5f0444f3fab6850f77872f5af7e7a89253a20b60e2c50b52e22de687a84900aa7c327b00
7
- data.tar.gz: 1595b1fc360d0d34a396d377019e25ad1c2e7ee3c009edc727323952dd0ca61a9d3999eda3fd2cb21de682ff434e22b06f9e285917cd0b949b0cd6db89051bef
6
+ metadata.gz: 86d528b3360b550b2a88da7e65bc2204da2ebfd2d9bd0afef9ed7fab00d63234f51c4138ba14c5002bcaf5550bb1101b0e8e2ba4751d5ae02078791166152fe1
7
+ data.tar.gz: 48dde1a8e7942cabd4e89949b803e1e37cded17286e1f888b8987931ba62320fc9b23bd0773c4636a761655e85e158dfa4775142e919ae3090eee4ad63d05dc9
@@ -1,3 +1,8 @@
1
+ 1.2.1
2
+ -----
3
+
4
+ - Fix WahtsApp share URL (#187)
5
+
1
6
  1.2.0
2
7
  -----
3
8
 
@@ -7,14 +7,17 @@ window.SocialShareButton =
7
7
  false
8
8
 
9
9
  share : (el) ->
10
- site = $(el).data('site')
11
- appkey = $(el).data('appkey') || ''
12
- $parent = $(el).parent()
13
- title = encodeURIComponent($(el).data(site + '-title') || $parent.data('title') || '')
14
- img = encodeURIComponent($parent.data("img") || '')
15
- url = encodeURIComponent($parent.data("url") || '')
16
- via = encodeURIComponent($parent.data("via") || '')
17
- desc = encodeURIComponent($parent.data("desc") || ' ')
10
+ if el.getAttribute == null
11
+ el = document.querySelector(el)
12
+
13
+ site = el.getAttribute("data-site")
14
+ appkey = el.getAttribute("data-appkey") || ''
15
+ $parent = el.parentNode
16
+ title = encodeURIComponent(el.getAttribute("data-" + site + "-title") || $parent.getAttribute('data-title') || '')
17
+ img = encodeURIComponent($parent.getAttribute("data-img") || '')
18
+ url = encodeURIComponent($parent.getAttribute("data-url") || '')
19
+ via = encodeURIComponent($parent.getAttribute("data-via") || '')
20
+ desc = encodeURIComponent($parent.getAttribute("data-desc") || ' ')
18
21
 
19
22
  # tracking click events if google analytics enabled
20
23
  ga = window[window['GoogleAnalyticsObject'] || 'ga']
@@ -29,7 +32,7 @@ window.SocialShareButton =
29
32
  when "weibo"
30
33
  SocialShareButton.openUrl("http://service.weibo.com/share/share.php?url=#{url}&type=3&pic=#{img}&title=#{title}&appkey=#{appkey}", 620, 370)
31
34
  when "twitter"
32
- hashtags = encodeURIComponent($(el).data(site + '-hashtags') || $parent.data('hashtags') || '')
35
+ hashtags = encodeURIComponent(el.getAttribute("data-" + site + "-hashtags") || $parent.getAttribute("data-hashtags") || '')
33
36
  via_str = ''
34
37
  via_str = "&via=#{via}" if via.length > 0
35
38
  SocialShareButton.openUrl("https://twitter.com/intent/tweet?url=#{url}&text=#{title}&hashtags=#{hashtags}#{via_str}", 650, 300)
@@ -59,12 +62,12 @@ window.SocialShareButton =
59
62
  throw new Error("You should require social-share-button/wechat to your application.js") unless window.SocialShareWeChatButton
60
63
  window.SocialShareWeChatButton.qrcode
61
64
  url: decodeURIComponent(url)
62
- header: $(el).attr('title')
63
- footer: $(el).data('wechat-footer')
65
+ header: el.getAttribute('title')
66
+ footer: el.getAttribute("data-wechat-footer")
64
67
 
65
68
  when "tumblr"
66
69
  get_tumblr_extra = (param) ->
67
- cutom_data = $(el).attr("data-#{param}")
70
+ cutom_data = el.getAttribute("data-#{param}")
68
71
  encodeURIComponent(cutom_data) if cutom_data
69
72
 
70
73
  tumblr_params = ->
@@ -99,8 +102,8 @@ window.SocialShareButton =
99
102
  when "telegram"
100
103
  SocialShareButton.openUrl("https://telegram.me/share/url?text=#{title}&url=#{url}")
101
104
  when "whatsapp_app"
102
- whatsapp_app_url = "whatsapp://send?text=#{title}&url=#{url}"
105
+ whatsapp_app_url = "whatsapp://send?text=#{title}%0A#{url}"
103
106
  window.open(whatsapp_app_url, '_top')
104
107
  when "whatsapp_web"
105
- SocialShareButton.openUrl("https://web.whatsapp.com/send?text=#{title}&url=#{url}")
108
+ SocialShareButton.openUrl("https://web.whatsapp.com/send?text=#{title}%0A#{url}")
106
109
  false
@@ -1,3 +1,3 @@
1
1
  module SocialShareButton
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social-share-button
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2019-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -109,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.7.8
112
+ rubygems_version: 3.0.3
114
113
  signing_key:
115
114
  specification_version: 4
116
115
  summary: Helper for add social share feature in your Rails app. Twitter, Facebook,