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":["US","GB","PI","UD"],"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', 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:' === document.location.protocol ? 'https:' : 'http:')+ 79 '//www.facebook.com/plugins/like.php?'+$.param(params)); 80 } 81 }; 82})(jQuery); 83