Issues (4868)

mail/js/preview.js (1 issue)

1
/**
2
 * mail - handle mailto and other links in preview
3
 *
4
 * @link http://www.egroupware.org
5
 * @author EGroupware GmbH [[email protected]]
6
 * @copyright (c) 2014 by EGroupware GmbH <info-AT-egroupware.org>
7
 * @package mail
8
 * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
9
 * @version $Id$
10
 */
11
12
/*egw:uses
13
	/api/js/jquery/jquery.base64.js;
14
*/
15
16
jQuery(function()
17
{
18
	jQuery('body').on('click', 'a[href]', function()
19
	{
20
		// active mailto: links with mail compose
21
		if (this.href.substr(0, 7) == 'mailto:')
22
		{
23
			egw(window).open(null, 'mail', 'add', {send_to: jQuery.base64Encode(this.href.substr(7).replace('%40', '@'))});
24
25
			return false;	// cant do event.stopImediatePropagation() in on!
26
		}
27
		else	// add target=_blank to all other links, gives CSP error and would open in preview
28
		{
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
29
			this.target = '_blank';
30
		}
31
	});
32
});