social_share_privacy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,374 @@
|
|
1
|
+
/*
|
2
|
+
* jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
|
3
|
+
*
|
4
|
+
* http://www.heise.de/extras/socialshareprivacy/
|
5
|
+
* http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
|
6
|
+
*
|
7
|
+
* Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
|
8
|
+
* Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
|
9
|
+
*
|
10
|
+
* is released under the MIT License http://www.opensource.org/licenses/mit-license.php
|
11
|
+
*
|
12
|
+
* Spread the word, link to us if you can.
|
13
|
+
*/
|
14
|
+
(function ($) {
|
15
|
+
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
/*
|
19
|
+
* helper functions
|
20
|
+
*/
|
21
|
+
|
22
|
+
// abbreviate at last blank before length and add "\u2026" (horizontal ellipsis)
|
23
|
+
function abbreviateText(text, length) {
|
24
|
+
var abbreviated = decodeURIComponent(text);
|
25
|
+
if (abbreviated.length <= length) {
|
26
|
+
return text;
|
27
|
+
}
|
28
|
+
|
29
|
+
var lastWhitespaceIndex = abbreviated.substring(0, length - 1).lastIndexOf(' ');
|
30
|
+
abbreviated = encodeURIComponent(abbreviated.substring(0, lastWhitespaceIndex)) + "\u2026";
|
31
|
+
|
32
|
+
return abbreviated;
|
33
|
+
}
|
34
|
+
|
35
|
+
// returns content of <meta name="" content=""> tags or '' if empty/non existant
|
36
|
+
function getMeta(name) {
|
37
|
+
var metaContent = $('meta[name="' + name + '"]').attr('content');
|
38
|
+
return metaContent || '';
|
39
|
+
}
|
40
|
+
|
41
|
+
// create tweet text from content of <meta name="DC.title"> and <meta name="DC.creator">
|
42
|
+
// fallback to content of <title> tag
|
43
|
+
function getTweetText() {
|
44
|
+
var title = getMeta('DC.title');
|
45
|
+
var creator = getMeta('DC.creator');
|
46
|
+
|
47
|
+
if (title.length > 0 && creator.length > 0) {
|
48
|
+
title += ' - ' + creator;
|
49
|
+
} else {
|
50
|
+
title = $('title').text();
|
51
|
+
}
|
52
|
+
|
53
|
+
return encodeURIComponent(title);
|
54
|
+
}
|
55
|
+
|
56
|
+
// build URI from rel="canonical" or document.location
|
57
|
+
function getURI() {
|
58
|
+
var uri = document.location.href;
|
59
|
+
var canonical = $("link[rel=canonical]").attr("href");
|
60
|
+
|
61
|
+
if (canonical && canonical.length > 0) {
|
62
|
+
if (canonical.indexOf("http") < 0) {
|
63
|
+
canonical = document.location.protocol + "//" + document.location.host + canonical;
|
64
|
+
}
|
65
|
+
uri = canonical;
|
66
|
+
}
|
67
|
+
|
68
|
+
return uri;
|
69
|
+
}
|
70
|
+
|
71
|
+
function cookieSet(name, value, days, path, domain) {
|
72
|
+
var expires = new Date();
|
73
|
+
expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
|
74
|
+
document.cookie = name + '=' + value + '; expires=' + expires.toUTCString() + '; path=' + path + '; domain=' + domain;
|
75
|
+
}
|
76
|
+
function cookieDel(name, value, path, domain) {
|
77
|
+
var expires = new Date();
|
78
|
+
expires.setTime(expires.getTime() - 100);
|
79
|
+
document.cookie = name + '=' + value + '; expires=' + expires.toUTCString() + '; path=' + path + '; domain=' + domain;
|
80
|
+
}
|
81
|
+
|
82
|
+
// extend jquery with our plugin function
|
83
|
+
$.fn.socialSharePrivacy = function (settings) {
|
84
|
+
var defaults = {
|
85
|
+
'services' : {
|
86
|
+
'facebook' : {
|
87
|
+
'status' : 'on',
|
88
|
+
'txt_info' : '2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.',
|
89
|
+
'txt_fb_off' : 'nicht mit Facebook verbunden',
|
90
|
+
'txt_fb_on' : 'mit Facebook verbunden',
|
91
|
+
'perma_option' : 'on',
|
92
|
+
'display_name' : 'Facebook',
|
93
|
+
'referrer_track' : '',
|
94
|
+
'language' : 'de_DE',
|
95
|
+
'action' : 'recommend'
|
96
|
+
},
|
97
|
+
'twitter' : {
|
98
|
+
'status' : 'on',
|
99
|
+
'txt_info' : '2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.',
|
100
|
+
'txt_twitter_off' : 'nicht mit Twitter verbunden',
|
101
|
+
'txt_twitter_on' : 'mit Twitter verbunden',
|
102
|
+
'perma_option' : 'on',
|
103
|
+
'display_name' : 'Twitter',
|
104
|
+
'referrer_track' : '',
|
105
|
+
'tweet_text' : getTweetText,
|
106
|
+
'language' : 'en'
|
107
|
+
},
|
108
|
+
'gplus' : {
|
109
|
+
'status' : 'on',
|
110
|
+
'txt_info' : '2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.',
|
111
|
+
'txt_gplus_off' : 'nicht mit Google+ verbunden',
|
112
|
+
'txt_gplus_on' : 'mit Google+ verbunden',
|
113
|
+
'perma_option' : 'on',
|
114
|
+
'display_name' : 'Google+',
|
115
|
+
'referrer_track' : '',
|
116
|
+
'language' : 'de'
|
117
|
+
}
|
118
|
+
},
|
119
|
+
'info_link' : 'http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html',
|
120
|
+
'txt_help' : 'Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter oder Google in die USA übertragen und unter Umständen auch dort gespeichert. Näheres erfahren Sie durch einen Klick auf das <em>i</em>.',
|
121
|
+
'settings_perma' : 'Dauerhaft aktivieren und Datenüber­tragung zustimmen:',
|
122
|
+
'cookie_path' : '/',
|
123
|
+
'cookie_domain' : document.location.host,
|
124
|
+
'cookie_expires' : '365',
|
125
|
+
'css_path' : 'socialshareprivacy/socialshareprivacy.css',
|
126
|
+
'uri' : getURI
|
127
|
+
};
|
128
|
+
|
129
|
+
// Standardwerte des Plug-Ings mit den vom User angegebenen Optionen ueberschreiben
|
130
|
+
var options = $.extend(true, defaults, settings);
|
131
|
+
|
132
|
+
var facebook_on = (options.services.facebook.status === 'on');
|
133
|
+
var twitter_on = (options.services.twitter.status === 'on');
|
134
|
+
var gplus_on = (options.services.gplus.status === 'on');
|
135
|
+
|
136
|
+
// check if at least one service is "on"
|
137
|
+
if (!facebook_on && !twitter_on && !gplus_on) {
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
|
141
|
+
// insert stylesheet into document and prepend target element
|
142
|
+
if (options.css_path.length > 0) {
|
143
|
+
// IE fix (noetig fuer IE < 9 - wird hier aber fuer alle IE gemacht)
|
144
|
+
if (document.createStyleSheet) {
|
145
|
+
document.createStyleSheet(options.css_path);
|
146
|
+
} else {
|
147
|
+
$('head').append('<link rel="stylesheet" type="text/css" href="' + options.css_path + '" />');
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
return this.each(function () {
|
152
|
+
|
153
|
+
$(this).prepend('<ul class="social_share_privacy_area"></ul>');
|
154
|
+
var context = $('.social_share_privacy_area', this);
|
155
|
+
|
156
|
+
// canonical uri that will be shared
|
157
|
+
var uri = options.uri;
|
158
|
+
if (typeof uri === 'function') {
|
159
|
+
uri = uri(context);
|
160
|
+
}
|
161
|
+
|
162
|
+
//
|
163
|
+
// Facebook
|
164
|
+
//
|
165
|
+
if (facebook_on) {
|
166
|
+
var fb_enc_uri = encodeURIComponent(uri + options.services.facebook.referrer_track);
|
167
|
+
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>';
|
168
|
+
var fb_dummy_btn = '<img src="' + <%= image_path 'social_share_privacy/facebook_dummy.png' %> + '" alt="Facebook "Like"-Dummy" class="fb_like_privacy_dummy" />';
|
169
|
+
|
170
|
+
context.append('<li class="facebook help_info"><span class="info">' + options.services.facebook.txt_info + '</span><span class="switch off">' + options.services.facebook.txt_fb_off + '</span><div class="fb_like dummy_btn">' + fb_dummy_btn + '</div></li>');
|
171
|
+
|
172
|
+
var $container_fb = $('li.facebook', context);
|
173
|
+
|
174
|
+
$('li.facebook div.fb_like img.fb_like_privacy_dummy,li.facebook span.switch', context).live('click', function () {
|
175
|
+
if ($container_fb.find('span.switch').hasClass('off')) {
|
176
|
+
$container_fb.addClass('info_off');
|
177
|
+
$container_fb.find('span.switch').addClass('on').removeClass('off').html(options.services.facebook.txt_fb_on);
|
178
|
+
$container_fb.find('img.fb_like_privacy_dummy').replaceWith(fb_code);
|
179
|
+
} else {
|
180
|
+
$container_fb.removeClass('info_off');
|
181
|
+
$container_fb.find('span.switch').addClass('off').removeClass('on').html(options.services.facebook.txt_fb_off);
|
182
|
+
$container_fb.find('.fb_like').html(fb_dummy_btn);
|
183
|
+
}
|
184
|
+
});
|
185
|
+
}
|
186
|
+
|
187
|
+
//
|
188
|
+
// Twitter
|
189
|
+
//
|
190
|
+
if (twitter_on) {
|
191
|
+
var text = options.services.twitter.tweet_text;
|
192
|
+
if (typeof text === 'function') {
|
193
|
+
text = text();
|
194
|
+
}
|
195
|
+
// 120 is the max character count left after twitters automatic url shortening with t.co
|
196
|
+
text = abbreviateText(text, '120');
|
197
|
+
|
198
|
+
var twitter_enc_uri = encodeURIComponent(uri + options.services.twitter.referrer_track);
|
199
|
+
var twitter_count_url = encodeURIComponent(uri);
|
200
|
+
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>';
|
201
|
+
var twitter_dummy_btn = '<img src="' + <%= image_path 'social_share_privacy/twitter_dummy.png' %> + '" alt=""Tweet this"-Dummy" class="tweet_this_dummy" />';
|
202
|
+
|
203
|
+
context.append('<li class="twitter help_info"><span class="info">' + options.services.twitter.txt_info + '</span><span class="switch off">' + options.services.twitter.txt_twitter_off + '</span><div class="tweet dummy_btn">' + twitter_dummy_btn + '</div></li>');
|
204
|
+
|
205
|
+
var $container_tw = $('li.twitter', context);
|
206
|
+
|
207
|
+
$('li.twitter div.tweet img,li.twitter span.switch', context).live('click', function () {
|
208
|
+
if ($container_tw.find('span.switch').hasClass('off')) {
|
209
|
+
$container_tw.addClass('info_off');
|
210
|
+
$container_tw.find('span.switch').addClass('on').removeClass('off').html(options.services.twitter.txt_twitter_on);
|
211
|
+
$container_tw.find('img.tweet_this_dummy').replaceWith(twitter_code);
|
212
|
+
} else {
|
213
|
+
$container_tw.removeClass('info_off');
|
214
|
+
$container_tw.find('span.switch').addClass('off').removeClass('on').html(options.services.twitter.txt_twitter_off);
|
215
|
+
$container_tw.find('.tweet').html(twitter_dummy_btn);
|
216
|
+
}
|
217
|
+
});
|
218
|
+
}
|
219
|
+
|
220
|
+
//
|
221
|
+
// Google+
|
222
|
+
//
|
223
|
+
if (gplus_on) {
|
224
|
+
// fuer G+ wird die URL nicht encoded, da das zu einem Fehler fuehrt
|
225
|
+
var gplus_uri = uri + options.services.gplus.referrer_track;
|
226
|
+
|
227
|
+
// we use the Google+ "asynchronous" code, standard code is flaky if inserted into dom after load
|
228
|
+
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>';
|
229
|
+
var gplus_dummy_btn = '<img src="' + <%= image_path 'social_share_privacy/gplus_dummy.png' %> + '" alt=""Google+1"-Dummy" class="gplus_one_dummy" />';
|
230
|
+
|
231
|
+
context.append('<li class="gplus help_info"><span class="info">' + options.services.gplus.txt_info + '</span><span class="switch off">' + options.services.gplus.txt_gplus_off + '</span><div class="gplusone dummy_btn">' + gplus_dummy_btn + '</div></li>');
|
232
|
+
|
233
|
+
var $container_gplus = $('li.gplus', context);
|
234
|
+
|
235
|
+
$('li.gplus div.gplusone img,li.gplus span.switch', context).live('click', function () {
|
236
|
+
if ($container_gplus.find('span.switch').hasClass('off')) {
|
237
|
+
$container_gplus.addClass('info_off');
|
238
|
+
$container_gplus.find('span.switch').addClass('on').removeClass('off').html(options.services.gplus.txt_gplus_on);
|
239
|
+
$container_gplus.find('img.gplus_one_dummy').replaceWith(gplus_code);
|
240
|
+
} else {
|
241
|
+
$container_gplus.removeClass('info_off');
|
242
|
+
$container_gplus.find('span.switch').addClass('off').removeClass('on').html(options.services.gplus.txt_gplus_off);
|
243
|
+
$container_gplus.find('.gplusone').html(gplus_dummy_btn);
|
244
|
+
}
|
245
|
+
});
|
246
|
+
}
|
247
|
+
|
248
|
+
//
|
249
|
+
// Der Info/Settings-Bereich wird eingebunden
|
250
|
+
//
|
251
|
+
context.append('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="' + options.info_link + '"><span class="help_info icon"><span class="info">' + options.txt_help + '</span></span></a></div></li>');
|
252
|
+
|
253
|
+
// Info-Overlays mit leichter Verzoegerung einblenden
|
254
|
+
$('.help_info:not(.info_off)', context).live('mouseenter', function () {
|
255
|
+
var $info_wrapper = $(this);
|
256
|
+
var timeout_id = window.setTimeout(function () { $($info_wrapper).addClass('display'); }, 500);
|
257
|
+
$(this).data('timeout_id', timeout_id);
|
258
|
+
});
|
259
|
+
$('.help_info', context).live('mouseleave', function () {
|
260
|
+
var timeout_id = $(this).data('timeout_id');
|
261
|
+
window.clearTimeout(timeout_id);
|
262
|
+
if ($(this).hasClass('display')) {
|
263
|
+
$(this).removeClass('display');
|
264
|
+
}
|
265
|
+
});
|
266
|
+
|
267
|
+
var facebook_perma = (options.services.facebook.perma_option === 'on');
|
268
|
+
var twitter_perma = (options.services.twitter.perma_option === 'on');
|
269
|
+
var gplus_perma = (options.services.gplus.perma_option === 'on');
|
270
|
+
|
271
|
+
// Menue zum dauerhaften Einblenden der aktiven Dienste via Cookie einbinden
|
272
|
+
// Die IE7 wird hier ausgenommen, da er kein JSON kann und die Cookies hier ueber JSON-Struktur abgebildet werden
|
273
|
+
if (((facebook_on && facebook_perma)
|
274
|
+
|| (twitter_on && twitter_perma)
|
275
|
+
|| (gplus_on && gplus_perma))
|
276
|
+
&& (!$.browser.msie || ($.browser.msie && $.browser.version > 7.0))) {
|
277
|
+
|
278
|
+
// Cookies abrufen
|
279
|
+
var cookie_list = document.cookie.split(';');
|
280
|
+
var cookies = '{';
|
281
|
+
var i = 0;
|
282
|
+
for (; i < cookie_list.length; i += 1) {
|
283
|
+
var foo = cookie_list[i].split('=');
|
284
|
+
cookies += '"' + $.trim(foo[0]) + '":"' + $.trim(foo[1]) + '"';
|
285
|
+
if (i < cookie_list.length - 1) {
|
286
|
+
cookies += ',';
|
287
|
+
}
|
288
|
+
}
|
289
|
+
cookies += '}';
|
290
|
+
cookies = JSON.parse(cookies);
|
291
|
+
|
292
|
+
// Container definieren
|
293
|
+
var $container_settings_info = $('li.settings_info', context);
|
294
|
+
|
295
|
+
// Klasse entfernen, die das i-Icon alleine formatiert, da Perma-Optionen eingeblendet werden
|
296
|
+
$container_settings_info.find('.settings_info_menu').removeClass('perma_option_off');
|
297
|
+
|
298
|
+
// Perma-Optionen-Icon (.settings) und Formular (noch versteckt) einbinden
|
299
|
+
$container_settings_info.find('.settings_info_menu').append('<span class="settings">Einstellungen</span><form><fieldset><legend>' + options.settings_perma + '</legend></fieldset></form>');
|
300
|
+
|
301
|
+
|
302
|
+
// Die Dienste mit <input> und <label>, sowie checked-Status laut Cookie, schreiben
|
303
|
+
var checked = ' checked="checked"';
|
304
|
+
if (facebook_on && facebook_perma) {
|
305
|
+
var perma_status_facebook = cookies.socialSharePrivacy_facebook === 'perma_on' ? checked : '';
|
306
|
+
$container_settings_info.find('form fieldset').append(
|
307
|
+
'<input type="checkbox" name="perma_status_facebook" id="perma_status_facebook"'
|
308
|
+
+ perma_status_facebook + ' /><label for="perma_status_facebook">'
|
309
|
+
+ options.services.facebook.display_name + '</label>'
|
310
|
+
);
|
311
|
+
}
|
312
|
+
|
313
|
+
if (twitter_on && twitter_perma) {
|
314
|
+
var perma_status_twitter = cookies.socialSharePrivacy_twitter === 'perma_on' ? checked : '';
|
315
|
+
$container_settings_info.find('form fieldset').append(
|
316
|
+
'<input type="checkbox" name="perma_status_twitter" id="perma_status_twitter"'
|
317
|
+
+ perma_status_twitter + ' /><label for="perma_status_twitter">'
|
318
|
+
+ options.services.twitter.display_name + '</label>'
|
319
|
+
);
|
320
|
+
}
|
321
|
+
|
322
|
+
if (gplus_on && gplus_perma) {
|
323
|
+
var perma_status_gplus = cookies.socialSharePrivacy_gplus === 'perma_on' ? checked : '';
|
324
|
+
$container_settings_info.find('form fieldset').append(
|
325
|
+
'<input type="checkbox" name="perma_status_gplus" id="perma_status_gplus"'
|
326
|
+
+ perma_status_gplus + ' /><label for="perma_status_gplus">'
|
327
|
+
+ options.services.gplus.display_name + '</label>'
|
328
|
+
);
|
329
|
+
}
|
330
|
+
|
331
|
+
// Cursor auf Pointer setzen fuer das Zahnrad
|
332
|
+
$container_settings_info.find('span.settings').css('cursor', 'pointer');
|
333
|
+
|
334
|
+
// Einstellungs-Menue bei mouseover ein-/ausblenden
|
335
|
+
$($container_settings_info.find('span.settings'), context).live('mouseenter', function () {
|
336
|
+
var timeout_id = window.setTimeout(function () { $container_settings_info.find('.settings_info_menu').removeClass('off').addClass('on'); }, 500);
|
337
|
+
$(this).data('timeout_id', timeout_id);
|
338
|
+
});
|
339
|
+
$($container_settings_info, context).live('mouseleave', function () {
|
340
|
+
var timeout_id = $(this).data('timeout_id');
|
341
|
+
window.clearTimeout(timeout_id);
|
342
|
+
$container_settings_info.find('.settings_info_menu').removeClass('on').addClass('off');
|
343
|
+
});
|
344
|
+
|
345
|
+
// Klick-Interaktion auf <input> um Dienste dauerhaft ein- oder auszuschalten (Cookie wird gesetzt oder geloescht)
|
346
|
+
$($container_settings_info.find('fieldset input')).live('click', function (event) {
|
347
|
+
var click = event.target.id;
|
348
|
+
var service = click.substr(click.lastIndexOf('_') + 1, click.length);
|
349
|
+
var cookie_name = 'socialSharePrivacy_' + service;
|
350
|
+
|
351
|
+
if ($('#' + event.target.id + ':checked').length) {
|
352
|
+
cookieSet(cookie_name, 'perma_on', options.cookie_expires, options.cookie_path, options.cookie_domain);
|
353
|
+
$('form fieldset label[for=' + click + ']', context).addClass('checked');
|
354
|
+
} else {
|
355
|
+
cookieDel(cookie_name, 'perma_on', options.cookie_path, options.cookie_domain);
|
356
|
+
$('form fieldset label[for=' + click + ']', context).removeClass('checked');
|
357
|
+
}
|
358
|
+
});
|
359
|
+
|
360
|
+
// Dienste automatisch einbinden, wenn entsprechendes Cookie vorhanden ist
|
361
|
+
if (facebook_on && facebook_perma && cookies.socialSharePrivacy_facebook === 'perma_on') {
|
362
|
+
$('li.facebook span.switch', context).click();
|
363
|
+
}
|
364
|
+
if (twitter_on && twitter_perma && cookies.socialSharePrivacy_twitter === 'perma_on') {
|
365
|
+
$('li.twitter span.switch', context).click();
|
366
|
+
}
|
367
|
+
if (gplus_on && gplus_perma && cookies.socialSharePrivacy_gplus === 'perma_on') {
|
368
|
+
$('li.gplus span.switch', context).click();
|
369
|
+
}
|
370
|
+
}
|
371
|
+
}); // this.each(function ()
|
372
|
+
}; // $.fn.socialSharePrivacy = function (settings) {
|
373
|
+
}(jQuery));
|
374
|
+
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -64,7 +64,7 @@ files:
|
|
64
64
|
- vendor/assets/images/dummy_gplus_alt.png
|
65
65
|
- vendor/assets/images/dummy_facebook.png
|
66
66
|
- vendor/assets/stylesheets/socialshareprivacy.css
|
67
|
-
- vendor/assets/javascripts/jquery.socialshareprivacy.js
|
67
|
+
- vendor/assets/javascripts/jquery.socialshareprivacy.js.erb
|
68
68
|
- MIT-LICENSE
|
69
69
|
- Rakefile
|
70
70
|
- README.rdoc
|
@@ -1,33 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
|
3
|
-
*
|
4
|
-
* http://www.heise.de/extras/socialshareprivacy/
|
5
|
-
* http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
|
6
|
-
*
|
7
|
-
* Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
|
8
|
-
* Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
|
9
|
-
*
|
10
|
-
* is released under the MIT License http://www.opensource.org/licenses/mit-license.php
|
11
|
-
*
|
12
|
-
* Spread the word, link to us if you can.
|
13
|
-
*/
|
14
|
-
(function(b){function x(b,a){var f=decodeURIComponent(b);if(f.length<=a)return b;var j=f.substring(0,a-1).lastIndexOf(" ");return f=encodeURIComponent(f.substring(0,j))+"\u2026"}function q(c){return b('meta[name="'+c+'"]').attr("content")||""}function r(){var c=q("DC.title"),a=q("DC.creator"),c=0<c.length&&0<a.length?c+(" - "+a):b("title").text();return encodeURIComponent(c)}function s(){var c=document.location.href,a=b("link[rel=canonical]").attr("href");a&&0<a.length&&(0>a.indexOf("http")&&(a=document.location.protocol+
|
15
|
-
"//"+document.location.host+a),c=a);return c}b.fn.socialSharePrivacy=function(c){var a=b.extend(!0,{services:{facebook:{status:"on",dummy_img:"socialshareprivacy/images/dummy_facebook.png",txt_info:"2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.",txt_fb_off:"nicht mit Facebook verbunden",txt_fb_on:"mit Facebook verbunden",
|
16
|
-
perma_option:"on",display_name:"Facebook",referrer_track:"",language:"de_DE",action:"recommend"},twitter:{status:"on",dummy_img:"socialshareprivacy/images/dummy_twitter.png",txt_info:"2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.",txt_twitter_off:"nicht mit Twitter verbunden",txt_twitter_on:"mit Twitter verbunden",perma_option:"on",
|
17
|
-
display_name:"Twitter",referrer_track:"",tweet_text:r,language:"en"},gplus:{status:"on",dummy_img:"socialshareprivacy/images/dummy_gplus.png",txt_info:"2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.",txt_gplus_off:"nicht mit Google+ verbunden",txt_gplus_on:"mit Google+ verbunden",perma_option:"on",display_name:"Google+",
|
18
|
-
referrer_track:"",language:"de"}},info_link:"http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html",txt_help:"Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter oder Google in die USA übertragen und unter Umständen auch dort gespeichert. Näheres erfahren Sie durch einen Klick auf das <em>i</em>.",settings_perma:"Dauerhaft aktivieren und Datenüber­tragung zustimmen:",cookie_path:"/",cookie_domain:document.location.host,
|
19
|
-
cookie_expires:"365",css_path:"socialshareprivacy/socialshareprivacy.css",uri:s},c),f="on"===a.services.facebook.status,j="on"===a.services.twitter.status,n="on"===a.services.gplus.status;if(f||j||n)return 0<a.css_path.length&&(document.createStyleSheet?document.createStyleSheet(a.css_path):b("head").append('<link rel="stylesheet" type="text/css" href="'+a.css_path+'" />')),this.each(function(){b(this).prepend('<ul class="social_share_privacy_area"></ul>');var d=b(".social_share_privacy_area",this),
|
20
|
-
c=a.uri;"function"===typeof c&&(c=c(d));if(f){var g=encodeURIComponent(c+a.services.facebook.referrer_track),q='<iframe src="http://www.facebook.com/plugins/like.php?locale='+a.services.facebook.language+"&href="+g+"&send=false&layout=button_count&width=120&show_faces=false&action="+a.services.facebook.action+'&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height:21px;" allowTransparency="true"></iframe>',
|
21
|
-
t='<img src="'+a.services.facebook.dummy_img+'" alt="Facebook "Like"-Dummy" class="fb_like_privacy_dummy" />';d.append('<li class="facebook help_info"><span class="info">'+a.services.facebook.txt_info+'</span><span class="switch off">'+a.services.facebook.txt_fb_off+'</span><div class="fb_like dummy_btn">'+t+"</div></li>");var k=b("li.facebook",d);b("li.facebook div.fb_like img.fb_like_privacy_dummy,li.facebook span.switch",d).live("click",function(){k.find("span.switch").hasClass("off")?
|
22
|
-
(k.addClass("info_off"),k.find("span.switch").addClass("on").removeClass("off").html(a.services.facebook.txt_fb_on),k.find("img.fb_like_privacy_dummy").replaceWith(q)):(k.removeClass("info_off"),k.find("span.switch").addClass("off").removeClass("on").html(a.services.facebook.txt_fb_off),k.find(".fb_like").html(t))})}if(j){g=a.services.twitter.tweet_text;"function"===typeof g&&(g=g());var g=x(g,"120"),o=encodeURIComponent(c+a.services.twitter.referrer_track),e=encodeURIComponent(c),r='<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+
|
23
|
-
o+"&counturl="+e+"&text="+g+"&count=horizontal&lang="+a.services.twitter.language+'" style="width:130px; height:25px;"></iframe>',u='<img src="'+a.services.twitter.dummy_img+'" alt=""Tweet this"-Dummy" class="tweet_this_dummy" />';d.append('<li class="twitter help_info"><span class="info">'+a.services.twitter.txt_info+'</span><span class="switch off">'+a.services.twitter.txt_twitter_off+'</span><div class="tweet dummy_btn">'+u+"</div></li>");var l=b("li.twitter",d);b("li.twitter div.tweet img,li.twitter span.switch",
|
24
|
-
d).live("click",function(){l.find("span.switch").hasClass("off")?(l.addClass("info_off"),l.find("span.switch").addClass("on").removeClass("off").html(a.services.twitter.txt_twitter_on),l.find("img.tweet_this_dummy").replaceWith(r)):(l.removeClass("info_off"),l.find("span.switch").addClass("off").removeClass("on").html(a.services.twitter.txt_twitter_off),l.find(".tweet").html(u))})}if(n){var s='<div class="g-plusone" data-size="medium" data-href="'+(c+a.services.gplus.referrer_track)+'"></div><script type="text/javascript">window.___gcfg = {lang: "'+
|
25
|
-
a.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>',v='<img src="'+a.services.gplus.dummy_img+'" alt=""Google+1"-Dummy" class="gplus_one_dummy" />';d.append('<li class="gplus help_info"><span class="info">'+a.services.gplus.txt_info+'</span><span class="switch off">'+
|
26
|
-
a.services.gplus.txt_gplus_off+'</span><div class="gplusone dummy_btn">'+v+"</div></li>");var m=b("li.gplus",d);b("li.gplus div.gplusone img,li.gplus span.switch",d).live("click",function(){m.find("span.switch").hasClass("off")?(m.addClass("info_off"),m.find("span.switch").addClass("on").removeClass("off").html(a.services.gplus.txt_gplus_on),m.find("img.gplus_one_dummy").replaceWith(s)):(m.removeClass("info_off"),m.find("span.switch").addClass("off").removeClass("on").html(a.services.gplus.txt_gplus_off),
|
27
|
-
m.find(".gplusone").html(v))})}d.append('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="'+a.info_link+'"><span class="help_info icon"><span class="info">'+a.txt_help+"</span></span></a></div></li>");b(".help_info:not(.info_off)",d).live("mouseenter",function(){var a=b(this),c=window.setTimeout(function(){b(a).addClass("display")},500);b(this).data("timeout_id",c)});b(".help_info",d).live("mouseleave",function(){var a=b(this).data("timeout_id");window.clearTimeout(a);
|
28
|
-
b(this).hasClass("display")&&b(this).removeClass("display")});c="on"===a.services.facebook.perma_option;g="on"===a.services.twitter.perma_option;o="on"===a.services.gplus.perma_option;if((f&&c||j&&g||n&&o)&&(!b.browser.msie||b.browser.msie&&7<b.browser.version)){for(var i=document.cookie.split(";"),e="{",p=0;p<i.length;p+=1){var w=i[p].split("="),e=e+('"'+b.trim(w[0])+'":"'+b.trim(w[1])+'"');p<i.length-1&&(e+=",")}var e=JSON.parse(e+"}"),h=b("li.settings_info",d);h.find(".settings_info_menu").removeClass("perma_option_off");
|
29
|
-
h.find(".settings_info_menu").append('<span class="settings">Einstellungen</span><form><fieldset><legend>'+a.settings_perma+"</legend></fieldset></form>");f&&c&&(i="perma_on"===e.socialSharePrivacy_facebook?' checked="checked"':"",h.find("form fieldset").append('<input type="checkbox" name="perma_status_facebook" id="perma_status_facebook"'+i+' /><label for="perma_status_facebook">'+a.services.facebook.display_name+"</label>"));j&&g&&(i="perma_on"===e.socialSharePrivacy_twitter?' checked="checked"':
|
30
|
-
"",h.find("form fieldset").append('<input type="checkbox" name="perma_status_twitter" id="perma_status_twitter"'+i+' /><label for="perma_status_twitter">'+a.services.twitter.display_name+"</label>"));n&&o&&(i="perma_on"===e.socialSharePrivacy_gplus?' checked="checked"':"",h.find("form fieldset").append('<input type="checkbox" name="perma_status_gplus" id="perma_status_gplus"'+i+' /><label for="perma_status_gplus">'+a.services.gplus.display_name+"</label>"));h.find("span.settings").css("cursor","pointer");
|
31
|
-
b(h.find("span.settings"),d).live("mouseenter",function(){var a=window.setTimeout(function(){h.find(".settings_info_menu").removeClass("off").addClass("on")},500);b(this).data("timeout_id",a)});b(h,d).live("mouseleave",function(){var a=b(this).data("timeout_id");window.clearTimeout(a);h.find(".settings_info_menu").removeClass("on").addClass("off")});b(h.find("fieldset input")).live("click",function(c){var e=c.target.id,g="socialSharePrivacy_"+e.substr(e.lastIndexOf("_")+1,e.length);if(b("#"+c.target.id+
|
32
|
-
":checked").length){var c=a.cookie_expires,h=a.cookie_path,f=a.cookie_domain,i=new Date;i.setTime(i.getTime()+c*864E5);document.cookie=g+"=perma_on; expires="+i.toUTCString()+"; path="+h+"; domain="+f;b("form fieldset label[for="+e+"]",d).addClass("checked")}else{c=a.cookie_path;h=a.cookie_domain;f=new Date;f.setTime(f.getTime()-100);document.cookie=g+"=perma_on; expires="+f.toUTCString()+"; path="+c+"; domain="+h;b("form fieldset label[for="+e+"]",d).removeClass("checked")}});f&&c&&"perma_on"===
|
33
|
-
e.socialSharePrivacy_facebook&&b("li.facebook span.switch",d).click();j&&g&&"perma_on"===e.socialSharePrivacy_twitter&&b("li.twitter span.switch",d).click();n&&o&&"perma_on"===e.socialSharePrivacy_gplus&&b("li.gplus span.switch",d).click()}})}})(jQuery);
|