44663a3c585fd00d97d586fb123dd075a3092d89
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Resources / Public / JavaScript / MailLinkHandler.js
1 /**
2 * This file is part of the TYPO3 CMS project.
3 *
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
7 *
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
10 *
11 * The TYPO3 project - inspiring people to share!
12 */
13
14 /**
15 * Mail link interaction
16 */
17 define('TYPO3/CMS/Recordlist/MailLinkHandler', ['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
18 "use strict";
19
20 var MailLinkHandler = {};
21
22 MailLinkHandler.link = function(event) {
23 event.preventDefault();
24
25 var value = $(this).find('[name="lemail"]').val();
26 if (value === "mailto:") {
27 return;
28 }
29
30 while (value.substr(0, 7) === "mailto:") {
31 value = value.substr(7);
32 }
33
34 LinkBrowser.updateValueInMainForm(value);
35
36 close();
37 };
38
39 $(function() {
40 $('#lmailform').on('submit', MailLinkHandler.link);
41 });
42
43 return MailLinkHandler;
44 });