[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 (function () { 2 'use strict'; 3 4 /** 5 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 (function (Joomla, document) { 9 /** 10 * Javascript to insert the link 11 * View element calls jSelectContact when a contact is clicked 12 * jSelectContact creates the link tag, sends it to the editor, 13 * and closes the select frame. 14 */ 15 window.jSelectMenuItem = function (id, title, uri, object, link, lang) { 16 var thislang = ''; 17 18 if (!Joomla.getOptions('xtd-menus')) { 19 // Something went wrong! 20 window.parent.Joomla.Modal.getCurrent().close(); 21 throw new Error('core.js was not properly initialised'); 22 } // eslint-disable-next-line prefer-destructuring 23 24 25 var editor = Joomla.getOptions('xtd-menus').editor; 26 27 if (lang !== '') { 28 thislang = '&lang='; 29 } 30 31 var tag = "<a href=\"" + (uri + thislang + lang) + "\">" + title + "</a>"; // Insert the link in the editor 32 33 if (window.parent.Joomla.editors.instances[editor].getSelection()) { 34 window.parent.Joomla.editors.instances[editor].replaceSelection("<a href=\"" + (uri + thislang + lang) + "\">" + window.parent.Joomla.editors.instances[editor].getSelection() + "</a>"); 35 } else { 36 window.parent.Joomla.editors.instances[editor].replaceSelection(tag); 37 } // Close the modal 38 39 40 if (window.parent.Joomla && window.parent.Joomla.Modal) { 41 window.parent.Joomla.Modal.getCurrent().close(); 42 } 43 }; // Get the elements 44 45 46 var elements = [].slice.call(document.querySelectorAll('.select-link')); 47 elements.forEach(function (element) { 48 // Listen for click event 49 element.addEventListener('click', function (event) { 50 event.preventDefault(); 51 var functionName = event.target.getAttribute('data-function'); 52 53 if (functionName === 'jSelectMenuItem') { 54 // Used in xtd_contacts 55 window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-uri'), null, null, event.target.getAttribute('data-language')); 56 } else { 57 // Used in com_menus 58 window.parent[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), null, null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language'), null); 59 } // Close the modal 60 61 62 if (window.parent.Joomla.Modal) { 63 window.parent.Joomla.Modal.getCurrent().close(); 64 } 65 }); 66 }); 67 })(Joomla, document); 68 69 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |