Commit a8726645b3b49037b7c19ff4405e36527b58a8be
Exists in
master
and in
27 other branches
Merge branch 'stoa' of gitlab.com:colivre/noosfero into stoa
Showing
194 changed files
with
2953 additions
and
2766 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 194 files displayed.
plugins/social_share_privacy/controllers/social_share_privacy_plugin_admin_controller.rb
1 | class SocialSharePrivacyPluginAdminController < AdminController | 1 | class SocialSharePrivacyPluginAdminController < AdminController |
2 | append_view_path File.join(File.dirname(__FILE__) + '/../views') | 2 | append_view_path File.join(File.dirname(__FILE__) + '/../views') |
3 | 3 | ||
4 | + protect 'edit_environment_features', :environment | ||
5 | + | ||
6 | + include SocialSharePrivacyPluginHelper | ||
7 | + | ||
4 | def index | 8 | def index |
5 | - available_networks = Dir[SocialSharePrivacyPlugin.root_path + 'public/javascripts/modules/*.js'].map { |entry| entry.split('/').last.gsub(/\.js$/,'') } | ||
6 | - @selected = environment.socialshare | ||
7 | - @tags = available_networks - @selected | 9 | + @settings = Noosfero::Plugin::Settings.new(environment, SocialSharePrivacyPlugin, params[:settings]) |
10 | + @settings.networks ||= [] | ||
11 | + | ||
12 | + @available_networks = social_share_privacy_networks.sort | ||
13 | + @settings.networks &= @available_networks | ||
14 | + @available_networks -= @settings.networks | ||
15 | + | ||
8 | if request.post? | 16 | if request.post? |
9 | - networks = params[:networks].map{ |network| network.strip } if params[:networks] | ||
10 | - environment.socialshare = networks | ||
11 | - if environment.save | ||
12 | - session[:notice] = _('Saved the selected social buttons') | ||
13 | - redirect_to :controller => 'plugins', :action => 'index' | 17 | + begin |
18 | + @settings.save! | ||
19 | + session[:notice] = _('Option updated successfully.') | ||
20 | + rescue Exception => exception | ||
21 | + session[:notice] = _('Option wasn\'t updated successfully.') | ||
14 | end | 22 | end |
23 | + redirect_to :controller => 'plugins', :action => 'index' | ||
15 | end | 24 | end |
16 | end | 25 | end |
17 | 26 |
plugins/social_share_privacy/lib/social_share_privacy_plugin.rb
@@ -8,16 +8,23 @@ class SocialSharePrivacyPlugin < Noosfero::Plugin | @@ -8,16 +8,23 @@ class SocialSharePrivacyPlugin < Noosfero::Plugin | ||
8 | _("A plugin that adds share buttons from other networks.") | 8 | _("A plugin that adds share buttons from other networks.") |
9 | end | 9 | end |
10 | 10 | ||
11 | + def self.networks_default_setting | ||
12 | + [] | ||
13 | + end | ||
14 | + | ||
11 | def stylesheet? | 15 | def stylesheet? |
12 | true | 16 | true |
13 | end | 17 | end |
14 | 18 | ||
15 | - def social_buttons_javascript(article) | 19 | + def social_buttons_contents |
16 | proc do | 20 | proc do |
17 | - javascript_include_tag('plugins/social_share_privacy/javascripts/socialshareprivacy.js') + | ||
18 | - javascript_include_tag(environment.socialshare.map { |service| "plugins/social_share_privacy/javascripts/modules/#{service}.js" }) + | ||
19 | - javascript_tag("jQuery.fn.socialSharePrivacy.settings.path_prefix = '../../plugins/social_share_privacy/'; jQuery.fn.socialSharePrivacy.settings.order = #{environment.socialshare}; jQuery(document).ready(function () { jQuery('.social-buttons').socialSharePrivacy({perma_option: false, info_link_target: '_blank'});});") + | ||
20 | - content_tag(:div, '',:class => "social-buttons") | 21 | + settings = Noosfero::Plugin::Settings.new(environment, SocialSharePrivacyPlugin) |
22 | + locale = FastGettext.locale | ||
23 | + javascript_include_tag('plugins/social_share_privacy/socialshareprivacy/javascripts/socialshareprivacy.js') + | ||
24 | + javascript_include_tag(settings.get_setting(:networks).map { |service| "plugins/social_share_privacy/socialshareprivacy/javascripts/modules/#{service}.js" }) + | ||
25 | + (locale != 'en' ? javascript_include_tag("plugins/social_share_privacy/socialshareprivacy/javascripts/locale/jquery.socialshareprivacy.min.#{locale}.js") : '') + | ||
26 | + javascript_tag("jQuery.fn.socialSharePrivacy.settings.path_prefix = '../../plugins/social_share_privacy/socialshareprivacy/'; jQuery.fn.socialSharePrivacy.settings.order = #{settings.get_setting(:networks)}; jQuery(document).ready(function () { jQuery('.social-buttons').socialSharePrivacy({perma_option: false, info_link_target: '_blank'});});") + | ||
27 | + content_tag(:div, '', :class => "social-buttons") | ||
21 | end | 28 | end |
22 | end | 29 | end |
23 | 30 |
plugins/social_share_privacy/lib/social_share_privacy_plugin_helper.rb
0 → 100644
plugins/social_share_privacy/public/images/box_fbshare.png
4.57 KB
plugins/social_share_privacy/public/images/box_mail.png
2.26 KB
plugins/social_share_privacy/public/images/box_tumblr.png
2.42 KB
plugins/social_share_privacy/public/images/de/dummy_box_facebook.png
1.01 KB
plugins/social_share_privacy/public/images/de/dummy_facebook.png
884 Bytes
plugins/social_share_privacy/public/images/dummy_box_buffer.png
1.53 KB
plugins/social_share_privacy/public/images/dummy_box_delicious.png
870 Bytes
plugins/social_share_privacy/public/images/dummy_box_disqus.png
984 Bytes
plugins/social_share_privacy/public/images/dummy_box_facebook.png
782 Bytes
plugins/social_share_privacy/public/images/dummy_box_flattr.png
1.09 KB
plugins/social_share_privacy/public/images/dummy_box_gplus.png
842 Bytes
plugins/social_share_privacy/public/images/dummy_box_hackernews.png
644 Bytes
plugins/social_share_privacy/public/images/dummy_box_linkedin.png
1.62 KB
plugins/social_share_privacy/public/images/dummy_box_pinterest.png
1.5 KB
plugins/social_share_privacy/public/images/dummy_box_reddit.png
964 Bytes
plugins/social_share_privacy/public/images/dummy_box_stumbleupon.png
1.05 KB
plugins/social_share_privacy/public/images/dummy_box_twitter.png
1.04 KB
plugins/social_share_privacy/public/images/dummy_box_xing.png
1.22 KB
plugins/social_share_privacy/public/images/dummy_buffer.png
1.29 KB
plugins/social_share_privacy/public/images/dummy_delicious.png
877 Bytes
plugins/social_share_privacy/public/images/dummy_disqus.png
856 Bytes
plugins/social_share_privacy/public/images/dummy_facebook.png
651 Bytes
plugins/social_share_privacy/public/images/dummy_flattr.png
825 Bytes
plugins/social_share_privacy/public/images/dummy_gplus.png
661 Bytes
plugins/social_share_privacy/public/images/dummy_gplus_alt.png
409 Bytes
plugins/social_share_privacy/public/images/dummy_hackernews.png
343 Bytes
plugins/social_share_privacy/public/images/dummy_linkedin.png
1.25 KB
plugins/social_share_privacy/public/images/dummy_pinterest.png
1.12 KB
plugins/social_share_privacy/public/images/dummy_reddit.png
1018 Bytes
plugins/social_share_privacy/public/images/dummy_stumbleupon.png
1.08 KB
plugins/social_share_privacy/public/images/dummy_twitter.png
965 Bytes
plugins/social_share_privacy/public/images/dummy_xing.png
1.05 KB
plugins/social_share_privacy/public/images/es/dummy_box_facebook.png
880 Bytes
plugins/social_share_privacy/public/images/es/dummy_facebook.png
760 Bytes
plugins/social_share_privacy/public/images/fbshare.png
1.06 KB
plugins/social_share_privacy/public/images/fr/dummy_box_facebook.png
713 Bytes
plugins/social_share_privacy/public/images/fr/dummy_facebook.png
768 Bytes
plugins/social_share_privacy/public/images/fr/dummy_twitter.png
985 Bytes
plugins/social_share_privacy/public/images/mail.png
1.13 KB
plugins/social_share_privacy/public/images/nl/dummy_box_facebook.png
713 Bytes
plugins/social_share_privacy/public/images/nl/dummy_facebook.png
518 Bytes
plugins/social_share_privacy/public/images/nl/dummy_twitter.png
740 Bytes
plugins/social_share_privacy/public/images/pt/dummy_box_facebook.png
738 Bytes
plugins/social_share_privacy/public/images/pt/dummy_box_twitter.png
960 Bytes
plugins/social_share_privacy/public/images/pt/dummy_facebook.png
540 Bytes
plugins/social_share_privacy/public/images/pt/dummy_twitter.png
801 Bytes
plugins/social_share_privacy/public/images/ru/dummy_box_facebook.png
870 Bytes
plugins/social_share_privacy/public/images/ru/dummy_facebook.png
742 Bytes
plugins/social_share_privacy/public/images/settings.png
658 Bytes
plugins/social_share_privacy/public/images/socialshareprivacy_info.png
151 Bytes
plugins/social_share_privacy/public/images/socialshareprivacy_on_off.png
1.27 KB
plugins/social_share_privacy/public/images/tumblr.png
1.71 KB
plugins/social_share_privacy/public/javascripts/autoload.js
plugins/social_share_privacy/public/javascripts/localstorage.js
@@ -1,31 +0,0 @@ | @@ -1,31 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - * Spread the word, link to us if you can. | ||
9 | - */ | ||
10 | -(function ($, undefined) { | ||
11 | - "use strict"; | ||
12 | - | ||
13 | - $.extend($.fn.socialSharePrivacy.settings, { | ||
14 | - // Set perma_option to true. | ||
15 | - // Initially it is only set to true if jQuery.cookie is available. | ||
16 | - perma_option: true, | ||
17 | - set_perma_option: function (service_name) { | ||
18 | - localStorage.setItem('socialSharePrivacy_'+service_name, 'perma_on'); | ||
19 | - }, | ||
20 | - del_perma_option: function (service_name) { | ||
21 | - localStorage.removeItem('socialSharePrivacy_'+service_name); | ||
22 | - }, | ||
23 | - // Only one of the two methods "get_perma_options" and "get_perma_option" has | ||
24 | - // to be implemented. Though the other has to be set to null, so the default | ||
25 | - // cookie based method is not used. | ||
26 | - get_perma_options: null, | ||
27 | - get_perma_option: function (service_name) { | ||
28 | - return localStorage.getItem('socialSharePrivacy_'+service_name) === 'perma_on'; | ||
29 | - } | ||
30 | - }); | ||
31 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/buffer.js
@@ -1,54 +0,0 @@ | @@ -1,54 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | -(function ($, undefined) { | ||
17 | - "use strict"; | ||
18 | - | ||
19 | - function get (self, options, uri, settings, name) { | ||
20 | - var value = options[name]; | ||
21 | - if (typeof value === "function") { | ||
22 | - return value.call(self, options, uri, settings); | ||
23 | - } | ||
24 | - return String(value); | ||
25 | - } | ||
26 | - | ||
27 | - $.fn.socialSharePrivacy.settings.services.buffer = { | ||
28 | - 'status' : true, | ||
29 | - 'dummy_line_img' : 'images/dummy_buffer.png', | ||
30 | - 'dummy_box_img' : 'images/dummy_box_buffer.png', | ||
31 | - 'dummy_alt' : '"Buffer"-Dummy', | ||
32 | - 'txt_info' : 'Two clicks for more privacy: The Buffer button will be enabled once you click here. Activating the button already sends data to Buffer – see <em>i</em>.', | ||
33 | - 'txt_off' : 'not connected to Buffer', | ||
34 | - 'txt_on' : 'connected to Buffer', | ||
35 | - 'perma_option' : true, | ||
36 | - 'display_name' : 'Buffer', | ||
37 | - 'referrer_track' : '', | ||
38 | - 'via' : '', | ||
39 | - 'text' : $.fn.socialSharePrivacy.getTitle, | ||
40 | - 'picture' : $.fn.socialSharePrivacy.getImage, | ||
41 | - 'button' : function (options, uri, settings) { | ||
42 | - return $('<iframe allowtransparency="true" frameborder="0" scrolling="no"></iframe>').attr( | ||
43 | - 'src', 'https://widgets.bufferapp.com/button/?'+$.param({ | ||
44 | - count : settings.layout === 'line' ? 'horizontal' : 'vertical', | ||
45 | - via : get(this, options, uri, settings, 'via'), | ||
46 | - text : $.fn.socialSharePrivacy.abbreviateText( | ||
47 | - get(this, options, uri, settings, 'text'), 120), | ||
48 | - picture : get(this, options, uri, settings, 'picture'), | ||
49 | - url : uri + options.referrer_track, | ||
50 | - source : 'button' | ||
51 | - })); | ||
52 | - } | ||
53 | - }; | ||
54 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/delicious.js
@@ -1,85 +0,0 @@ | @@ -1,85 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - * Code inspired by Delicious Button v1.1: | ||
9 | - * http://code.google.com/p/delicious-button/ | ||
10 | - * | ||
11 | - * Warning: this button uses plaintext http and can be harmful to users under opressive regimes | ||
12 | - * | ||
13 | - */ | ||
14 | -(function ($, undefined) { | ||
15 | - "use strict"; | ||
16 | - | ||
17 | - $.fn.socialSharePrivacy.settings.services.delicious = { | ||
18 | - 'status' : true, | ||
19 | - 'dummy_line_img' : 'images/dummy_delicious.png', | ||
20 | - 'dummy_box_img' : 'images/dummy_box_delicious.png', | ||
21 | - 'dummy_alt' : '"Delicious"-Dummy', | ||
22 | - 'txt_info' : 'Two clicks for more privacy: The Delicious button will be enabled once you click here. Activating the button already sends data to Delicious – see <em>i</em>.', | ||
23 | - 'txt_off' : 'not connected to Delicious', | ||
24 | - 'txt_on' : 'connected to Delicious', | ||
25 | - 'perma_option' : true, | ||
26 | - 'display_name' : 'Delicious', | ||
27 | - 'txt_button' : 'Save', | ||
28 | - 'referrer_track' : '', | ||
29 | - 'title' : $.fn.socialSharePrivacy.getTitle, | ||
30 | - 'button' : function (options, uri, settings) { | ||
31 | - var $button = $('<div class="delicious-widget"/>'); | ||
32 | - var url = uri + options.referrer_track; | ||
33 | - | ||
34 | - $.ajax({ | ||
35 | - url: "http://feeds.delicious.com/v2/json/urlinfo/data", | ||
36 | - data: {url: url}, | ||
37 | - dataType: "jsonp", | ||
38 | - success: function (counts) { | ||
39 | - var hash, total_posts, title, txt_button; | ||
40 | - for (var i = 0; i < counts.length; ++ i) { | ||
41 | - var count = counts[i]; | ||
42 | - if (count.url === url) { | ||
43 | - total_posts = parseInt(count.total_posts, 10); | ||
44 | - hash = count.hash; | ||
45 | - title = count.title; | ||
46 | - break; | ||
47 | - } | ||
48 | - } | ||
49 | - if (total_posts) txt_button = $.fn.socialSharePrivacy.formatNumber(total_posts); | ||
50 | - else txt_button = options.txt_button; | ||
51 | - var save_url = "http://delicious.com/save?"+$.param({ | ||
52 | - v: "5", | ||
53 | - url: url, | ||
54 | - title: (typeof options.title === "function" ? | ||
55 | - options.title.call(this, options, uri, settings) : | ||
56 | - String(options.title)) || title | ||
57 | - }); | ||
58 | - | ||
59 | - $button.html('<a target="delicious" class="icon"><div class="delicious1"></div><div class="delicious2"></div><div class="delicious3"></div></a><a class="count" target="delicious"><i></i><b></b></a>'); | ||
60 | - $button.find('i').text(options.txt_button); | ||
61 | - $button.find('b').text(txt_button); | ||
62 | - $button.find('a.icon').attr("href", hash ? "http://delicious.com/url/" + hash : save_url); | ||
63 | - var $count = $button.find('a.count').attr("href", save_url).click(function (event) { | ||
64 | - window.open(save_url + "&noui&jump=close", "delicious", "toolbar=no,width=555,height=555"); | ||
65 | - event.preventDefault(); | ||
66 | - }); | ||
67 | - | ||
68 | - if (total_posts) { | ||
69 | - $count.hover(function () { | ||
70 | - var $self = $(this); | ||
71 | - $self.find("b").stop(1, 1).css("display", "none"); | ||
72 | - $self.find("i").fadeIn(); | ||
73 | - }, function () { | ||
74 | - var $self = $(this); | ||
75 | - $self.find("i").stop(1, 1).css("display", "none"); | ||
76 | - $self.find("b").fadeIn(); | ||
77 | - }); | ||
78 | - } | ||
79 | - } | ||
80 | - }); | ||
81 | - | ||
82 | - return $button; | ||
83 | - } | ||
84 | - }; | ||
85 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/disqus.js
@@ -1,77 +0,0 @@ | @@ -1,77 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - */ | ||
9 | -(function ($, undefined) { | ||
10 | - "use strict"; | ||
11 | - | ||
12 | - var DISQUSWIDGETS = { | ||
13 | - displayCount: function (data) { | ||
14 | - $('.social_share_privacy_area .disqus .disqus-widget:not(.init)').each(function () { | ||
15 | - var $widget = $(this); | ||
16 | - var uri = data.counts[0].id; | ||
17 | - if ($widget.attr("data-uri") === uri) { | ||
18 | - var key = $widget.attr("data-count"); | ||
19 | - var count = data.counts[0][key]; | ||
20 | - var text = data.text[key]; | ||
21 | - var scount = $.fn.socialSharePrivacy.formatNumber(count); | ||
22 | - $widget.attr('title', count === 0 ? text.zero : count === 1 ? text.one : text.multiple.replace('{num}', scount)); | ||
23 | - $widget.find('.count a').text(scount); | ||
24 | - $widget.addClass('init'); | ||
25 | - } | ||
26 | - }); | ||
27 | - } | ||
28 | - }; | ||
29 | - | ||
30 | - $.fn.socialSharePrivacy.settings.services.disqus = { | ||
31 | - 'status' : true, | ||
32 | - 'dummy_line_img' : 'images/dummy_disqus.png', | ||
33 | - 'dummy_box_img' : 'images/dummy_box_disqus.png', | ||
34 | - 'dummy_alt' : '"Disqus"-Dummy', | ||
35 | - 'txt_info' : 'Two clicks for more privacy: The Disqus button will be enabled once you click here. Activating the button already sends data to Disqus – see <em>i</em>.', | ||
36 | - 'txt_off' : 'not connected to Disqus', | ||
37 | - 'txt_on' : 'connected to Disqus', | ||
38 | - 'perma_option' : true, | ||
39 | - 'display_name' : 'Disqus', | ||
40 | - 'referrer_track' : '', | ||
41 | - 'shortname' : '', | ||
42 | - 'count' : 'comments', | ||
43 | - 'onclick' : null, | ||
44 | - 'button' : function (options, uri, settings) { | ||
45 | - var shortname = options.shortname || window.disqus_shortname || ''; | ||
46 | - var $code; | ||
47 | - if (settings.layout === 'line') { | ||
48 | - $code = $('<div class="disqus-widget">'+ | ||
49 | - '<a href="#disqus_thread" class="name">Disq<span class="us">us</span></a>'+ | ||
50 | - '<span class="count"><i></i><u></u><a href="#disqus_thread"> </a></span></div>'); | ||
51 | - } | ||
52 | - else { | ||
53 | - $code = $('<div class="disqus-widget">'+ | ||
54 | - '<div class="count"><i></i><u></u><a href="#disqus_thread"> </a></div>'+ | ||
55 | - '<a href="#disqus_thread" class="name">Disq<span class="us">us</span></a></div>'); | ||
56 | - } | ||
57 | - | ||
58 | - $code.attr({ | ||
59 | - 'data-count' : options.count, | ||
60 | - 'data-shortname' : shortname, | ||
61 | - 'data-uri' : uri + options.referrer_track | ||
62 | - }); | ||
63 | - | ||
64 | - if (options.onclick) { | ||
65 | - $code.find('a').click(typeof options.onclick === "function" ? | ||
66 | - options.onclick : new Function("event", options.onclick)); | ||
67 | - } | ||
68 | - | ||
69 | - // this breaks every other usage of the disqus count API: | ||
70 | - window.DISQUSWIDGETS = DISQUSWIDGETS; | ||
71 | - | ||
72 | - $.getScript('https://'+shortname+'.disqus.com/count-data.js?2='+encodeURIComponent(uri + options.referrer_track)); | ||
73 | - | ||
74 | - return $code; | ||
75 | - } | ||
76 | - }; | ||
77 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/facebook.js
@@ -1,81 +0,0 @@ | @@ -1,81 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | -(function ($, undefined) { | ||
17 | - "use strict"; | ||
18 | - | ||
19 | - var locales = {"af":["ZA"],"ar":["AR"],"az":["AZ"],"be":["BY"],"bg":["BG"],"bn":["IN"],"bs":["BA"],"ca":["ES"],"cs":["CZ"],"cy":["GB"],"da":["DK"],"de":["DE"],"el":["GR"],"en":["GB","PI","UD","US"],"eo":["EO"],"es":["ES","LA"],"et":["EE"],"eu":["ES"],"fa":["IR"],"fb":["LT"],"fi":["FI"],"fo":["FO"],"fr":["CA","FR"],"fy":["NL"],"ga":["IE"],"gl":["ES"],"he":["IL"],"hi":["IN"],"hr":["HR"],"hu":["HU"],"hy":["AM"],"id":["ID"],"is":["IS"],"it":["IT"],"ja":["JP"],"ka":["GE"],"km":["KH"],"ko":["KR"],"ku":["TR"],"la":["VA"],"lt":["LT"],"lv":["LV"],"mk":["MK"],"ml":["IN"],"ms":["MY"],"nb":["NO"],"ne":["NP"],"nl":["NL"],"nn":["NO"],"pa":["IN"],"pl":["PL"],"ps":["AF"],"pt":["BR","PT"],"ro":["RO"],"ru":["RU"],"sk":["SK"],"sl":["SI"],"sq":["AL"],"sr":["RS"],"sv":["SE"],"sw":["KE"],"ta":["IN"],"te":["IN"],"th":["TH"],"tl":["PH"],"tr":["TR"],"uk":["UA"],"vi":["VN"],"zh":["CN","HK","TW"]}; | ||
20 | - | ||
21 | - $.fn.socialSharePrivacy.settings.services.facebook = { | ||
22 | - 'status' : true, | ||
23 | - 'button_class' : 'fb_like', | ||
24 | - 'dummy_line_img' : 'images/dummy_facebook.png', | ||
25 | - 'dummy_box_img' : 'images/dummy_box_facebook.png', | ||
26 | - 'dummy_alt' : 'Facebook "Like"-Dummy', | ||
27 | - 'txt_info' : 'Two clicks for more privacy: The Facebook Like button will be enabled once you click here. Activating the button already sends data to Facebook – see <em>i</em>.', | ||
28 | - 'txt_off' : 'not connected to Facebook', | ||
29 | - 'txt_on' : 'connected to Facebook', | ||
30 | - 'perma_option' : true, | ||
31 | - 'display_name' : 'Facebook Like/Recommend', | ||
32 | - 'referrer_track' : '', | ||
33 | - 'action' : 'like', | ||
34 | - 'colorscheme' : 'light', | ||
35 | - 'font' : '', | ||
36 | - 'button' : function (options, uri, settings) { | ||
37 | - // ensure a locale that is supported by facebook | ||
38 | - // otherwise facebook renders nothing | ||
39 | - var match = /^([a-z]{2})_([A-Z]{2})$/.exec(options.language); | ||
40 | - var locale = "en_US"; | ||
41 | - | ||
42 | - if (match) { | ||
43 | - if (match[1] in locales) { | ||
44 | - var subs = locales[match[1]]; | ||
45 | - if ($.inArray(match[2], subs) !== -1) { | ||
46 | - locale = options.language; | ||
47 | - } | ||
48 | - else { | ||
49 | - locale = match[1]+"_"+subs[0]; | ||
50 | - } | ||
51 | - } | ||
52 | - } | ||
53 | - else if (options.language in locales) { | ||
54 | - locale = options.language+"_"+locales[options.language][0]; | ||
55 | - } | ||
56 | - | ||
57 | - var params = { | ||
58 | - locale : locale, | ||
59 | - href : uri + options.referrer_track, | ||
60 | - send : 'false', | ||
61 | - show_faces : 'false', | ||
62 | - action : options.action, | ||
63 | - colorscheme: options.colorscheme | ||
64 | - }; | ||
65 | - if (options.font) params.font = options.font; | ||
66 | - | ||
67 | - if (settings.layout === 'line') { | ||
68 | - params.width = '120'; | ||
69 | - params.height = '20'; | ||
70 | - params.layout = 'button_count'; | ||
71 | - } | ||
72 | - else { | ||
73 | - params.width = 62; | ||
74 | - params.height = 61; | ||
75 | - params.layout = 'box_count'; | ||
76 | - } | ||
77 | - return $('<iframe scrolling="no" frameborder="0" allowtransparency="true"></iframe>').attr( | ||
78 | - 'src', 'https://www.facebook.com/plugins/like.php?'+$.param(params)); | ||
79 | - } | ||
80 | - }; | ||
81 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/fbshare.js
@@ -1,38 +0,0 @@ | @@ -1,38 +0,0 @@ | ||
1 | -/* | ||
2 | - * Facebook share module for 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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * Fbshare module: | ||
13 | - * copyright (c) 2013 zzzen.com | ||
14 | - * | ||
15 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
16 | - * | ||
17 | - * Spread the word, link to us if you can. | ||
18 | - */ | ||
19 | -(function ($, undefined) { | ||
20 | - "use strict"; | ||
21 | - | ||
22 | - $.fn.socialSharePrivacy.settings.services.fbshare = { | ||
23 | - 'status' : true, | ||
24 | - 'privacy' : 'safe', | ||
25 | - 'button_class' : 'fbshare', | ||
26 | - 'line_img' : 'images/fbshare.png', | ||
27 | - 'box_img' : 'images/box_fbshare.png', | ||
28 | - 'txt_info' : 'Share via facebook.', | ||
29 | - 'txt_button' : 'Facebook Share', | ||
30 | - 'display_name' : 'Facebook Share', | ||
31 | - 'referrer_track' : '', | ||
32 | - 'button' : function (options, uri, settings) { | ||
33 | - return $('<a/>', {target: '_blank', href: 'https://www.facebook.com/sharer/sharer.php?'+$.param({u:uri + options.referrer_track})}).append( | ||
34 | - $('<img>', {alt: options.txt_button, | ||
35 | - src: options.path_prefix + (settings.layout === 'line' ? options.line_img : options.box_img)})); | ||
36 | - } | ||
37 | - }; | ||
38 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/flattr.js
@@ -1,72 +0,0 @@ | @@ -1,72 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - * Spread the word, link to us if you can. | ||
9 | - */ | ||
10 | - | ||
11 | -(function ($, undefined) { | ||
12 | - "use strict"; | ||
13 | - | ||
14 | - function get (self, options, uri, settings, name) { | ||
15 | - var value = options[name]; | ||
16 | - if (typeof value === "function") { | ||
17 | - return value.call(self, options, uri, settings); | ||
18 | - } | ||
19 | - return String(value); | ||
20 | - } | ||
21 | - | ||
22 | - // using an unsupported language breaks the flattr button | ||
23 | - var langs = {en:true,sq:true,ar:true,be:true,bg:true,ca:true,zh:true,hr:true,cs:true,da:true,nl:true,eo:true,et:true,fi:true,fr:true,es:true,de:true,el:true,iw:true,hi:true,hu:true,is:true,'in':true,ga:true,it:true,ja:true,ko:true,lv:true,lt:true,mk:true,ms:true,mt:true,no:true,nn:true,fa:true,pl:true,pt:true,ro:true,ru:true,sr:true,sk:true,sl:true,sv:true,th:true,tr:true,uk:true,vi:true}; | ||
24 | - | ||
25 | - $.fn.socialSharePrivacy.settings.services.flattr = { | ||
26 | - 'status' : true, | ||
27 | - 'button_class' : 'flattr', | ||
28 | - 'dummy_line_img' : 'images/dummy_flattr.png', | ||
29 | - 'dummy_box_img' : 'images/dummy_box_flattr.png', | ||
30 | - 'dummy_alt' : '"Flattr"-Dummy', | ||
31 | - 'txt_info' : 'Two clicks for more privacy: The Flattr button will be enabled once you click here. Activating the button already sends data to Flattr – see <em>i</em>.', | ||
32 | - 'txt_off' : 'not connected to Flattr', | ||
33 | - 'txt_on' : 'connected to Flattr', | ||
34 | - 'perma_option' : true, | ||
35 | - 'display_name' : 'Flattr', | ||
36 | - 'referrer_track' : '', | ||
37 | - 'title' : $.fn.socialSharePrivacy.getTitle, | ||
38 | - 'description' : $.fn.socialSharePrivacy.getDescription, | ||
39 | - 'uid' : '', | ||
40 | - 'category' : '', | ||
41 | - 'tags' : '', | ||
42 | - 'popout' : '', | ||
43 | - 'hidden' : '', | ||
44 | - 'button' : function (options, uri, settings) { | ||
45 | - var attrs = { | ||
46 | - href : uri + options.referrer_track, | ||
47 | - title : get(this, options, uri, settings, 'title') | ||
48 | - }; | ||
49 | - if (options.uid) attrs['data-flattr-uid'] = options.uid; | ||
50 | - if (options.hidden) attrs['data-flattr-hidden'] = options.hidden; | ||
51 | - if (options.popout) attrs['data-flattr-popout'] = options.popout; | ||
52 | - if (options.category) attrs['data-flattr-category'] = options.category; | ||
53 | - if (options.tags) attrs['data-flattr-tags'] = options.tags; | ||
54 | - if (options.language) { | ||
55 | - var lang = String(options.language).replace('-','_'); | ||
56 | - var baselang = lang.split('_')[0]; | ||
57 | - if (langs[baselang] === true) { | ||
58 | - attrs['data-flattr-language'] = attrs.lang = lang; | ||
59 | - } | ||
60 | - } | ||
61 | - if (settings.layout === 'line') attrs['data-flattr-button'] = 'compact'; | ||
62 | - | ||
63 | - var $code = $('<a class="FlattrButton">' + get(this, options, uri, settings, 'description') + | ||
64 | - '</a><script text="text/javscript" src="'+ | ||
65 | - 'https://api.flattr.com/js/0.6/load.js?mode=auto"></script>'); | ||
66 | - | ||
67 | - $code.filter('a').attr(attrs); | ||
68 | - | ||
69 | - return $code; | ||
70 | - } | ||
71 | - }; | ||
72 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/gplus.js
@@ -1,44 +0,0 @@ | @@ -1,44 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | -(function ($, undefined) { | ||
17 | - "use strict"; | ||
18 | - | ||
19 | - $.fn.socialSharePrivacy.settings.services.gplus = { | ||
20 | - 'status' : true, | ||
21 | - 'button_class' : 'gplusone', | ||
22 | - 'dummy_line_img' : 'images/dummy_gplus.png', | ||
23 | - 'dummy_box_img' : 'images/dummy_box_gplus.png', | ||
24 | - 'dummy_alt' : '"Google+1"-Dummy', | ||
25 | - 'txt_info' : 'Two clicks for more privacy: The Google+ button will be enabled once you click here. Activating the button already sends data to Google – see <em>i</em>.', | ||
26 | - 'txt_off' : 'not connected to Google+', | ||
27 | - 'txt_on' : 'connected to Google+', | ||
28 | - 'perma_option' : true, | ||
29 | - 'display_name' : 'Google+', | ||
30 | - 'referrer_track' : '', | ||
31 | - 'button' : function (options, uri, settings) { | ||
32 | - // we use the Google+ "asynchronous" code, standard code is flaky if inserted into dom after load | ||
33 | - var $code = $('<div class="g-plusone"></div><script type="text/javascript">window.___gcfg = {lang: "' + | ||
34 | - options.language.replace('_','-') + '"}; (function() { var po = document.createElement("script"); ' + | ||
35 | - 'po.type = "text/javascript"; po.async = true; po.src = "https://apis.google.com/js/plusone.js"; ' + | ||
36 | - 'var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); </script>'); | ||
37 | - $code.filter('.g-plusone').attr({ | ||
38 | - 'data-href': uri + options.referrer_track, | ||
39 | - 'data-size': settings.layout === 'line' ? 'medium' : 'tall' | ||
40 | - }); | ||
41 | - return $code; | ||
42 | - } | ||
43 | - }; | ||
44 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/hackernews.js
@@ -1,68 +0,0 @@ | @@ -1,68 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - */ | ||
9 | -(function ($, undefined) { | ||
10 | - "use strict"; | ||
11 | - | ||
12 | - $.fn.socialSharePrivacy.settings.services.hackernews = { | ||
13 | - 'status' : true, | ||
14 | - 'dummy_line_img' : 'images/dummy_hackernews.png', | ||
15 | - 'dummy_box_img' : 'images/dummy_box_hackernews.png', | ||
16 | - 'dummy_alt' : '"Hacker News"-Dummy', | ||
17 | - 'txt_info' : 'Two clicks for more privacy: The Hacker News button will be enabled once you click here. Activating the button already sends data to Hacker News – see <em>i</em>.', | ||
18 | - 'txt_off' : 'not connected to Hacker News', | ||
19 | - 'txt_on' : 'connected to Hacker News', | ||
20 | - 'perma_option' : true, | ||
21 | - 'display_name' : 'Hacker News', | ||
22 | - 'txt_n_points' : '{points} points', | ||
23 | - 'txt_one_point' : '1 point', | ||
24 | - 'referrer_track' : '', | ||
25 | - 'title' : $.fn.socialSharePrivacy.getTitle, | ||
26 | - 'button' : function (options, uri, settings) { | ||
27 | - var url = uri + options.referrer_track; | ||
28 | - var title = typeof(options.title) === 'function' ? | ||
29 | - options.title.call(this, options, uri, settings) : | ||
30 | - String(options.title); | ||
31 | - | ||
32 | - var $code; | ||
33 | - if (settings.layout === 'line') { | ||
34 | - $code = $('<div class="hackernews-widget">'+ | ||
35 | - '<a class="name" target="_blank">Y</a>'+ | ||
36 | - '<span class="points"><i></i><u></u><a target="_blank">submit</a></span></div>'); | ||
37 | - } | ||
38 | - else { | ||
39 | - $code = $('<div class="hackernews-widget">'+ | ||
40 | - '<div class="points"><i></i><u></u><a target="_blank">submit</a></div>'+ | ||
41 | - '<a class="name" target="_blank">Y</a></div>'); | ||
42 | - } | ||
43 | - | ||
44 | - $code.find("a").attr("href", "https://news.ycombinator.com/submitlink?"+$.param({ | ||
45 | - "u": url, | ||
46 | - "t": title | ||
47 | - })); | ||
48 | - | ||
49 | - $.ajax("https://api.thriftdb.com/api.hnsearch.com/items/_search?filter[fields][url][]="+encodeURIComponent(url), { | ||
50 | - dataType: "jsonp", | ||
51 | - success: function (data) { | ||
52 | - var item = data.results[0]; | ||
53 | - if (item) { | ||
54 | - item = item.item; | ||
55 | - var points = $.fn.socialSharePrivacy.formatNumber(item.points); | ||
56 | - $code.find("a").attr("href", "https://news.ycombinator.com/item?id="+item.id); | ||
57 | - $code.find(".points a").text(points).attr('title', | ||
58 | - item.points === 1 ? | ||
59 | - options.txt_one_point : | ||
60 | - options.txt_n_points.replace(/{points}/g, points)); | ||
61 | - } | ||
62 | - } | ||
63 | - }); | ||
64 | - | ||
65 | - return $code; | ||
66 | - } | ||
67 | - }; | ||
68 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/linkedin.js
@@ -1,53 +0,0 @@ | @@ -1,53 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | -(function ($, undefined) { | ||
17 | - "use strict"; | ||
18 | - | ||
19 | - $.fn.socialSharePrivacy.settings.services.linkedin = { | ||
20 | - 'status' : true, | ||
21 | - 'dummy_line_img' : 'images/dummy_linkedin.png', | ||
22 | - 'dummy_box_img' : 'images/dummy_box_linkedin.png', | ||
23 | - 'dummy_alt' : '"LinkedIn"-Dummy', | ||
24 | - 'txt_info' : 'Two clicks for more privacy: The Linked in button will be enabled once you click here. Activating the button already sends data to Linked in – see <em>i</em>.', | ||
25 | - 'txt_off' : 'not connected to LinkedIn', | ||
26 | - 'txt_on' : 'connected to LinkedIn', | ||
27 | - 'perma_option' : true, | ||
28 | - 'display_name' : 'LinkedIn', | ||
29 | - 'referrer_track' : '', | ||
30 | - 'onsuccess' : null, | ||
31 | - 'onerror' : null, | ||
32 | - 'showzero' : false, | ||
33 | - 'button' : function (options, uri, settings) { | ||
34 | - var attrs = { | ||
35 | - 'data-counter' : settings.layout === 'line' ? 'right' : 'top', | ||
36 | - 'data-url' : uri + options.referrer_track, | ||
37 | - 'data-showzero': String(options.showzero) | ||
38 | - }; | ||
39 | - if (options.onsuccess) attrs['data-onsuccess'] = options.onsuccess; | ||
40 | - if (options.onerror) attrs['data-onerror'] = options.onerror; | ||
41 | - var $code = $('<script type="IN/Share"></script>').attr(attrs); | ||
42 | - | ||
43 | - if (window.IN && window.IN.parse) { | ||
44 | - $code = $code.add('<script type="text/javascript">IN.parse(document.body);</script>'); | ||
45 | - } | ||
46 | - else if ($('script[src^="https://platform.linkedin.com/"]').length === 0) { | ||
47 | - $code = $code.add('<script type="text/javascript" src="https://platform.linkedin.com/in.js"></script>'); | ||
48 | - } | ||
49 | - | ||
50 | - return $code; | ||
51 | - } | ||
52 | - }; | ||
53 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/mail.js
@@ -1,50 +0,0 @@ | @@ -1,50 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - * Spread the word, link to us if you can. | ||
9 | - */ | ||
10 | -(function ($, undefined) { | ||
11 | - "use strict"; | ||
12 | - | ||
13 | - function get (self, options, uri, settings, name) { | ||
14 | - var value = options[name]; | ||
15 | - if (typeof value === "function") { | ||
16 | - value = value.call(self, options, uri, settings); | ||
17 | - } | ||
18 | - return String(value); | ||
19 | - } | ||
20 | - | ||
21 | - var getDescription = $.fn.socialSharePrivacy.getDescription; | ||
22 | - | ||
23 | - function getBody (options, uri, settings) { | ||
24 | - return getDescription.call(this, options, uri, settings) + '\n\n' + uri + options.referrer_track; | ||
25 | - } | ||
26 | - | ||
27 | - $.fn.socialSharePrivacy.settings.services.mail = { | ||
28 | - 'status' : true, | ||
29 | - 'privacy' : 'safe', | ||
30 | - 'button_class' : 'mail', | ||
31 | - 'line_img' : 'images/mail.png', | ||
32 | - 'box_img' : 'images/box_mail.png', | ||
33 | - 'txt_info' : 'Send this via email to a friend.', | ||
34 | - 'txt_button' : 'Send Email', | ||
35 | - 'display_name' : 'Mail', | ||
36 | - 'referrer_track' : '', | ||
37 | - 'subject' : $.fn.socialSharePrivacy.getTitle, | ||
38 | - 'body' : getBody, | ||
39 | - 'button' : function (options, uri, settings) { | ||
40 | - return $('<a/>').attr( | ||
41 | - 'href', 'mailto:?'+$.param({ | ||
42 | - subject : get(this, options, uri, settings, 'subject'), | ||
43 | - body : get(this, options, uri, settings, 'body') | ||
44 | - }).replace(/\+/g,'%20')).append($('<img>', { | ||
45 | - alt: options.txt_button, | ||
46 | - src: options.path_prefix + (settings.layout === 'line' ? options.line_img : options.box_img) | ||
47 | - })); | ||
48 | - } | ||
49 | - }; | ||
50 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/pinterest.js
@@ -1,83 +0,0 @@ | @@ -1,83 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | - | ||
17 | -(function ($, undefined) { | ||
18 | - "use strict"; | ||
19 | - | ||
20 | - function get (self, options, uri, settings, name) { | ||
21 | - var value = options[name]; | ||
22 | - if (typeof value === "function") { | ||
23 | - return value.call(self, options, uri, settings); | ||
24 | - } | ||
25 | - return String(value); | ||
26 | - } | ||
27 | - | ||
28 | - var loadingScript = false; | ||
29 | - function loadScript () { | ||
30 | - // prevent already loaded buttons from being broken: | ||
31 | - $('.social_share_privacy_area .pinterest .pinit a[data-pin-log]').attr('data-pin-do','ignore'); | ||
32 | - $.ajax({ | ||
33 | - url : 'https://assets.pinterest.com/js/pinit.js', | ||
34 | - dataType : 'script', | ||
35 | - cache : true | ||
36 | - }); | ||
37 | - // because there is no callback yet I have no choice but to do this now: | ||
38 | - loadingScript = false; | ||
39 | - } | ||
40 | - | ||
41 | - $.fn.socialSharePrivacy.settings.services.pinterest = { | ||
42 | - 'status' : true, | ||
43 | - 'button_class' : 'pinit', | ||
44 | - 'dummy_line_img' : 'images/dummy_pinterest.png', | ||
45 | - 'dummy_box_img' : 'images/dummy_box_pinterest.png', | ||
46 | - 'dummy_alt' : '"Pin it"-Dummy', | ||
47 | - 'txt_info' : 'Two clicks for more privacy: The Pin it button will be enabled once you click here. Activating the button already sends data to Pinterest – see <em>i</em>.', | ||
48 | - 'txt_off' : 'not connected to Pinterest', | ||
49 | - 'txt_on' : 'connected to Pinterest', | ||
50 | - 'perma_option' : true, | ||
51 | - 'display_name' : 'Pinterest', | ||
52 | - 'referrer_track' : '', | ||
53 | - 'title' : $.fn.socialSharePrivacy.getTitle, | ||
54 | - 'description' : $.fn.socialSharePrivacy.getDescription, | ||
55 | - 'media' : $.fn.socialSharePrivacy.getImage, | ||
56 | - 'button' : function (options, uri, settings) { | ||
57 | - var params = { | ||
58 | - url : uri + options.referrer_track, | ||
59 | - media : get(this, options, uri, settings, 'media') | ||
60 | - }; | ||
61 | - var title = get(this, options, uri, settings, 'title'); | ||
62 | - var description = get(this, options, uri, settings, 'description'); | ||
63 | - if (title) params.title = title; | ||
64 | - if (description) params.description = description; | ||
65 | - | ||
66 | - var $code = $('<a data-pin-do="buttonPin"><img /></a>'); | ||
67 | - | ||
68 | - $code.filter('a').attr({ | ||
69 | - 'data-pin-config' : settings.layout === 'line' ? 'beside' : 'above', | ||
70 | - href : 'https://pinterest.com/pin/create/button/?'+$.param(params) | ||
71 | - }).find('img').attr('src', 'https://assets.pinterest.com/images/pidgets/pin_it_button.png'); | ||
72 | - | ||
73 | - // This way when the user has permanently enabled pinterest and there are several pinterest | ||
74 | - // buttons on one webpage it will load the script only once and so the buttons will work: | ||
75 | - if (!loadingScript) { | ||
76 | - loadingScript = true; | ||
77 | - setTimeout(loadScript, 10); | ||
78 | - } | ||
79 | - | ||
80 | - return $code; | ||
81 | - } | ||
82 | - }; | ||
83 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/reddit.js
@@ -1,72 +0,0 @@ | @@ -1,72 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | - | ||
17 | -(function ($, undefined) { | ||
18 | - "use strict"; | ||
19 | - | ||
20 | - function get (self, options, uri, settings, name) { | ||
21 | - var value = options[name]; | ||
22 | - if (typeof value === "function") { | ||
23 | - return value.call(self, options, uri, settings); | ||
24 | - } | ||
25 | - return String(value); | ||
26 | - } | ||
27 | - | ||
28 | - $.fn.socialSharePrivacy.settings.services.reddit = { | ||
29 | - 'status' : true, | ||
30 | - 'button_class' : 'reddit', | ||
31 | - 'dummy_line_img' : 'images/dummy_reddit.png', | ||
32 | - 'dummy_box_img' : 'images/dummy_box_reddit.png', | ||
33 | - 'dummy_alt' : '"Reddit this!"-Dummy', | ||
34 | - 'txt_info' : 'Two clicks for more privacy: The reddit this! button will be enabled once you click here. Activating the button already sends data to reddit – see <em>i</em>.', | ||
35 | - 'txt_off' : 'not connected to reddit', | ||
36 | - 'txt_on' : 'connected to reddit', | ||
37 | - 'perma_option' : true, | ||
38 | - 'display_name' : 'Reddit', | ||
39 | - 'referrer_track' : '', | ||
40 | - 'title' : $.fn.socialSharePrivacy.getTitle, | ||
41 | - 'target' : '', | ||
42 | - 'newwindow' : '1', | ||
43 | - 'bgcolor' : 'transparent', | ||
44 | - 'bordercolor' : '', | ||
45 | - 'button' : function (options, uri, settings) { | ||
46 | - var base_url, w, layout; | ||
47 | - if (settings.layout === 'line') { | ||
48 | - w = 120; | ||
49 | - layout = '/button/button1.html?'; | ||
50 | - } | ||
51 | - else { | ||
52 | - w = 58; | ||
53 | - layout = '/button/button2.html?'; | ||
54 | - } | ||
55 | - base_url = 'https://redditstatic.s3.amazonaws.com'; | ||
56 | - var params = { | ||
57 | - url : uri + options.referrer_track, | ||
58 | - width : String(w) | ||
59 | - }; | ||
60 | - var title = get(this, options, uri, settings, 'title'); | ||
61 | - var target = get(this, options, uri, settings, 'target'); | ||
62 | - if (title) params.title = title; | ||
63 | - if (target) params.target = target; | ||
64 | - if (options.bgcolor) params.bgcolor = options.bgcolor; | ||
65 | - if (options.bordercolor) params.bordercolor = options.bordercolor; | ||
66 | - if (options.newwindow) params.newwindow = options.newwindow; | ||
67 | - | ||
68 | - return $('<iframe allowtransparency="true" frameborder="0" scrolling="no"></iframe>').attr( | ||
69 | - 'src', base_url+layout+$.param(params)); | ||
70 | - } | ||
71 | - }; | ||
72 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/stumbleupon.js
@@ -1,55 +0,0 @@ | @@ -1,55 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Warning: this button uses plaintext http and can be harmful to users under opressive regimes | ||
15 | - * | ||
16 | - */ | ||
17 | - | ||
18 | -(function ($, undefined) { | ||
19 | - "use strict"; | ||
20 | - | ||
21 | - $.fn.socialSharePrivacy.settings.services.stumbleupon = { | ||
22 | - 'status' : true, | ||
23 | - 'button_class' : 'stumbleupon', | ||
24 | - 'dummy_line_img' : 'images/dummy_stumbleupon.png', | ||
25 | - 'dummy_box_img' : 'images/dummy_box_stumbleupon.png', | ||
26 | - 'dummy_alt' : '"Stumble!"-Dummy', | ||
27 | - 'txt_info' : 'Two clicks for more privacy: The Stumble! button will be enabled once you click here. Activating the button already sends data to StumbleUpon – see <em>i</em>.', | ||
28 | - 'txt_off' : 'not connected to StumbleUpon', | ||
29 | - 'txt_on' : 'connected to StumbleUpon', | ||
30 | - 'perma_option' : true, | ||
31 | - 'display_name' : 'Stumble Upon', | ||
32 | - 'referrer_track' : '', | ||
33 | - 'button' : function (options, uri, settings) { | ||
34 | - var base_url = 'https:' === document.location.protocol ? 'https://' : 'http://'; | ||
35 | - var w, h; | ||
36 | - | ||
37 | - if (settings.layout === 'line') { | ||
38 | - w = '74'; | ||
39 | - h = '18'; | ||
40 | - base_url += 'badge.stumbleupon.com/badge/embed/1/?'; | ||
41 | - } | ||
42 | - else { | ||
43 | - w = '50'; | ||
44 | - h = '60'; | ||
45 | - base_url += 'badge.stumbleupon.com/badge/embed/5/?'; | ||
46 | - } | ||
47 | - | ||
48 | - return $('<iframe allowtransparency="true" frameborder="0" scrolling="no"></iframe>').attr({ | ||
49 | - src: base_url+$.param({url: uri + options.referrer_track}), | ||
50 | - width: w, | ||
51 | - height: h | ||
52 | - }); | ||
53 | - } | ||
54 | - }; | ||
55 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/tumblr.js
@@ -1,113 +0,0 @@ | @@ -1,113 +0,0 @@ | ||
1 | -/* | ||
2 | - * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz | ||
3 | - * | ||
4 | - * Copyright (c) 2012 Mathias Panzenböck | ||
5 | - * | ||
6 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
7 | - * | ||
8 | - * Spread the word, link to us if you can. | ||
9 | - */ | ||
10 | -(function ($, undefined) { | ||
11 | - "use strict"; | ||
12 | - | ||
13 | - function getQuote (options, uri, settings) { | ||
14 | - var text = $.trim($('article, p').text()); | ||
15 | - | ||
16 | - if (text.length <= 600) { | ||
17 | - return text; | ||
18 | - } | ||
19 | - | ||
20 | - var abbrev = text.slice(0, 597); | ||
21 | - if (/^\w+$/.test(text.slice(596,598))) { | ||
22 | - var match = /^(.*)\s\S*$/.exec(abbrev); | ||
23 | - if (match) { | ||
24 | - abbrev = match[1]; | ||
25 | - } | ||
26 | - } | ||
27 | - return $.trim(abbrev) + "\u2026"; | ||
28 | - } | ||
29 | - | ||
30 | - function getClickthru (options, uri) { | ||
31 | - return uri + options.referrer_track; | ||
32 | - } | ||
33 | - | ||
34 | - function get (self, options, uri, settings, name) { | ||
35 | - var value = options[name]; | ||
36 | - if (typeof value === "function") { | ||
37 | - return value.call(self, options, uri, settings); | ||
38 | - } | ||
39 | - return String(value); | ||
40 | - } | ||
41 | - | ||
42 | - function openTumblr (event) { | ||
43 | - var winx = window.screenX || window.screenLeft; | ||
44 | - var winy = window.screenY || window.screenTop; | ||
45 | - var winw = window.outerWidth || window.innerWidth; | ||
46 | - var winh = window.outerHeight || window.innerHeight; | ||
47 | - var width = 450; | ||
48 | - var height = 430; | ||
49 | - var x = Math.round(winx + (winw - width) * 0.5); | ||
50 | - var y = Math.round(winy + (winh - height) * 0.5); | ||
51 | - window.open(this.href, 't', 'left='+x+',top='+y+',toolbar=0,resizable=0,status=0,menubar=0,width='+width+',height='+height); | ||
52 | - event.preventDefault(); | ||
53 | - } | ||
54 | - | ||
55 | - $.fn.socialSharePrivacy.settings.services.tumblr = { | ||
56 | - 'status' : true, | ||
57 | - 'privacy' : 'safe', | ||
58 | - 'button_class' : 'tumblr', | ||
59 | - 'line_img' : 'images/tumblr.png', | ||
60 | - 'box_img' : 'images/box_tumblr.png', | ||
61 | - 'txt_info' : 'Post this on Tumblr.', | ||
62 | - 'txt_button' : 'Share on Tubmlr', | ||
63 | - 'display_name' : 'Tumblr', | ||
64 | - 'referrer_track' : '', | ||
65 | - 'type' : 'link', // possible values are 'link', 'quote', 'photo' or 'video' | ||
66 | - // type: 'link': | ||
67 | - 'name' : $.fn.socialSharePrivacy.getTitle, | ||
68 | - 'description' : $.fn.socialSharePrivacy.getDescription, | ||
69 | - // type: 'quote': | ||
70 | - 'quote' : getQuote, | ||
71 | - // type: 'photo': | ||
72 | - 'photo' : $.fn.socialSharePrivacy.getImage, | ||
73 | - 'clickthrou' : getClickthru, | ||
74 | - // type: 'video': | ||
75 | - 'embed' : $.fn.socialSharePrivacy.getEmbed, | ||
76 | - // type: 'photo' or 'video': | ||
77 | - 'caption' : $.fn.socialSharePrivacy.getDescription, | ||
78 | - 'button' : function (options, uri, settings) { | ||
79 | - var $code = $('<a target="_blank"/>').click(openTumblr); | ||
80 | - $('<img>', { | ||
81 | - alt: options.txt_button, | ||
82 | - src: options.path_prefix + (settings.layout === 'line' ? options.line_img : options.box_img) | ||
83 | - }).appendTo($code); | ||
84 | - switch (options.type) { | ||
85 | - case 'link': | ||
86 | - return $code.attr('href', 'https://www.tumblr.com/share/link?'+$.param({ | ||
87 | - url : uri + options.referrer_track, | ||
88 | - name : get(this, options, uri, settings, 'name'), | ||
89 | - description : get(this, options, uri, settings, 'description') | ||
90 | - })); | ||
91 | - | ||
92 | - case 'quote': | ||
93 | - return $code.attr('href', 'https://www.tumblr.com/share/quote?'+$.param({ | ||
94 | - source : uri + options.referrer_track, | ||
95 | - quote : get(this, options, uri, settings, 'quote') | ||
96 | - })); | ||
97 | - | ||
98 | - case 'photo': | ||
99 | - return $code.attr('href', 'https://www.tumblr.com/share/photo?'+$.param({ | ||
100 | - source : get(this, options, uri, settings, 'photo'), | ||
101 | - caption : get(this, options, uri, settings, 'caption'), | ||
102 | - clickthrou : get(this, options, uri, settings, 'clickthrou') | ||
103 | - })); | ||
104 | - | ||
105 | - case 'video': | ||
106 | - return $code.attr('href', 'https://www.tumblr.com/share/video?'+$.param({ | ||
107 | - embed : get(this, options, uri, settings, 'embed'), | ||
108 | - caption : get(this, options, uri, settings, 'caption') | ||
109 | - })); | ||
110 | - } | ||
111 | - } | ||
112 | - }; | ||
113 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/twitter.js
@@ -1,62 +0,0 @@ | @@ -1,62 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | - | ||
17 | -(function ($, undefined) { | ||
18 | - "use strict"; | ||
19 | - | ||
20 | - $.fn.socialSharePrivacy.settings.services.twitter = { | ||
21 | - 'status' : true, | ||
22 | - 'button_class' : 'tweet', | ||
23 | - 'dummy_line_img' : 'images/dummy_twitter.png', | ||
24 | - 'dummy_box_img' : 'images/dummy_box_twitter.png', | ||
25 | - 'dummy_alt' : '"Tweet this"-Dummy', | ||
26 | - 'txt_info' : 'Two clicks for more privacy: The Tweet this button will be enabled once you click here. Activating the button already sends data to Twitter – see <em>i</em>.', | ||
27 | - 'txt_off' : 'not connected to Twitter', | ||
28 | - 'txt_on' : 'connected to Twitter', | ||
29 | - 'perma_option' : true, | ||
30 | - 'display_name' : 'Twitter', | ||
31 | - 'referrer_track' : '', | ||
32 | - 'via' : '', | ||
33 | - 'related' : '', | ||
34 | - 'hashtags' : '', | ||
35 | - 'dnt' : true, | ||
36 | - 'text' : $.fn.socialSharePrivacy.getTitle, | ||
37 | - 'button' : function (options, uri, settings) { | ||
38 | - var text = typeof(options.text) === 'function' ? | ||
39 | - options.text.call(this, options, uri, settings) : | ||
40 | - String(options.text); | ||
41 | - // 120 is the max character count left after twitters automatic | ||
42 | - // url shortening with t.co | ||
43 | - text = $.fn.socialSharePrivacy.abbreviateText(text, 120); | ||
44 | - | ||
45 | - var params = { | ||
46 | - url : uri + options.referrer_track, | ||
47 | - counturl: uri, | ||
48 | - text : text, | ||
49 | - count : settings.layout === 'line' ? 'horizontal' : 'vertical', | ||
50 | - lang : options.language | ||
51 | - }; | ||
52 | - if (options.via) params.via = options.via; | ||
53 | - if (options.related) params.related = options.related; | ||
54 | - if (options.hashtags) params.hashtags = options.hashtags; | ||
55 | - if (options.dnt) params.dnt = options.dnt; | ||
56 | - | ||
57 | - return $('<iframe allowtransparency="true" frameborder="0" scrolling="no"></iframe>').attr( | ||
58 | - 'src', 'https://platform.twitter.com/widgets/tweet_button.html?' + | ||
59 | - $.param(params).replace(/\+/g,'%20')); | ||
60 | - } | ||
61 | - }; | ||
62 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/modules/xing.js
@@ -1,40 +0,0 @@ | @@ -1,40 +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 | - * Copyright (c) 2012 Mathias Panzenböck | ||
11 | - * | ||
12 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
13 | - * | ||
14 | - * Spread the word, link to us if you can. | ||
15 | - */ | ||
16 | -(function ($, undefined) { | ||
17 | - "use strict"; | ||
18 | - | ||
19 | - $.fn.socialSharePrivacy.settings.services.xing = { | ||
20 | - 'status' : true, | ||
21 | - 'dummy_line_img' : 'images/dummy_xing.png', | ||
22 | - 'dummy_box_img' : 'images/dummy_box_xing.png', | ||
23 | - 'dummy_alt' : '"XING"-Dummy', | ||
24 | - 'txt_info' : 'Two clicks for more privacy: The XING button will be enabled once you click here. Activating the button already sends data to XING – see <em>i</em>.', | ||
25 | - 'txt_off' : 'not connected to XING', | ||
26 | - 'txt_on' : 'connected to XING', | ||
27 | - 'perma_option' : true, | ||
28 | - 'display_name' : 'XING', | ||
29 | - 'referrer_track' : '', | ||
30 | - 'button' : function (options, uri, settings) { | ||
31 | - var $code = $('<script type="XING/Share"></script>').attr({ | ||
32 | - 'data-counter' : settings.layout === 'line' ? 'right' : 'top', | ||
33 | - 'data-url' : uri + options.referrer_track, | ||
34 | - 'data-lang' : options.language | ||
35 | - }); | ||
36 | - | ||
37 | - return $code.add("<script type='text/javascript'>(function(d, s) { var x = d.createElement(s); s = d.getElementsByTagName(s)[0]; x.src = 'https://www.xing-share.com/js/external/share.js'; s.parentNode.insertBefore(x, s); })(document, 'script');</script>"); | ||
38 | - } | ||
39 | - }; | ||
40 | -})(jQuery); |
plugins/social_share_privacy/public/javascripts/settings.js
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -/** | ||
2 | - * @license | ||
3 | - * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz | ||
4 | - * | ||
5 | - * Copyright (c) 2012-2013 Mathias Panzenböck | ||
6 | - * | ||
7 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
8 | - * | ||
9 | - * Spread the word, link to us if you can. | ||
10 | - */ | ||
11 | - | ||
12 | -// load global settings | ||
13 | -jQuery(document).ready(function ($) { | ||
14 | - "use strict"; | ||
15 | - | ||
16 | - $('script[type="application/x-social-share-privacy-settings"]').each(function () { | ||
17 | - var settings = (new Function('return ('+(this.textContent||this.innerText||this.text)+');')).call(this); | ||
18 | - | ||
19 | - if (typeof settings === "object") { | ||
20 | - $.extend(true, $.fn.socialSharePrivacy.settings, settings); | ||
21 | - } | ||
22 | - }); | ||
23 | -}); |
plugins/social_share_privacy/public/javascripts/socialshareprivacy.js
@@ -1,803 +0,0 @@ | @@ -1,803 +0,0 @@ | ||
1 | -/** | ||
2 | - * @license | ||
3 | - * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz | ||
4 | - * | ||
5 | - * http://www.heise.de/extras/socialshareprivacy/ | ||
6 | - * http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html | ||
7 | - * | ||
8 | - * Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt, | ||
9 | - * Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de | ||
10 | - * | ||
11 | - * Copyright (c) 2012-2013 Mathias Panzenböck | ||
12 | - * | ||
13 | - * is released under the MIT License http://www.opensource.org/licenses/mit-license.php | ||
14 | - * | ||
15 | - * Spread the word, link to us if you can. | ||
16 | - */ | ||
17 | -(function ($, undefined) { | ||
18 | - "use strict"; | ||
19 | - | ||
20 | - /* | ||
21 | - * helper functions | ||
22 | - */ | ||
23 | - | ||
24 | - /** | ||
25 | - * Build an absolute url using a base url. | ||
26 | - * The provided base url has to be a valid absolute url. It will not be validated! | ||
27 | - * If no base url is given the document location is used. | ||
28 | - * Schemes that behave other than http might not work. | ||
29 | - * This function tries to support file:-urls, but might fail in some cases. | ||
30 | - * email:-urls aren't supported at all (don't make sense anyway). | ||
31 | - */ | ||
32 | - function absurl (url, base) { | ||
33 | - if (!base) base = document.baseURI || $("html > head > base").last().attr("href") || document.location.href; | ||
34 | - if (!url) { | ||
35 | - return base; | ||
36 | - } | ||
37 | - else if (/^[a-z][-+\.a-z0-9]*:/i.test(url)) { | ||
38 | - // The scheme actually could contain any kind of alphanumerical unicode | ||
39 | - // character, but JavaScript regular expressions don't support unicode | ||
40 | - // character classes. Maybe /^[^:]+:/ or even /^.*:/ would be sufficient? | ||
41 | - return url; | ||
42 | - } | ||
43 | - else if (url.slice(0,2) === '//') { | ||
44 | - return /^[^:]+:/.exec(base)[0]+url; | ||
45 | - } | ||
46 | - | ||
47 | - var ch = url.charAt(0); | ||
48 | - if (ch === '/') { | ||
49 | - if (/^file:/i.test(base)) { | ||
50 | - // file scheme has no hostname | ||
51 | - return 'file://'+url; | ||
52 | - } | ||
53 | - else { | ||
54 | - return /^[^:]+:\/*[^\/]+/i.exec(base)[0]+url; | ||
55 | - } | ||
56 | - } | ||
57 | - else if (ch === '#') { | ||
58 | - // assume "#" only occures at the end indicating the fragment | ||
59 | - return base.replace(/#.*$/,'')+url; | ||
60 | - } | ||
61 | - else if (ch === '?') { | ||
62 | - // assume "?" and "#" only occure at the end indicating the query | ||
63 | - // and the fragment | ||
64 | - return base.replace(/[\?#].*$/,'')+url; | ||
65 | - } | ||
66 | - else { | ||
67 | - var path; | ||
68 | - if (/^file:/i.test(base)) { | ||
69 | - path = base.replace(/^file:\/{0,2}/i,''); | ||
70 | - base = "file://"; | ||
71 | - } | ||
72 | - else { | ||
73 | - var match = /^([^:]+:\/*[^\/]+)(\/.*?)?(\?.*?)?(#.*)?$/.exec(base); | ||
74 | - base = match[1]; | ||
75 | - path = match[2]||"/"; | ||
76 | - } | ||
77 | - | ||
78 | - path = path.split("/"); | ||
79 | - path.pop(); | ||
80 | - if (path.length === 0) { | ||
81 | - // Ensure leading "/". Of course this is only valid on | ||
82 | - // unix like filesystems. More magic would be needed to | ||
83 | - // support other filesystems. | ||
84 | - path.push(""); | ||
85 | - } | ||
86 | - path.push(url); | ||
87 | - return base+path.join("/"); | ||
88 | - } | ||
89 | - } | ||
90 | - | ||
91 | - function formatNumber (number) { | ||
92 | - number = Number(number); | ||
93 | - | ||
94 | - var prefix = ""; | ||
95 | - var suffix = ""; | ||
96 | - if (number < 0) { | ||
97 | - prefix = "-"; | ||
98 | - number = -number; | ||
99 | - } | ||
100 | - | ||
101 | - if (number === Infinity) { | ||
102 | - return prefix + "Infinity"; | ||
103 | - } | ||
104 | - | ||
105 | - if (number > 9999) { | ||
106 | - number = number / 1000; | ||
107 | - suffix = "K"; | ||
108 | - } | ||
109 | - | ||
110 | - number = Math.round(number); | ||
111 | - if (number === 0) { | ||
112 | - return "0"; | ||
113 | - } | ||
114 | - | ||
115 | - var buf = []; | ||
116 | - while (number > 0) { | ||
117 | - var part = String(number % 1000); | ||
118 | - | ||
119 | - number = Math.floor(number / 1000); | ||
120 | - if (number) { | ||
121 | - while (part.length < 3) { | ||
122 | - part = "0"+part; | ||
123 | - } | ||
124 | - } | ||
125 | - | ||
126 | - buf.unshift(part); | ||
127 | - } | ||
128 | - | ||
129 | - return prefix + buf.join(",") + suffix; | ||
130 | - } | ||
131 | - | ||
132 | - // helper function that gets the title of the current page | ||
133 | - function getTitle (options, uri, settings) { | ||
134 | - var title = settings && settings.title; | ||
135 | - if (typeof title === "function") { | ||
136 | - title = title.call(this, options, uri, settings); | ||
137 | - } | ||
138 | - | ||
139 | - if (title) { | ||
140 | - return title; | ||
141 | - } | ||
142 | - | ||
143 | - var title = $('meta[name="DC.title"]').attr('content'); | ||
144 | - var creator = $('meta[name="DC.creator"]').attr('content'); | ||
145 | - | ||
146 | - if (title && creator) { | ||
147 | - return title + ' - ' + creator; | ||
148 | - } else { | ||
149 | - return title || $('meta[property="og:title"]').attr('content') || $('title').text(); | ||
150 | - } | ||
151 | - } | ||
152 | - | ||
153 | - function getDescription (options, uri, settings) { | ||
154 | - var description = settings && settings.description; | ||
155 | - if (typeof description === "function") { | ||
156 | - description = description.call(this, options, uri, settings); | ||
157 | - } | ||
158 | - | ||
159 | - if (description) { | ||
160 | - return description; | ||
161 | - } | ||
162 | - | ||
163 | - return abbreviateText( | ||
164 | - $('meta[name="twitter:description"]').attr('content') || | ||
165 | - $('meta[itemprop="description"]').attr('content') || | ||
166 | - $('meta[name="description"]').attr('content') || | ||
167 | - $.trim($('article, p').first().text()) || $.trim($('body').text()), 3500); | ||
168 | - } | ||
169 | - | ||
170 | - var IMAGE_ATTR_MAP = { | ||
171 | - META : 'content', | ||
172 | - IMG : 'src', | ||
173 | - A : 'href', | ||
174 | - IFRAME : 'src', | ||
175 | - LINK : 'href' | ||
176 | - }; | ||
177 | - | ||
178 | - // find the largest image of the website | ||
179 | - // if no image at all is found use googles favicon service, which | ||
180 | - // defaults to a small globe (so there is always some image) | ||
181 | - function getImage (options, uri, settings) { | ||
182 | - var imgs, img = settings && settings.image; | ||
183 | - if (typeof img === "function") { | ||
184 | - img = img.call(this, options, uri, settings); | ||
185 | - } | ||
186 | - | ||
187 | - if (!img) { | ||
188 | - imgs = $('meta[property="image"], meta[property="og:image"], meta[property="og:image:url"], meta[name="twitter:image"], link[rel="image_src"], itemscope *[itemprop="image"]').first(); | ||
189 | - if (imgs.length > 0) { | ||
190 | - img = imgs.attr(IMAGE_ATTR_MAP[imgs[0].nodeName]); | ||
191 | - } | ||
192 | - } | ||
193 | - | ||
194 | - if (img) { | ||
195 | - return absurl(img); | ||
196 | - } | ||
197 | - | ||
198 | - imgs = $('img').filter(':visible').filter(function () { | ||
199 | - return $(this).parents('.social_share_privacy_area').length === 0; | ||
200 | - }); | ||
201 | - if (imgs.length === 0) { | ||
202 | - img = $('link[rel~="shortcut"][rel~="icon"]').attr('href'); | ||
203 | - if (img) return absurl(img); | ||
204 | - return 'http://www.google.com/s2/favicons?'+$.param({domain:location.hostname}); | ||
205 | - } | ||
206 | - imgs.sort(function (lhs, rhs) { | ||
207 | - return rhs.offsetWidth * rhs.offsetHeight - lhs.offsetWidth * lhs.offsetHeight; | ||
208 | - }); | ||
209 | - // browser makes src absolute: | ||
210 | - return imgs[0].src; | ||
211 | - } | ||
212 | - | ||
213 | - // abbreviate at last blank before length and add "\u2026" (horizontal ellipsis) | ||
214 | - function abbreviateText (text, length) { | ||
215 | - // length of UTF-8 encoded string | ||
216 | - if (unescape(encodeURIComponent(text)).length <= length) { | ||
217 | - return text; | ||
218 | - } | ||
219 | - | ||
220 | - // "\u2026" is actually 3 bytes long in UTF-8 | ||
221 | - // TODO: if any of the last 3 characters is > 1 byte long this truncates too much | ||
222 | - var abbrev = text.slice(0, length - 3); | ||
223 | - | ||
224 | - if (!/\W/.test(text.charAt(length - 3))) { | ||
225 | - var match = /^(.*)\s\S*$/.exec(abbrev); | ||
226 | - if (match) { | ||
227 | - abbrev = match[1]; | ||
228 | - } | ||
229 | - } | ||
230 | - return abbrev + "\u2026"; | ||
231 | - } | ||
232 | - | ||
233 | - var HTML_CHAR_MAP = { | ||
234 | - '<': '<', | ||
235 | - '>': '>', | ||
236 | - '&': '&', | ||
237 | - '"': '"', | ||
238 | - "'": ''' | ||
239 | - }; | ||
240 | - | ||
241 | - function escapeHtml (s) { | ||
242 | - return s.replace(/[<>&"']/g, function (ch) { | ||
243 | - return HTML_CHAR_MAP[ch]; | ||
244 | - }); | ||
245 | - } | ||
246 | - | ||
247 | - function getEmbed (options, uri, settings) { | ||
248 | - var embed = settings && settings.embed; | ||
249 | - if (typeof embed === "function") { | ||
250 | - embed = embed.call(this, options, uri, settings); | ||
251 | - } | ||
252 | - | ||
253 | - if (embed) { | ||
254 | - return embed; | ||
255 | - } | ||
256 | - | ||
257 | - embed = ['<iframe scrolling="no" frameborder="0" style="border:none;" allowtransparency="true"']; | ||
258 | - var embed_url = $('meta[name="twitter:player"]').attr('content'); | ||
259 | - | ||
260 | - if (embed_url) { | ||
261 | - var width = $('meta[name="twitter:player:width"]').attr('content'); | ||
262 | - var height = $('meta[name="twitter:player:height"]').attr('content'); | ||
263 | - | ||
264 | - if (width) embed.push(' width="',escapeHtml(width),'"'); | ||
265 | - if (height) embed.push(' height="',escapeHtml(height),'"'); | ||
266 | - } | ||
267 | - else { | ||
268 | - embed_url = uri + options.referrer_track; | ||
269 | - } | ||
270 | - | ||
271 | - embed.push(' src="',escapeHtml(embed_url),'"></iframe>'); | ||
272 | - return embed.join(''); | ||
273 | - } | ||
274 | - | ||
275 | - // build URI from rel="canonical" or document.location | ||
276 | - function getURI (options) { | ||
277 | - var uri = document.location.href; | ||
278 | - var canonical = $("link[rel=canonical]").attr("href") || $('head meta[property="og:url"]').attr("content"); | ||
279 | - | ||
280 | - if (canonical) { | ||
281 | - uri = absurl(canonical); | ||
282 | - } | ||
283 | - else if (options && options.ignore_fragment) { | ||
284 | - uri = uri.replace(/#.*$/,''); | ||
285 | - } | ||
286 | - | ||
287 | - return uri; | ||
288 | - } | ||
289 | - | ||
290 | - function buttonClickHandler (service_name) { | ||
291 | - function onclick (event) { | ||
292 | - var $container = $(this).parents('li.help_info').first(); | ||
293 | - var $share = $container.parents('.social_share_privacy_area').first().parent(); | ||
294 | - var options = $share.data('social-share-privacy-options'); | ||
295 | - var service = options.services[service_name]; | ||
296 | - var button_class = service.button_class || service_name; | ||
297 | - var uri = options.uri; | ||
298 | - if (typeof uri === 'function') { | ||
299 | - uri = uri.call($share[0], options); | ||
300 | - } | ||
301 | - var $switch = $container.find('span.switch'); | ||
302 | - if ($switch.hasClass('off')) { | ||
303 | - $container.addClass('info_off'); | ||
304 | - $switch.addClass('on').removeClass('off').html(service.txt_on||'\u00a0'); | ||
305 | - $container.find('img.privacy_dummy').replaceWith( | ||
306 | - typeof(service.button) === "function" ? | ||
307 | - service.button.call($container.parent().parent()[0],service,uri,options) : | ||
308 | - service.button); | ||
309 | - $share.trigger({type: 'socialshareprivacy:enable', serviceName: service_name, isClick: !event.isTrigger}); | ||
310 | - } else { | ||
311 | - $container.removeClass('info_off'); | ||
312 | - $switch.addClass('off').removeClass('on').html(service.txt_off||'\u00a0'); | ||
313 | - $container.find('.dummy_btn').empty(). | ||
314 | - append($('<img/>').addClass(button_class+'_privacy_dummy privacy_dummy'). | ||
315 | - attr({ | ||
316 | - alt: service.dummy_alt, | ||
317 | - src: service.path_prefix + (options.layout === 'line' ? | ||
318 | - service.dummy_line_img : service.dummy_box_img) | ||
319 | - }).click(onclick)); | ||
320 | - $share.trigger({type: 'socialshareprivacy:disable', serviceName: service_name, isClick: !event.isTrigger}); | ||
321 | - } | ||
322 | - }; | ||
323 | - return onclick; | ||
324 | - } | ||
325 | - | ||
326 | - // display info-overlays a tiny bit delayed | ||
327 | - function enterHelpInfo () { | ||
328 | - var $info_wrapper = $(this); | ||
329 | - if ($info_wrapper.hasClass('info_off')) return; | ||
330 | - var timeout_id = window.setTimeout(function () { | ||
331 | - $info_wrapper.addClass('display'); | ||
332 | - $info_wrapper.removeData('timeout_id'); | ||
333 | - }, 500); | ||
334 | - $info_wrapper.data('timeout_id', timeout_id); | ||
335 | - } | ||
336 | - | ||
337 | - function leaveHelpInfo () { | ||
338 | - var $info_wrapper = $(this); | ||
339 | - var timeout_id = $info_wrapper.data('timeout_id'); | ||
340 | - if (timeout_id !== undefined) { | ||
341 | - window.clearTimeout(timeout_id); | ||
342 | - } | ||
343 | - $info_wrapper.removeClass('display'); | ||
344 | - } | ||
345 | - | ||
346 | - function permCheckChangeHandler () { | ||
347 | - var $input = $(this); | ||
348 | - var $share = $input.parents('.social_share_privacy_area').first().parent(); | ||
349 | - var options = $share.data('social-share-privacy-options'); | ||
350 | - if ($input.is(':checked')) { | ||
351 | - options.set_perma_option($input.attr('data-service'), options); | ||
352 | - $input.parent().addClass('checked'); | ||
353 | - } else { | ||
354 | - options.del_perma_option($input.attr('data-service'), options); | ||
355 | - $input.parent().removeClass('checked'); | ||
356 | - } | ||
357 | - } | ||
358 | - | ||
359 | - function enterSettingsInfo () { | ||
360 | - var $settings = $(this); | ||
361 | - var timeout_id = window.setTimeout(function () { | ||
362 | - $settings.find('.settings_info_menu').removeClass('off').addClass('on'); | ||
363 | - $settings.removeData('timeout_id'); | ||
364 | - }, 500); | ||
365 | - $settings.data('timeout_id', timeout_id); | ||
366 | - } | ||
367 | - | ||
368 | - function leaveSettingsInfo () { | ||
369 | - var $settings = $(this); | ||
370 | - var timeout_id = $settings.data('timeout_id'); | ||
371 | - if (timeout_id !== undefined) { | ||
372 | - window.clearTimeout(timeout_id); | ||
373 | - } | ||
374 | - $settings.find('.settings_info_menu').removeClass('on').addClass('off'); | ||
375 | - } | ||
376 | - | ||
377 | - function setPermaOption (service_name, options) { | ||
378 | - $.cookie('socialSharePrivacy_'+service_name, 'perma_on', options.cookie_expires, options.cookie_path, options.cookie_domain); | ||
379 | - } | ||
380 | - | ||
381 | - function delPermaOption (service_name, options) { | ||
382 | - $.cookie('socialSharePrivacy_'+service_name, null, -1, options.cookie_path, options.cookie_domain); | ||
383 | - } | ||
384 | - | ||
385 | - function getPermaOption (service_name, options) { | ||
386 | - return !!options.get_perma_options(options)[service_name]; | ||
387 | - } | ||
388 | - | ||
389 | - function getPermaOptions (options) { | ||
390 | - var cookies = $.cookie(); | ||
391 | - var permas = {}; | ||
392 | - for (var name in cookies) { | ||
393 | - var match = /^socialSharePrivacy_(.+)$/.exec(name); | ||
394 | - if (match) { | ||
395 | - permas[match[1]] = cookies[name] === 'perma_on'; | ||
396 | - } | ||
397 | - } | ||
398 | - return permas; | ||
399 | - } | ||
400 | - | ||
401 | - | ||
402 | - // extend jquery with our plugin function | ||
403 | - function socialSharePrivacy (options) { | ||
404 | - | ||
405 | - if (typeof options === "string") { | ||
406 | - var command = options; | ||
407 | - if (arguments.length === 1) { | ||
408 | - switch (command) { | ||
409 | - case "enable": | ||
410 | - this.find('.switch.off').click(); | ||
411 | - break; | ||
412 | - | ||
413 | - case "disable": | ||
414 | - this.find('.switch.on').click(); | ||
415 | - break; | ||
416 | - | ||
417 | - case "toggle": | ||
418 | - this.find('.switch').click(); | ||
419 | - break; | ||
420 | - | ||
421 | - case "options": | ||
422 | - return this.data('social-share-privacy-options'); | ||
423 | - | ||
424 | - case "destroy": | ||
425 | - this.trigger({type: 'socialshareprivacy:destroy'}); | ||
426 | - this.children('.social_share_privacy_area').remove(); | ||
427 | - this.removeData('social-share-privacy-options'); | ||
428 | - break; | ||
429 | - | ||
430 | - case "enabled": | ||
431 | - var enabled = {}; | ||
432 | - this.each(function () { | ||
433 | - var $self = $(this); | ||
434 | - var options = $self.data('social-share-privacy-options'); | ||
435 | - for (var name in options.services) { | ||
436 | - enabled[name] = $self.find('.'+(options.services[name].class_name||name)+' .switch').hasClass('on'); | ||
437 | - } | ||
438 | - }); | ||
439 | - return enabled; | ||
440 | - | ||
441 | - case "disabled": | ||
442 | - var disabled = {}; | ||
443 | - this.each(function () { | ||
444 | - var $self = $(this); | ||
445 | - var options = $self.data('social-share-privacy-options'); | ||
446 | - for (var name in options.services) { | ||
447 | - disabled[name] = $self.find('.'+(options.services[name].class_name||name)+' .switch').hasClass('off'); | ||
448 | - } | ||
449 | - }); | ||
450 | - return disabled; | ||
451 | - | ||
452 | - default: | ||
453 | - throw new Error("socialSharePrivacy: unknown command: "+command); | ||
454 | - } | ||
455 | - } | ||
456 | - else { | ||
457 | - var arg = arguments[1]; | ||
458 | - switch (command) { | ||
459 | - case "enable": | ||
460 | - this.each(function () { | ||
461 | - var $self = $(this); | ||
462 | - var options = $self.data('social-share-privacy-options'); | ||
463 | - $self.find('.'+(options.services[arg].class_name||arg)+' .switch.off').click(); | ||
464 | - }); | ||
465 | - break; | ||
466 | - | ||
467 | - case "disable": | ||
468 | - this.each(function () { | ||
469 | - var $self = $(this); | ||
470 | - var options = $self.data('social-share-privacy-options'); | ||
471 | - $self.find('.'+(options.services[arg].class_name||arg)+' .switch.on').click(); | ||
472 | - }); | ||
473 | - break; | ||
474 | - | ||
475 | - case "toggle": | ||
476 | - this.each(function () { | ||
477 | - var $self = $(this); | ||
478 | - var options = $self.data('social-share-privacy-options'); | ||
479 | - $self.find('.'+(options.services[arg].class_name||arg)+' .switch').click(); | ||
480 | - }); | ||
481 | - break; | ||
482 | - | ||
483 | - case "option": | ||
484 | - if (arguments.length > 2) { | ||
485 | - var value = {}; | ||
486 | - value[arg] = arguments[2]; | ||
487 | - this.each(function () { | ||
488 | - $.extend(true, $(this).data('social-share-privacy-options'), value); | ||
489 | - }); | ||
490 | - } | ||
491 | - else { | ||
492 | - return this.data('social-share-privacy-options')[arg]; | ||
493 | - } | ||
494 | - break; | ||
495 | - | ||
496 | - case "options": | ||
497 | - $.extend(true, options, arg); | ||
498 | - break; | ||
499 | - | ||
500 | - case "enabled": | ||
501 | - var options = this.data('social-share-privacy-options'); | ||
502 | - return this.find('.'+(options.services[arg].class_name||arg)+' .switch').hasClass('on'); | ||
503 | - | ||
504 | - case "disabled": | ||
505 | - var options = this.data('social-share-privacy-options'); | ||
506 | - return this.find('.'+(options.services[arg].class_name||arg)+' .switch').hasClass('off'); | ||
507 | - | ||
508 | - default: | ||
509 | - throw new Error("socialSharePrivacy: unknown command: "+command); | ||
510 | - } | ||
511 | - } | ||
512 | - return this; | ||
513 | - } | ||
514 | - | ||
515 | - return this.each(function () { | ||
516 | - // parse options passed via data-* attributes: | ||
517 | - var data = {}; | ||
518 | - if (this.lang) data.language = this.lang; | ||
519 | - for (var i = 0, attrs = this.attributes; i < attrs.length; ++ i) { | ||
520 | - var attr = attrs[i]; | ||
521 | - if (/^data-./.test(attr.name)) { | ||
522 | - var path = attr.name.slice(5).replace(/-/g,"_").split("."); | ||
523 | - var ctx = data, j = 0; | ||
524 | - for (; j < path.length-1; ++ j) { | ||
525 | - var name = path[j]; | ||
526 | - if (name in ctx) { | ||
527 | - ctx = ctx[name]; | ||
528 | - if (typeof ctx === "string") { | ||
529 | - ctx = (new Function("$", "return ("+ctx+");")).call(this, $); | ||
530 | - } | ||
531 | - } | ||
532 | - else { | ||
533 | - ctx = ctx[name] = {}; | ||
534 | - } | ||
535 | - } | ||
536 | - var name = path[j]; | ||
537 | - if (typeof ctx[name] === "object") { | ||
538 | - ctx[name] = $.extend(true, (new Function("$", "return ("+attr.value+");")).call(this, $), ctx[name]); | ||
539 | - } | ||
540 | - else { | ||
541 | - ctx[name] = attr.value; | ||
542 | - } | ||
543 | - } | ||
544 | - } | ||
545 | - // parse global option values: | ||
546 | - if ('cookie_expires' in data) data.cookie_expires = Number(data.cookie_expires); | ||
547 | - if ('perma_option' in data) data.perma_option = $.trim(data.perma_option).toLowerCase() === "true"; | ||
548 | - if ('ignore_fragment' in data) data.ignore_fragment = $.trim(data.ignore_fragment).toLowerCase() === "true"; | ||
549 | - if ('set_perma_option' in data) { | ||
550 | - data.set_perma_option = new Function("service_name", "options", data.set_perma_option); | ||
551 | - } | ||
552 | - if ('del_perma_option' in data) { | ||
553 | - data.del_perma_option = new Function("service_name", "options", data.del_perma_option); | ||
554 | - } | ||
555 | - if ('get_perma_option' in data) { | ||
556 | - data.get_perma_option = new Function("service_name", "options", data.get_perma_option); | ||
557 | - } | ||
558 | - if ('get_perma_options' in data) { | ||
559 | - data.get_perma_options = new Function("options", data.get_perma_options); | ||
560 | - } | ||
561 | - if ('order' in data) { | ||
562 | - data.order = $.trim(data.order); | ||
563 | - if (data.order) { | ||
564 | - data.order = data.order.split(/\s+/g); | ||
565 | - } | ||
566 | - else { | ||
567 | - delete data.order; | ||
568 | - } | ||
569 | - } | ||
570 | - if (typeof data.services === "string") { | ||
571 | - data.services = (new Function("$", "return ("+data.services+");")).call(this, $); | ||
572 | - } | ||
573 | - if ('options' in data) { | ||
574 | - data = $.extend(data, (new Function("$", "return ("+data.options+");")).call(this, $)); | ||
575 | - delete data.options; | ||
576 | - } | ||
577 | - if ('services' in data) { | ||
578 | - for (var service_name in data.services) { | ||
579 | - var service = data.services[service_name]; | ||
580 | - if (typeof service === "string") { | ||
581 | - data.services[service_name] = (new Function("$", "return ("+service+");")).call(this, $); | ||
582 | - } | ||
583 | - // only values of common options are parsed: | ||
584 | - if (typeof service.status === "string") { | ||
585 | - service.status = $.trim(service.status).toLowerCase() === "true"; | ||
586 | - } | ||
587 | - if (typeof service.perma_option === "string") { | ||
588 | - service.perma_option = $.trim(service.perma_option).toLowerCase() === "true"; | ||
589 | - } | ||
590 | - } | ||
591 | - } | ||
592 | - // overwrite default values with user settings | ||
593 | - var this_options = $.extend(true,{},socialSharePrivacy.settings,options,data); | ||
594 | - var order = this_options.order || []; | ||
595 | - | ||
596 | - var dummy_img = this_options.layout === 'line' ? 'dummy_line_img' : 'dummy_box_img'; | ||
597 | - var any_on = false; | ||
598 | - var any_perm = false; | ||
599 | - var any_unsafe = false; | ||
600 | - var unordered = []; | ||
601 | - for (var service_name in this_options.services) { | ||
602 | - var service = this_options.services[service_name]; | ||
603 | - if (service.status) { | ||
604 | - any_on = true; | ||
605 | - if ($.inArray(service_name, order) === -1) { | ||
606 | - unordered.push(service_name); | ||
607 | - } | ||
608 | - if (service.privacy !== 'safe') { | ||
609 | - any_unsafe = true; | ||
610 | - if (service.perma_option) { | ||
611 | - any_perm = true; | ||
612 | - } | ||
613 | - } | ||
614 | - } | ||
615 | - if (!('language' in service)) { | ||
616 | - service.language = this_options.language; | ||
617 | - } | ||
618 | - if (!('path_prefix' in service)) { | ||
619 | - service.path_prefix = this_options.path_prefix; | ||
620 | - } | ||
621 | - if (!('referrer_track' in service)) { | ||
622 | - service.referrer_track = ''; | ||
623 | - } | ||
624 | - } | ||
625 | - unordered.sort(); | ||
626 | - order = order.concat(unordered); | ||
627 | - | ||
628 | - // check if at least one service is activated | ||
629 | - if (!any_on) { | ||
630 | - return; | ||
631 | - } | ||
632 | - | ||
633 | - // insert stylesheet into document and prepend target element | ||
634 | - if (this_options.css_path) { | ||
635 | - var css_path = (this_options.path_prefix||"") + this_options.css_path; | ||
636 | - // IE fix (needed for IE < 9 - but done for all IE versions) | ||
637 | - if (document.createStyleSheet) { | ||
638 | - document.createStyleSheet(css_path); | ||
639 | - } else if ($('link[href="'+css_path+'"]').length === 0) { | ||
640 | - $('<link/>',{rel:'stylesheet',type:'text/css',href:css_path}).appendTo(document.head); | ||
641 | - } | ||
642 | - } | ||
643 | - | ||
644 | - // get stored perma options | ||
645 | - var permas; | ||
646 | - if (this_options.perma_option && any_perm) { | ||
647 | - if (this_options.get_perma_options) { | ||
648 | - permas = this_options.get_perma_options(this_options); | ||
649 | - } | ||
650 | - else { | ||
651 | - permas = {}; | ||
652 | - for (var service_name in this_options.services) { | ||
653 | - permas[service_name] = this_options.get_perma_option(service_name, this_options); | ||
654 | - } | ||
655 | - } | ||
656 | - } | ||
657 | - | ||
658 | - // canonical uri that will be shared | ||
659 | - var uri = this_options.uri; | ||
660 | - if (typeof uri === 'function') { | ||
661 | - uri = uri.call(this, this_options); | ||
662 | - } | ||
663 | - | ||
664 | - var $context = $('<ul class="social_share_privacy_area"></ul>').addClass(this_options.layout); | ||
665 | - var $share = $(this); | ||
666 | - | ||
667 | - $share.prepend($context).data('social-share-privacy-options',this_options); | ||
668 | - | ||
669 | - for (var i = 0; i < order.length; ++ i) { | ||
670 | - var service_name = order[i]; | ||
671 | - var service = this_options.services[service_name]; | ||
672 | - | ||
673 | - if (service && service.status) { | ||
674 | - var class_name = service.class_name || service_name; | ||
675 | - var button_class = service.button_class || service_name; | ||
676 | - var $help_info; | ||
677 | - | ||
678 | - if (service.privacy === 'safe') { | ||
679 | - $help_info = $('<li class="help_info"><div class="info">' + | ||
680 | - service.txt_info + '</div><div class="dummy_btn"></div></li>').addClass(class_name); | ||
681 | - $help_info.find('.dummy_btn'). | ||
682 | - addClass(button_class). | ||
683 | - append(service.button.call(this,service,uri,this_options)); | ||
684 | - } | ||
685 | - else { | ||
686 | - $help_info = $('<li class="help_info"><div class="info">' + | ||
687 | - service.txt_info + '</div><span class="switch off">' + (service.txt_off||'\u00a0') + | ||
688 | - '</span><div class="dummy_btn"></div></li>').addClass(class_name); | ||
689 | - $help_info.find('.dummy_btn'). | ||
690 | - addClass(button_class). | ||
691 | - append($('<img/>').addClass(button_class+'_privacy_dummy privacy_dummy'). | ||
692 | - attr({ | ||
693 | - alt: service.dummy_alt, | ||
694 | - src: service.path_prefix + service[dummy_img] | ||
695 | - })); | ||
696 | - | ||
697 | - $help_info.find('.dummy_btn img.privacy_dummy, span.switch').click( | ||
698 | - buttonClickHandler(service_name)); | ||
699 | - } | ||
700 | - $context.append($help_info); | ||
701 | - } | ||
702 | - } | ||
703 | - | ||
704 | - // | ||
705 | - // append Info/Settings-area | ||
706 | - // | ||
707 | - if (any_unsafe) { | ||
708 | - var $settings_info = $('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a>' + | ||
709 | - '<span class="help_info icon"><span class="info">' + this_options.txt_help + '</span></span></a></div></li>'); | ||
710 | - var $info_link = $settings_info.find('> .settings_info_menu > a').attr('href', this_options.info_link); | ||
711 | - if (this_options.info_link_target) { | ||
712 | - $info_link.attr("target",this_options.info_link_target); | ||
713 | - } | ||
714 | - $context.append($settings_info); | ||
715 | - | ||
716 | - $context.find('.help_info').on('mouseenter', enterHelpInfo).on('mouseleave', leaveHelpInfo); | ||
717 | - | ||
718 | - // menu for permanently enabling of service buttons | ||
719 | - if (this_options.perma_option && any_perm) { | ||
720 | - | ||
721 | - // define container | ||
722 | - var $container_settings_info = $context.find('li.settings_info'); | ||
723 | - | ||
724 | - // remove class that fomrats the i-icon, because perma-options are shown | ||
725 | - var $settings_info_menu = $container_settings_info.find('.settings_info_menu'); | ||
726 | - $settings_info_menu.removeClass('perma_option_off'); | ||
727 | - | ||
728 | - // append perma-options-icon (.settings) and form (hidden) | ||
729 | - $settings_info_menu.append( | ||
730 | - '<span class="settings">' + this_options.txt_settings + '</span><form><fieldset><legend>' + | ||
731 | - this_options.settings_perma + '</legend></fieldset></form>'); | ||
732 | - | ||
733 | - // write services with <input> and <label> and checked state from cookie | ||
734 | - var $fieldset = $settings_info_menu.find('form fieldset'); | ||
735 | - for (var i = 0; i < order.length; ++ i) { | ||
736 | - var service_name = order[i]; | ||
737 | - var service = this_options.services[service_name]; | ||
738 | - | ||
739 | - if (service && service.status && service.perma_option && service.privacy !== 'safe') { | ||
740 | - var class_name = service.class_name || service_name; | ||
741 | - var perma = permas[service_name]; | ||
742 | - var $field = $('<label><input type="checkbox"' + (perma ? ' checked="checked"/>' : '/>') + | ||
743 | - service.display_name + '</label>'); | ||
744 | - $field.find('input').attr('data-service', service_name); | ||
745 | - $fieldset.append($field); | ||
746 | - | ||
747 | - // enable services when cookie set and refresh cookie | ||
748 | - if (perma) { | ||
749 | - $context.find('li.'+class_name+' span.switch').click(); | ||
750 | - this_options.set_perma_option(service_name, this_options); | ||
751 | - } | ||
752 | - } | ||
753 | - } | ||
754 | - | ||
755 | - // indicate clickable setings gear | ||
756 | - $container_settings_info.find('span.settings').css('cursor', 'pointer'); | ||
757 | - | ||
758 | - // show settings menu on hover | ||
759 | - $container_settings_info.on('mouseenter', enterSettingsInfo).on('mouseleave', leaveSettingsInfo); | ||
760 | - | ||
761 | - // interaction for <input> to enable services permanently | ||
762 | - $container_settings_info.find('fieldset input').on('change', permCheckChangeHandler); | ||
763 | - } | ||
764 | - } | ||
765 | - $share.trigger({type: 'socialshareprivacy:create', options: this_options}); | ||
766 | - }); | ||
767 | - }; | ||
768 | - | ||
769 | - // expose helper functions: | ||
770 | - socialSharePrivacy.absurl = absurl; | ||
771 | - socialSharePrivacy.escapeHtml = escapeHtml; | ||
772 | - socialSharePrivacy.getTitle = getTitle; | ||
773 | - socialSharePrivacy.getImage = getImage; | ||
774 | - socialSharePrivacy.getEmbed = getEmbed; | ||
775 | - socialSharePrivacy.getDescription = getDescription; | ||
776 | - socialSharePrivacy.abbreviateText = abbreviateText; | ||
777 | - socialSharePrivacy.formatNumber = formatNumber; | ||
778 | - | ||
779 | - socialSharePrivacy.settings = { | ||
780 | - 'services' : {}, | ||
781 | - 'info_link' : 'http://panzi.github.io/SocialSharePrivacy/', | ||
782 | - 'info_link_target' : '', | ||
783 | - 'txt_settings' : 'Settings', | ||
784 | - 'txt_help' : 'If you activate these fields via click, data will be sent to a third party (Facebook, Twitter, Google, ...) and stored there. For more details click <em>i</em>.', | ||
785 | - 'settings_perma' : 'Permanently enable share buttons:', | ||
786 | - 'layout' : 'line', // possible values: 'line' (~120x20) or 'box' (~58x62) | ||
787 | - 'set_perma_option' : setPermaOption, | ||
788 | - 'del_perma_option' : delPermaOption, | ||
789 | - 'get_perma_options' : getPermaOptions, | ||
790 | - 'get_perma_option' : getPermaOption, | ||
791 | - 'perma_option' : !!$.cookie, | ||
792 | - 'cookie_path' : '/', | ||
793 | - 'cookie_domain' : document.location.hostname, | ||
794 | - 'cookie_expires' : 365, | ||
795 | - 'path_prefix' : '', | ||
796 | - 'css_path' : "stylesheets/socialshareprivacy.css", | ||
797 | - 'uri' : getURI, | ||
798 | - 'language' : 'en', | ||
799 | - 'ignore_fragment' : true | ||
800 | - }; | ||
801 | - | ||
802 | - $.fn.socialSharePrivacy = socialSharePrivacy; | ||
803 | -}(jQuery)); |
plugins/social_share_privacy/public/socialshareprivacy/images/box_fbshare.png
0 → 100644
4.57 KB
plugins/social_share_privacy/public/socialshareprivacy/images/box_mail.png
0 → 100644
2.26 KB
plugins/social_share_privacy/public/socialshareprivacy/images/box_tumblr.png
0 → 100644
2.42 KB
plugins/social_share_privacy/public/socialshareprivacy/images/de/dummy_box_facebook.png
0 → 100644
1.01 KB
plugins/social_share_privacy/public/socialshareprivacy/images/de/dummy_facebook.png
0 → 100644
884 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_buffer.png
0 → 100644
1.53 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_delicious.png
0 → 100644
870 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_disqus.png
0 → 100644
984 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_facebook.png
0 → 100644
782 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_flattr.png
0 → 100644
1.09 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_gplus.png
0 → 100644
842 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_hackernews.png
0 → 100644
644 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_linkedin.png
0 → 100644
1.62 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_pinterest.png
0 → 100644
1.5 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_reddit.png
0 → 100644
964 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_stumbleupon.png
0 → 100644
1.05 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_twitter.png
0 → 100644
1.04 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_box_xing.png
0 → 100644
1.22 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_buffer.png
0 → 100644
1.29 KB
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_delicious.png
0 → 100644
877 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_disqus.png
0 → 100644
856 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_facebook.png
0 → 100644
651 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_flattr.png
0 → 100644
825 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_gplus.png
0 → 100644
661 Bytes
plugins/social_share_privacy/public/socialshareprivacy/images/dummy_gplus_alt.png
0 → 100644
409 Bytes