social-share-button 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/assets/javascripts/social-share-button.coffee +17 -14
- data/lib/social_share_button/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b4267b0eec82550ae92659b03fd96492177b2a1329515b8b2854e56e800304dc
|
|
4
|
+
data.tar.gz: 41e99e649cb78e7f2f7da4b657e6a0636d6966588199e9275757fc8b763654bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86d528b3360b550b2a88da7e65bc2204da2ebfd2d9bd0afef9ed7fab00d63234f51c4138ba14c5002bcaf5550bb1101b0e8e2ba4751d5ae02078791166152fe1
|
|
7
|
+
data.tar.gz: 48dde1a8e7942cabd4e89949b803e1e37cded17286e1f888b8987931ba62320fc9b23bd0773c4636a761655e85e158dfa4775142e919ae3090eee4ad63d05dc9
|
data/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,17 @@ window.SocialShareButton =
|
|
|
7
7
|
false
|
|
8
8
|
|
|
9
9
|
share : (el) ->
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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(
|
|
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:
|
|
63
|
-
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 =
|
|
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}
|
|
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}
|
|
108
|
+
SocialShareButton.openUrl("https://web.whatsapp.com/send?text=#{title}%0A#{url}")
|
|
106
109
|
false
|
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.
|
|
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:
|
|
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
|
-
|
|
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,
|