first commit
This commit is contained in:
33
media/com_contact/joomla.asset.json
Normal file
33
media/com_contact/joomla.asset.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"$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"
|
||||
},
|
||||
"version": "adf7b2"
|
||||
},
|
||||
{
|
||||
"name": "com_contact.contacts-list",
|
||||
"type": "script",
|
||||
"uri": "com_contact/contacts-list.min.js",
|
||||
"dependencies": [
|
||||
"core"
|
||||
],
|
||||
"attributes": {
|
||||
"type": "module"
|
||||
},
|
||||
"version": "c512d2"
|
||||
}
|
||||
]
|
||||
}
|
||||
52
media/com_contact/js/admin-contacts-modal.js
Normal file
52
media/com_contact/js/admin-contacts-modal.js
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
(() => {
|
||||
|
||||
/**
|
||||
* 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) => {
|
||||
let hreflang = '';
|
||||
if (!Joomla.getOptions('xtd-contacts')) {
|
||||
// Something went wrong
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
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);
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
return true;
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Get the elements
|
||||
const elements = document.querySelectorAll('.select-link');
|
||||
for (let i = 0, l = elements.length; l > i; i += 1) {
|
||||
// Listen for click event
|
||||
elements[i].addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
const functionName = event.target.getAttribute('data-function');
|
||||
if (functionName === 'jSelectContact') {
|
||||
// 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 {
|
||||
// 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().close();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
1
media/com_contact/js/admin-contacts-modal.min.js
vendored
Normal file
1
media/com_contact/js/admin-contacts-modal.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
window.jSelectContact=(t,e,a,n,o,r)=>{let l="";if(!Joomla.getOptions("xtd-contacts"))return window.parent.Joomla.Modal.getCurrent().close(),!1;const{editor:d}=Joomla.getOptions("xtd-contacts");""!==r&&(l=`hreflang = "${r}"`);const i=`<a ${l} href="${o}">${e}</a>`;return window.parent.Joomla.editors.instances[d].replaceSelection(i),window.parent.Joomla.Modal.getCurrent().close(),!0},document.addEventListener("DOMContentLoaded",(()=>{const t=document.querySelectorAll(".select-link");for(let e=0,a=t.length;a>e;e+=1)t[e].addEventListener("click",(t=>{t.preventDefault();const e=t.target.getAttribute("data-function");"jSelectContact"===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](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().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);
|
||||
1
media/com_contact/js/contacts-list.min.js
vendored
Normal file
1
media/com_contact/js/contacts-list.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(e=>{const t=()=>{const t=e.getElementById("adminForm");e.getElementById("filter-search").value="",t.submit()},n=()=>{const d=e.getElementById("adminForm").querySelector('button[type="reset"]');d&&d.addEventListener("click",t),e.removeEventListener("DOMContentLoaded",n)};e.addEventListener("DOMContentLoaded",n)})(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