primo commit
This commit is contained in:
35
media/com_contact/joomla.asset.json
Normal file
35
media/com_contact/joomla.asset.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
|
||||
"name": "com_contact",
|
||||
"version": "4.0.0",
|
||||
"description": "Joomla CMS",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"assets": [
|
||||
{
|
||||
"name": "com_contact.admin-contacts-modal",
|
||||
"type": "script",
|
||||
"uri": "com_contact/admin-contacts-modal.min.js",
|
||||
"dependencies": [
|
||||
"core"
|
||||
],
|
||||
"attributes": {
|
||||
"type": "module"
|
||||
},
|
||||
"deprecated": true,
|
||||
"deprecatedMsg": "Use postMessage() directly or with help of [modal-content-select] asset. To post the modal selection.",
|
||||
"version": "1400c3"
|
||||
},
|
||||
{
|
||||
"name": "com_contact.contacts-list",
|
||||
"type": "script",
|
||||
"uri": "com_contact/contacts-list.min.js",
|
||||
"dependencies": [
|
||||
"core"
|
||||
],
|
||||
"attributes": {
|
||||
"type": "module"
|
||||
},
|
||||
"version": "f53819"
|
||||
}
|
||||
]
|
||||
}
|
||||
58
media/com_contact/js/admin-contacts-modal.js
Normal file
58
media/com_contact/js/admin-contacts-modal.js
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
(() => {
|
||||
|
||||
// Use a JoomlaExpectingPostMessage flag to be able to distinct legacy methods
|
||||
if (window.parent.JoomlaExpectingPostMessage) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Javascript to insert the link
|
||||
* View element calls jSelectContact when a contact is clicked
|
||||
* jSelectContact creates the link tag, sends it to the editor,
|
||||
* and closes the select frame.
|
||||
*/
|
||||
|
||||
window.jSelectContact = (id, title, catid, object, link, lang) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Method jSelectContact() is deprecated. Use postMessage() instead.');
|
||||
let hreflang = '';
|
||||
if (!Joomla.getOptions('xtd-contacts')) {
|
||||
return false;
|
||||
}
|
||||
const {
|
||||
editor
|
||||
} = Joomla.getOptions('xtd-contacts');
|
||||
if (lang !== '') {
|
||||
hreflang = `hreflang = "${lang}"`;
|
||||
}
|
||||
const tag = `<a ${hreflang} href="${link}">${title}</a>`;
|
||||
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
|
||||
if (window.parent.Joomla.Modal && window.parent.Joomla.Modal.getCurrent()) {
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.select-link').forEach(element => {
|
||||
// Listen for click event
|
||||
element.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
const functionName = event.target.getAttribute('data-function');
|
||||
if (functionName === 'jSelectContact' && window[functionName]) {
|
||||
// Used in xtd_contacts
|
||||
window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), null, null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language'), null);
|
||||
} else if (window.parent[functionName]) {
|
||||
// Used in com_menus
|
||||
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);
|
||||
}
|
||||
if (window.parent.Joomla.Modal && window.parent.Joomla.Modal.getCurrent()) {
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
4
media/com_contact/js/admin-contacts-modal.min.js
vendored
Normal file
4
media/com_contact/js/admin-contacts-modal.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/window.parent.JoomlaExpectingPostMessage||(window.jSelectContact=(a,t,e,d,r,o)=>{console.warn("Method jSelectContact() is deprecated. Use postMessage() instead.");let n="";if(!Joomla.getOptions("xtd-contacts"))return!1;const{editor:i}=Joomla.getOptions("xtd-contacts");o!==""&&(n=`hreflang = "${o}"`);const l=`<a ${n} href="${r}">${t}</a>`;return window.parent.Joomla.editors.instances[i].replaceSelection(l),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close(),!0},document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".select-link").forEach(a=>{a.addEventListener("click",t=>{t.preventDefault();const e=t.target.getAttribute("data-function");e==="jSelectContact"&&window[e]?window[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),null,null,t.target.getAttribute("data-uri"),t.target.getAttribute("data-language"),null):window.parent[e]&&window.parent[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),null,null,t.target.getAttribute("data-uri"),t.target.getAttribute("data-language"),null),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()})})}));
|
||||
BIN
media/com_contact/js/admin-contacts-modal.min.js.gz
Normal file
BIN
media/com_contact/js/admin-contacts-modal.min.js.gz
Normal file
Binary file not shown.
21
media/com_contact/js/contacts-list.js
Normal file
21
media/com_contact/js/contacts-list.js
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
(document => {
|
||||
|
||||
const onClick = () => {
|
||||
const form = document.getElementById('adminForm');
|
||||
document.getElementById('filter-search').value = '';
|
||||
form.submit();
|
||||
};
|
||||
const onBoot = () => {
|
||||
const form = document.getElementById('adminForm');
|
||||
const element = form.querySelector('button[type="reset"]');
|
||||
if (element) {
|
||||
element.addEventListener('click', onClick);
|
||||
}
|
||||
document.removeEventListener('DOMContentLoaded', onBoot);
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', onBoot);
|
||||
})(document);
|
||||
4
media/com_contact/js/contacts-list.min.js
vendored
Normal file
4
media/com_contact/js/contacts-list.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/(e=>{const r=()=>{const n=e.getElementById("adminForm");e.getElementById("filter-search").value="",n.submit()},t=()=>{const o=e.getElementById("adminForm").querySelector('button[type="reset"]');o&&o.addEventListener("click",r),e.removeEventListener("DOMContentLoaded",t)};e.addEventListener("DOMContentLoaded",t)})(document);
|
||||
BIN
media/com_contact/js/contacts-list.min.js.gz
Normal file
BIN
media/com_contact/js/contacts-list.min.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user