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		'txt_info'          : 'Send this per email to a friend.',
32		'txt_button'        : 'Send Email',
33		'display_name'      : 'Mail',
34		'referrer_track'    : '',
35		'subject'           : $.fn.socialSharePrivacy.getTitle,
36		'body'              : getBody,
37		'button'            : function (options, uri, settings) {
38			return $('<a>' + options.txt_button + '</a>').attr(
39				'href', 'mailto:?'+$.param({
40					subject : get(this, options, uri, settings, 'subject'),
41					body    : get(this, options, uri, settings, 'body')
42				}).replace(/\+/g,'%20'));
43		}
44	};
45})(jQuery);
46