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 if ('https:' === document.location.protocol) { 56 base_url = 'https://redditstatic.s3.amazonaws.com'; 57 } else { 58 base_url = 'http://www.reddit.com/static'; 59 } 60 var params = { 61 url : uri + options.referrer_track, 62 width : String(w) 63 }; 64 var title = get(this, options, uri, settings, 'title'); 65 var target = get(this, options, uri, settings, 'target'); 66 if (title) params.title = title; 67 if (target) params.target = target; 68 if (options.bgcolor) params.bgcolor = options.bgcolor; 69 if (options.bordercolor) params.bordercolor = options.bordercolor; 70 if (options.newwindow) params.newwindow = options.newwindow; 71 72 return $('<iframe allowtransparency="true" frameborder="0" scrolling="no"></iframe>').attr( 73 'src', base_url+layout+$.param(params)); 74 } 75 }; 76})(jQuery); 77