social_share_privacy 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/social_share_privacy_helper.rb +13 -0
- data/lib/social_share_privacy.rb +22 -7
- data/lib/social_share_privacy/version.rb +1 -1
- data/vendor/assets/javascripts/{jquery.socialshareprivacy.js.erb → jquery.socialshareprivacy.js} +5 -6
- metadata +3 -3
- data/vendor/assets/images/social_share_privacy/dummy_gplus_alt.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9134f6ca8b71811d5a00c9f0d94906d4cf84450a
|
4
|
+
data.tar.gz: 2ca77cbde2bcab3694a53888e410f8dbda07bd6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 366d03cf313193b6c07928b753175110d5595c6b40dc913298cc81eaf4397046f521353137f1fbf95c4dc29127450ad4e85d728086e673632cb400bccc021076
|
7
|
+
data.tar.gz: 6150b2389bf0457b229f46577e2074b0e9aa5f1de6896f81f8ff672067b3466b95886231718db47afb8ad4f43347b74858fab9e7ef3b029438900e38c02a1263
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module SocialSharePrivacyHelper
|
2
|
+
def social_buttons
|
3
|
+
options = SocialSharePrivacy.config.eval(request).to_s
|
4
|
+
result = []
|
5
|
+
result << '<div class="social_buttons"></div>'
|
6
|
+
result << javascript_tag do
|
7
|
+
result << 'jQuery(document).ready(function($) {'
|
8
|
+
result << " $('.social_buttons').socialSharePrivacy(#{options});"
|
9
|
+
result << "});"
|
10
|
+
end
|
11
|
+
raw(result.join("\n"))
|
12
|
+
end
|
13
|
+
end
|
data/lib/social_share_privacy.rb
CHANGED
@@ -21,6 +21,13 @@ module SocialSharePrivacy
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
%w{ models controllers helpers }.each do |dir|
|
25
|
+
path = File.join(File.dirname(__FILE__), 'app', dir)
|
26
|
+
$LOAD_PATH << path
|
27
|
+
ActiveSupport::Dependencies.load_paths << path
|
28
|
+
ActiveSupport::Dependencies.load_once_paths.delete(path)
|
29
|
+
end
|
30
|
+
|
24
31
|
module Evaluatable
|
25
32
|
|
26
33
|
def eval request
|
@@ -48,7 +55,7 @@ module SocialSharePrivacy
|
|
48
55
|
unless var.is_a? JSONable
|
49
56
|
var_s = '"' + var_s.gsub(/(["\\])/){ "\\" + $1 } + '"'
|
50
57
|
end
|
51
|
-
"\"#{var_name.to_s.sub(/^@+/,'')}\":#{var_s}"
|
58
|
+
"\"#{var_name.to_s.sub(/^@+/,'').downcase}\":#{var_s}"
|
52
59
|
end
|
53
60
|
json_string += vars.join(',')
|
54
61
|
json_string + '}'
|
@@ -60,7 +67,7 @@ module SocialSharePrivacy
|
|
60
67
|
include Evaluatable, JSONable
|
61
68
|
|
62
69
|
attr_accessor :info_link, :uri
|
63
|
-
|
70
|
+
|
64
71
|
class Cookie
|
65
72
|
|
66
73
|
include Evaluatable, JSONable
|
@@ -80,11 +87,12 @@ module SocialSharePrivacy
|
|
80
87
|
|
81
88
|
def initialize
|
82
89
|
loc_s = 'social_share_privacy.' + self.class.name.downcase
|
83
|
-
@txt_info = I18n.t("#{loc_s}.txt_info")
|
84
|
-
@txt_help = I18n.t("#{loc_s}.txt_help")
|
85
|
-
@txt_off = I18n.t("#{loc_s}.txt_off")
|
86
|
-
@txt_on = I18n.t("#{loc_s}.txt_on")
|
87
|
-
@
|
90
|
+
@txt_info = Proc.new { I18n.t("#{loc_s}.txt_info") }
|
91
|
+
@txt_help = Proc.new { I18n.t("#{loc_s}.txt_help") }
|
92
|
+
@txt_off = Proc.new { I18n.t("#{loc_s}.txt_off") }
|
93
|
+
@txt_on = Proc.new { I18n.t("#{loc_s}.txt_on") }
|
94
|
+
@display_name = Proc.new { I18n.t("#{loc_s}.display_name") }
|
95
|
+
@dummy_button = Proc.new { ActionView::Helpers::AssetTagHelper.path_to_image('social_share_privacy/dummy_' + self.class.name.downcase + '.png')}
|
88
96
|
end
|
89
97
|
|
90
98
|
def enabled= value
|
@@ -106,6 +114,13 @@ module SocialSharePrivacy
|
|
106
114
|
|
107
115
|
class Facebook < Service
|
108
116
|
attr_accessor :action
|
117
|
+
|
118
|
+
def eval request
|
119
|
+
result = super request
|
120
|
+
result.dummy_button = ActionView::Helpers::AssetTagHelper.image_path('social_share_privacy/dummy_facebook_de.png') if result.language == 'de'
|
121
|
+
result
|
122
|
+
end
|
123
|
+
|
109
124
|
end
|
110
125
|
|
111
126
|
class Twitter < Service
|
data/vendor/assets/javascripts/{jquery.socialshareprivacy.js.erb → jquery.socialshareprivacy.js}
RENAMED
@@ -80,11 +80,10 @@
|
|
80
80
|
}
|
81
81
|
|
82
82
|
// extend jquery with our plugin function
|
83
|
-
$.fn.socialSharePrivacy = function () {
|
83
|
+
$.fn.socialSharePrivacy = function (userOptions) {
|
84
84
|
|
85
85
|
// Standardwerte des Plug-Ings mit den vom User angegebenen Optionen ueberschreiben
|
86
|
-
|
87
|
-
var options = <%= SocialSharePrivacy.config.eval(request).to_s %>
|
86
|
+
var options = userOptions
|
88
87
|
var facebook_on = (options.services.facebook.status === 'on');
|
89
88
|
var twitter_on = (options.services.twitter.status === 'on');
|
90
89
|
var gplus_on = (options.services.gplus.status === 'on');
|
@@ -111,7 +110,7 @@
|
|
111
110
|
if (facebook_on) {
|
112
111
|
var fb_enc_uri = encodeURIComponent(uri + options.services.facebook.referrer_track);
|
113
112
|
var fb_code = '<iframe src="http://www.facebook.com/plugins/like.php?locale=' + options.services.facebook.language + '&href=' + fb_enc_uri + '&send=false&layout=button_count&width=120&show_faces=false&action=' + options.services.facebook.action + '&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height:21px;" allowTransparency="true"></iframe>';
|
114
|
-
var fb_dummy_btn = '<img src="
|
113
|
+
var fb_dummy_btn = '<img src="' + options.services.facebook.dummy_button + '" alt="Facebook "Like"-Dummy" class="fb_like_privacy_dummy" />';
|
115
114
|
|
116
115
|
context.append('<li class="facebook help_info"><span class="info">' + options.services.facebook.txt_info + '</span><span class="switch off">' + options.services.facebook.txt_off + '</span><div class="fb_like dummy_btn">' + fb_dummy_btn + '</div></li>');
|
117
116
|
|
@@ -144,7 +143,7 @@
|
|
144
143
|
var twitter_enc_uri = encodeURIComponent(uri + options.services.twitter.referrer_track);
|
145
144
|
var twitter_count_url = encodeURIComponent(uri);
|
146
145
|
var twitter_code = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url=' + twitter_enc_uri + '&counturl=' + twitter_count_url + '&text=' + text + '&count=horizontal&lang=' + options.services.twitter.language + '" style="width:130px; height:25px;"></iframe>';
|
147
|
-
var twitter_dummy_btn = '<img src="
|
146
|
+
var twitter_dummy_btn = '<img src="' + options.services.twitter.dummy_button + '" alt=""Tweet this"-Dummy" class="tweet_this_dummy" />';
|
148
147
|
|
149
148
|
context.append('<li class="twitter help_info"><span class="info">' + options.services.twitter.txt_info + '</span><span class="switch off">' + options.services.twitter.txt_off + '</span><div class="tweet dummy_btn">' + twitter_dummy_btn + '</div></li>');
|
150
149
|
|
@@ -172,7 +171,7 @@
|
|
172
171
|
|
173
172
|
// we use the Google+ "asynchronous" code, standard code is flaky if inserted into dom after load
|
174
173
|
var gplus_code = '<div class="g-plusone" data-size="medium" data-href="' + gplus_uri + '"></div><script type="text/javascript">window.___gcfg = {lang: "' + options.services.gplus.language + '"}; (function() { var po = document.createElement("script"); po.type = "text/javascript"; po.async = true; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); </script>';
|
175
|
-
var gplus_dummy_btn = '<img src="
|
174
|
+
var gplus_dummy_btn = '<img src="' + options.services.gplus.dummy_button '" alt=""Google+1"-Dummy" class="gplus_one_dummy" />';
|
176
175
|
|
177
176
|
context.append('<li class="gplus help_info"><span class="info">' + options.services.gplus.txt_info + '</span><span class="switch off">' + options.services.gplus.txt_off + '</span><div class="gplusone dummy_btn">' + gplus_dummy_btn + '</div></li>');
|
178
177
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_share_privacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Reinert
|
@@ -47,6 +47,7 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
+
- app/helpers/social_share_privacy_helper.rb
|
50
51
|
- lib/tasks/social_share_privacy_tasks.rake
|
51
52
|
- lib/social_share_privacy.rb
|
52
53
|
- lib/social_share_privacy/version.rb
|
@@ -61,10 +62,9 @@ files:
|
|
61
62
|
- vendor/assets/images/social_share_privacy/socialshareprivacy_info.png
|
62
63
|
- vendor/assets/images/social_share_privacy/dummy_facebook_de.png
|
63
64
|
- vendor/assets/images/social_share_privacy/dummy_gplus.png
|
64
|
-
- vendor/assets/images/social_share_privacy/dummy_gplus_alt.png
|
65
65
|
- vendor/assets/images/social_share_privacy/dummy_facebook.png
|
66
66
|
- vendor/assets/stylesheets/socialshareprivacy.css.erb
|
67
|
-
- vendor/assets/javascripts/jquery.socialshareprivacy.js
|
67
|
+
- vendor/assets/javascripts/jquery.socialshareprivacy.js
|
68
68
|
- MIT-LICENSE
|
69
69
|
- Rakefile
|
70
70
|
- README.rdoc
|
Binary file
|