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 &ndash; 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 protocol = location.protocol === 'https:' ? 'https' : 'http';
35			var attrs = {
36				'data-counter' : settings.layout === 'line' ? 'right' : 'top',
37				'data-url'     : uri + options.referrer_track,
38				'data-showzero': String(options.showzero)
39			};
40			if (options.onsuccess) attrs['data-onsuccess'] = options.onsuccess;
41			if (options.onerror)   attrs['data-onerror']   = options.onerror;
42			var $code = $('<script type="IN/Share"></script>').attr(attrs);
43
44			if (window.IN && window.IN.parse) {
45				$code = $code.add('<script type="text/javascript">IN.parse(document.body);</script>');
46			}
47			else if ($('script[src^="'+protocol+'://platform.linkedin.com/"]').length === 0) {
48				$code = $code.add('<script type="text/javascript" src="'+protocol+'://platform.linkedin.com/in.js"></script>');
49			}
50
51			return $code;
52		}
53	};
54})(jQuery);
55