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 &ndash; 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:' === document.location.protocol ? 'https:' : 'http:')+
59				'//platform.twitter.com/widgets/tweet_button.html?' +
60				$.param(params).replace(/\+/g,'%20'));
61		}
62	};
63})(jQuery);
64