d18dbfa52fc1c5e4e5f69a4069046db15d78e284
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Resources / Public / JavaScript / UrlLinkHandler.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 * Module: TYPO3/CMS/Recordlist/UrlLinkHandler
16 * URL link interaction
17 */
18 define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
19 'use strict';
20
21 /**
22 *
23 * @type {{}}
24 * @exports TYPO3/CMS/Recordlist/UrlLinkHandler
25 */
26 var UrlLinkHandler = {};
27
28 /**
29 *
30 * @param {Event} event
31 */
32 UrlLinkHandler.link = function(event) {
33 event.preventDefault();
34
35 var value = $(this).find('[name="lurl"]').val();
36 if (value === "http://") {
37 return;
38 }
39
40 LinkBrowser.setAdditionalLinkAttribute('data-htmlarea-external', '1');
41
42 LinkBrowser.finalizeFunction(value);
43 };
44
45 $(function() {
46 $('#lurlform').on('submit', UrlLinkHandler.link);
47 });
48
49 return UrlLinkHandler;
50 });