2014-03-03 15:57:17 +01:00
|
|
|
/**
|
2020-07-08 14:28:21 +02:00
|
|
|
* EGroupware Mail - handle mailto and other links in preview
|
2014-03-03 15:57:17 +01:00
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
2016-10-08 14:32:58 +02:00
|
|
|
* @author EGroupware GmbH [info@egroupware.org]
|
|
|
|
* @copyright (c) 2014 by EGroupware GmbH <info-AT-egroupware.org>
|
2014-03-03 15:57:17 +01:00
|
|
|
* @package mail
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*egw:uses
|
2016-06-07 09:38:11 +02:00
|
|
|
/api/js/jquery/jquery.base64.js;
|
2014-03-03 15:57:17 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
jQuery(function()
|
|
|
|
{
|
|
|
|
jQuery('body').on('click', 'a[href]', function()
|
|
|
|
{
|
|
|
|
// active mailto: links with mail compose
|
|
|
|
if (this.href.substr(0, 7) == 'mailto:')
|
|
|
|
{
|
2020-08-25 15:18:38 +02:00
|
|
|
top.egw.open(null, 'mail', 'add', {send_to: jQuery.base64Encode(this.href.substr(7).replace('%40', '@'))});
|
2014-03-03 15:57:17 +01:00
|
|
|
|
|
|
|
return false; // cant do event.stopImediatePropagation() in on!
|
|
|
|
}
|
2020-07-08 14:28:21 +02:00
|
|
|
// open links with own orgin and "index.php?" as popup (not eg. share.php or *dav.php)
|
|
|
|
else if ((this.href[0] === '/' || this.href.match(new RegExp('^'+location.protocol+'//'+location.host+'/'))) &&
|
|
|
|
this.href.match(/\/index.php\?/))
|
|
|
|
{
|
|
|
|
top.egw.openPopup(this.href.replace(/([?&])no_popup=[^&]*/, '\1'), 800, 600, '_blank');
|
|
|
|
return false;
|
|
|
|
}
|
2014-03-03 15:57:17 +01:00
|
|
|
else // add target=_blank to all other links, gives CSP error and would open in preview
|
|
|
|
{
|
|
|
|
this.target = '_blank';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|