first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

1
media/cache/index.html vendored Normal file
View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,21 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_actionlogs",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_actionlogs.admin-actionlogs",
"type": "script",
"uri": "com_actionlogs/admin-actionlogs-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "810ef7"
}
]
}

View File

@ -0,0 +1,25 @@
/**
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla.submitbutton = task => {
if (task === 'actionlogs.exportLogs') {
Joomla.submitform(task, document.getElementById('exportForm'));
return;
}
if (task === 'actionlogs.exportSelectedLogs') {
// Get id of selected action logs item and pass it to export form hidden input
const cids = [];
const elements = [].slice.call(document.querySelectorAll("input[name='cid[]']:checked"));
if (elements.length) {
elements.forEach(element => {
cids.push(element.value);
});
}
document.exportForm.cids.value = cids.join(',');
Joomla.submitform(task, document.getElementById('exportForm'));
return;
}
Joomla.submitform(task);
};

View File

@ -0,0 +1 @@
Joomla.submitbutton=o=>{if("actionlogs.exportLogs"!==o){if("actionlogs.exportSelectedLogs"===o){const e=[],t=[].slice.call(document.querySelectorAll("input[name='cid[]']:checked"));return t.length&&t.forEach((o=>{e.push(o.value)})),document.exportForm.cids.value=e.join(","),void Joomla.submitform(o,document.getElementById("exportForm"))}Joomla.submitform(o)}else Joomla.submitform(o,document.getElementById("exportForm"))};

View File

@ -0,0 +1,21 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_admin",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_admin.admin-help",
"type": "script",
"uri": "com_admin/admin-help.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "90c210"
}
]
}

View File

@ -0,0 +1,10 @@
/**
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
const helpIndex = document.getElementById('help-index');
if (helpIndex) {
[].slice.call(helpIndex.querySelectorAll('a')).map(element => element.addEventListener('click', () => {
window.scroll(0, 0);
}));
}

1
media/com_admin/js/admin-help.min.js vendored Normal file
View File

@ -0,0 +1 @@
const helpIndex=document.getElementById("help-index");helpIndex&&[].slice.call(helpIndex.querySelectorAll("a")).map((e=>e.addEventListener("click",(()=>{window.scroll(0,0)}))));

Binary file not shown.

View File

@ -0,0 +1,92 @@
/**
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
.sidebyside .outer-panel {
float: left;
width: 50%;
}
.sidebyside #left-panel .inner-panel {
padding-inline-end: 10px;
}
.sidebyside #right-panel .inner-panel {
padding-inline-end: 10px;
}
.sidebyside .full-width {
float: none !important;
width: 100% !important;
}
.sidebyside .full-width .inner-panel {
padding: 0 !important;
}
#reference-association, #target-association {
width: 100%;
height: 1500px;
overflow-y: auto;
border: 0 !important;
}
.sidebyside .langtarget {
float: left;
}
.sidebyside .modaltarget {
float: left;
margin-inline-start: .5rem;
}
.sidebyside #target-association {
margin-top: .5rem;
}
.sidebyside #reference-association {
margin-top: 3.35rem;
}
.target-text {
float: left;
width: auto;
}
/* RTL overrides */
[dir=rtl] .sidebyside .outer-panel {
float: right;
}
[dir=rtl] .sidebyside .langtarget {
float: right;
}
[dir=rtl] .sidebyside .modaltarget {
float: right;
}
[dir=rtl] .target-text {
float: right;
}
/* Responsive layout */
@media (max-width: 767.98px) {
.sidebyside .outer-panel {
float: none;
width: 100%;
}
.sidebyside #reference-association {
margin-top: 0;
}
.sidebyside #left-panel .inner-panel {
padding: 0;
}
.sidebyside #right-panel .inner-panel {
padding: 0;
}
}

View File

@ -0,0 +1 @@
.sidebyside .outer-panel{float:left;width:50%}.sidebyside #left-panel .inner-panel,.sidebyside #right-panel .inner-panel{-webkit-padding-end:10px;padding-inline-end:10px}.sidebyside .full-width{float:none!important;width:100%!important}.sidebyside .full-width .inner-panel{padding:0!important}#reference-association,#target-association{border:0!important;height:1500px;overflow-y:auto;width:100%}.sidebyside .langtarget{float:left}.sidebyside .modaltarget{-webkit-margin-start:.5rem;float:left;margin-inline-start:.5rem}.sidebyside #target-association{margin-top:.5rem}.sidebyside #reference-association{margin-top:3.35rem}.target-text{float:left;width:auto}[dir=rtl] .sidebyside .langtarget,[dir=rtl] .sidebyside .modaltarget,[dir=rtl] .sidebyside .outer-panel,[dir=rtl] .target-text{float:right}@media (max-width:767.98px){.sidebyside .outer-panel{float:none;width:100%}.sidebyside #reference-association{margin-top:0}.sidebyside #left-panel .inner-panel,.sidebyside #right-panel .inner-panel{padding:0}}

Binary file not shown.

View File

@ -0,0 +1,73 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_associations",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_associations.sidebyside",
"type": "preset",
"dependencies": [
"com_associations.sidebyside#style",
"com_associations.sidebyside#script"
]
},
{
"name": "com_associations.admin-associations-default",
"type": "script",
"uri": "com_associations/admin-associations-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "da8949"
},
{
"name": "com_associations.admin-associations-modal",
"type": "script",
"uri": "com_associations/admin-associations-modal.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "684ed0"
},
{
"name": "com_associations.associations-edit",
"type": "script",
"uri": "com_associations/associations-edit.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module",
"defer": true
},
"version": "375be7"
},
{
"name": "com_associations.sidebyside",
"type": "style",
"uri": "com_associations/sidebyside.min.css",
"version": "de6649"
},
{
"name": "com_associations.sidebyside",
"type": "script",
"uri": "com_associations/sidebyside.min.js",
"dependencies": [
"core",
"jquery"
],
"attributes": {
"defer": true
},
"version": "c267f6"
}
]
}

View File

@ -0,0 +1,17 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla.submitbutton = pressbutton => {
if (pressbutton === 'associations.purge') {
// eslint-disable-next-line no-restricted-globals
if (confirm(Joomla.Text._('COM_ASSOCIATIONS_PURGE_CONFIRM_PROMPT'))) {
Joomla.submitform(pressbutton);
} else {
return false;
}
} else {
Joomla.submitform(pressbutton);
}
return true;
};

View File

@ -0,0 +1 @@
Joomla.submitbutton=o=>{if("associations.purge"===o){if(!confirm(Joomla.Text._("COM_ASSOCIATIONS_PURGE_CONFIRM_PROMPT")))return!1;Joomla.submitform(o)}else Joomla.submitform(o);return!0};

View File

@ -0,0 +1,20 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
((Joomla, document) => {
document.addEventListener('DOMContentLoaded', () => {
const targetAssociation = window.parent.document.getElementById('target-association');
const links = [].slice.call(document.querySelectorAll('.select-link'));
links.forEach(item => {
item.addEventListener('click', ({
target
}) => {
targetAssociation.src = `${targetAssociation.getAttribute('data-editurl')}&task=${targetAssociation.getAttribute('data-item')}.edit&id=${parseInt(target.getAttribute('data-id'), 10)}`;
window.parent.Joomla.Modal.getCurrent().close();
});
});
});
})(Joomla, document);

View File

@ -0,0 +1 @@
Joomla=window.Joomla||{},((t,e)=>{e.addEventListener("DOMContentLoaded",(()=>{const t=window.parent.document.getElementById("target-association");[].slice.call(e.querySelectorAll(".select-link")).forEach((e=>{e.addEventListener("click",(({target:e})=>{t.src=`${t.getAttribute("data-editurl")}&task=${t.getAttribute("data-item")}.edit&id=${parseInt(e.getAttribute("data-id"),10)}`,window.parent.Joomla.Modal.getCurrent().close()}))}))}))})(Joomla,document);

View File

@ -0,0 +1,205 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
((Joomla, document) => {
Joomla.hideAssociation = (formControl, languageCode) => {
const controlGroup = [].slice.call(document.querySelectorAll('#associations .control-group'));
controlGroup.forEach(element => {
// Current selected language. Hide it
const el = element.querySelector('.control-label label');
if (el) {
const attribute = el.getAttribute('for');
if (attribute.replace(/_name$/, '') === `${formControl}_associations_${languageCode.replace('-', '_')}`) {
element.classList.add('hidden');
}
}
});
};
Joomla.showAssociationMessage = () => {
const controlGroup = [].slice.call(document.querySelectorAll('#associations .control-group'));
const associations = document.getElementById('associations');
if (associations) {
const html = document.createElement('joomla-alert');
html.innerText = Joomla.Text._('JGLOBAL_ASSOC_NOT_POSSIBLE');
associations.insertAdjacentElement('afterbegin', html);
}
controlGroup.forEach(element => {
element.classList.add('hidden');
});
};
/**
* Inject associations into other association fields
*
* This function is called whenever the Ajax request within propagateAssociation() completes
* successfully.
* Its purpose is to inject the associations which have been returned in the Ajax response into
* the other association fields in the form.
* It does this by invoking the various callback functions of those association fields (i.e. the
* function which gets called whenever the administrator selects an association via the modal),
* and passing the appropriate associated record details.
*
* @param result The response from the Ajax request.
* Its structure is that generated by the JResponseJson class,
* with the data field containing the associations
* @param callbackFunctionPrefix The name of the callback function which the modal window uses
* to set the selected item as the association, but minus the
* language tag at the end
*
* @return boolean
*
* @since 3.9.0
*/
Joomla.injectAssociations = (result, callbackFunctionPrefix) => {
let functionName;
if (result.success) {
if (result.data.length !== 0) {
[].slice.call(Object.keys(result.data)).forEach(lang => {
functionName = callbackFunctionPrefix + lang.replace('-', '_');
window[functionName](result.data[lang].id, result.data[lang].title, result.data[lang].catid, null, null, lang);
});
}
if (result.message) {
Joomla.renderMessages({
notice: [result.message]
});
}
} else {
Joomla.renderMessages({
warning: [Joomla.Text._('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED')]
});
}
};
/**
* Propagate associations from this field into other association fields
*
* This function is called whenever an administrator populates an association (in the association
* modal field) and then clicks on the Propagate button.
* The purpose of this function is to find what other records (if any) are associated with the
* one which the administrator has selected, and populate the other association fields with these
* records. (Otherwise, if the administrator just clicks on Save without clicking on Propagate,
* those other associations will be deleted). It does this by finding the id of the selected
* associated record (from a hidden field) and makes an Ajax call to the server to find the other
* associations, also passing up the language of the record currently being edited, as it should
* be excluded. Once it has received from the server the other associations it calls
* injectAssociations to inject them into the other association fields within the form.
*
* @param fieldPrefix The stem of the html ids for the elements comprising the
* modal field
* @param callbackFunctionPrefix The name of the callback function which the modal window uses
* to set the selected item as the association, but minus the
* language tag at the end
*
* @return boolean
*
* @since 3.9.0
*/
Joomla.propagateAssociation = (fieldPrefix, callbackFunctionPrefix) => {
// Find the id of the record which has been set as an association
const assocId = document.getElementById(`${fieldPrefix}_id`).value;
// Find the language of the record being edited
const languageField = document.getElementById('jform_language');
const currentLang = languageField.options[languageField.selectedIndex].value;
const data = {
task: 'ajax.fetchAssociations',
format: 'json',
assocId,
excludeLang: currentLang
};
data[Joomla.getOptions('csrf.token', '')] = 1;
const queryString = Object.keys(data).reduce((a, k) => {
a.push(`${k}=${encodeURIComponent(data[k])}`);
return a;
}, []).join('&');
const url = `${document.forms.adminForm.action}&${queryString}`;
Joomla.request({
// Find the action url associated with the form - we need to add the token to this
url,
method: 'GET',
data: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
},
onSuccess: response => {
Joomla.injectAssociations(JSON.parse(response), callbackFunctionPrefix);
},
onError: () => {
Joomla.renderMessages({
warning: [Joomla.Text._('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED')]
});
}
});
return false;
};
document.addEventListener('DOMContentLoaded', () => {
const associationsEditOptions = Joomla.getOptions('system.associations.edit');
const formControl = associationsEditOptions.formControl || 'jform';
const formControlLanguage = document.getElementById(`${formControl}_language`);
// Hide the associations tab if needed
if (parseInt(associationsEditOptions.hidden, 10) === 1) {
Joomla.showAssociationMessage();
} else if (formControlLanguage) {
// Hide only the associations for the current language
Joomla.hideAssociation(formControl, formControlLanguage.value);
}
// When changing the language
if (formControlLanguage) {
formControlLanguage.addEventListener('change', ({
target
}) => {
// Remove message if any
Joomla.removeMessages();
let existsAssociations = false;
/** For each language, remove the associations, ie,
* empty the associations fields and reset the buttons to Select/Create
*/
const controlGroup = [].slice.call(document.querySelectorAll('#associations .control-group'));
controlGroup.forEach(element => {
const attribute = element.querySelector('.control-label label').getAttribute('for');
const languageCode = attribute.replace('_name', '').replace('jform_associations_', '');
// Show the association fields
element.classList.remove('hidden');
// Check if there was an association selected for this language
if (!existsAssociations && document.getElementById(`${formControl}_associations_${languageCode}_id`).value !== '') {
existsAssociations = true;
}
// Call the modal clear button
let clear = document.getElementById(`${formControl}_associations_${languageCode}_clear`);
clear = clear || element.querySelector('[data-button-action="clear"]');
if (clear.onclick) {
clear.onclick();
} else if (clear.click) {
clear.click();
}
});
// If associations existed, send a warning to the user
if (existsAssociations) {
Joomla.renderMessages({
warning: [Joomla.Text._('JGLOBAL_ASSOCIATIONS_RESET_WARNING')]
});
}
// If the selected language is All hide the fields and add a message
const selectedLanguage = target.value;
if (selectedLanguage === '*') {
Joomla.showAssociationMessage();
} else {
// Else show the associations fields/buttons and hide the current selected language
Joomla.hideAssociation(formControl, selectedLanguage);
}
});
}
});
})(Joomla, document);

View File

@ -0,0 +1 @@
Joomla=window.Joomla||{},((e,s)=>{e.hideAssociation=(e,t)=>{[].slice.call(s.querySelectorAll("#associations .control-group")).forEach((s=>{const o=s.querySelector(".control-label label");if(o){o.getAttribute("for").replace(/_name$/,"")===`${e}_associations_${t.replace("-","_")}`&&s.classList.add("hidden")}}))},e.showAssociationMessage=()=>{const t=[].slice.call(s.querySelectorAll("#associations .control-group")),o=s.getElementById("associations");if(o){const t=s.createElement("joomla-alert");t.innerText=e.Text._("JGLOBAL_ASSOC_NOT_POSSIBLE"),o.insertAdjacentElement("afterbegin",t)}t.forEach((e=>{e.classList.add("hidden")}))},e.injectAssociations=(s,t)=>{let o;s.success?(0!==s.data.length&&[].slice.call(Object.keys(s.data)).forEach((e=>{o=t+e.replace("-","_"),window[o](s.data[e].id,s.data[e].title,s.data[e].catid,null,null,e)})),s.message&&e.renderMessages({notice:[s.message]})):e.renderMessages({warning:[e.Text._("JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED")]})},e.propagateAssociation=(t,o)=>{const a=s.getElementById(`${t}_id`).value,n=s.getElementById("jform_language"),c={task:"ajax.fetchAssociations",format:"json",assocId:a,excludeLang:n.options[n.selectedIndex].value};c[e.getOptions("csrf.token","")]=1;const i=Object.keys(c).reduce(((e,s)=>(e.push(`${s}=${encodeURIComponent(c[s])}`),e)),[]).join("&"),l=`${s.forms.adminForm.action}&${i}`;return e.request({url:l,method:"GET",data:JSON.stringify(c),headers:{"Content-Type":"application/json"},onSuccess:s=>{e.injectAssociations(JSON.parse(s),o)},onError:()=>{e.renderMessages({warning:[e.Text._("JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED")]})}}),!1},s.addEventListener("DOMContentLoaded",(()=>{const t=e.getOptions("system.associations.edit"),o=t.formControl||"jform",a=s.getElementById(`${o}_language`);1===parseInt(t.hidden,10)?e.showAssociationMessage():a&&e.hideAssociation(o,a.value),a&&a.addEventListener("change",(({target:t})=>{e.removeMessages();let a=!1;[].slice.call(s.querySelectorAll("#associations .control-group")).forEach((e=>{const t=e.querySelector(".control-label label").getAttribute("for").replace("_name","").replace("jform_associations_","");e.classList.remove("hidden"),a||""===s.getElementById(`${o}_associations_${t}_id`).value||(a=!0);let n=s.getElementById(`${o}_associations_${t}_clear`);n=n||e.querySelector('[data-button-action="clear"]'),n.onclick?n.onclick():n.click&&n.click()})),a&&e.renderMessages({warning:[e.Text._("JGLOBAL_ASSOCIATIONS_RESET_WARNING")]});const n=t.value;"*"===n?e.showAssociationMessage():e.hideAssociation(o,n)}))}))})(Joomla,document);

Binary file not shown.

View File

@ -0,0 +1,304 @@
/**
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// @TODO remove jQuery dependency
jQuery(document).ready(function($) {
$('#toolbar-target').hide();
$('#toolbar-copy').hide();
// Save button actions, replacing the default Joomla.submitbutton() with custom function.
Joomla.submitbutton = function(task) {
// Using close button, normal joomla submit.
if (task === 'association.cancel') {
Joomla.submitform(task);
} else if(task === 'copy') {
document.body.appendChild(document.createElement('joomla-core-loader'));
var targetLang = document.getElementById('target-association').getAttribute('data-language'),
referlangInput = window.frames['reference-association'].document.getElementById('jform_language');
// Set target language, to get correct content language in the copy
referlangInput.removeAttribute('disabled');
referlangInput.value = targetLang;
window.frames['reference-association'].Joomla.submitbutton(document.getElementById('adminForm').getAttribute('data-associatedview') + '.save2copy');
} else if (task === 'undo-association') { // Undo association
var reference = document.getElementById('reference-association');
var target = document.getElementById('target-association');
var referenceId = reference.getAttribute('data-id');
var referenceLang = reference.getAttribute('data-language').replace(/-/,'_');
var targetId = target.getAttribute('data-id');
var targetLang = target.getAttribute('data-language').replace(/-/,'_');
reference = $(reference).contents();
target = $(target).contents();
// Remove it on the reference
// - For modal association selectors.
reference.find('#jform_associations_' + targetLang + '_id').val('');
reference.find('#jform_associations_' + targetLang + '_name').val('');
// - For chosen association selectors (menus).
reference.find('#jform_associations_' + targetLang).val('');
var lang = '';
// Remove it on the target
$('#jform_itemlanguage option').each(function()
{
lang = $(this).val().split(':')[0];
if (lang) {
lang = lang.replace(/-/,'_');
// - For modal association selectors.
target.find('#jform_associations_' + lang + '_id').val('');
// - For chosen association selectors (menus).
target.find('#jform_associations_' + lang).val('');
}
});
// Same as above but reference language is not in the selector
// - For modal association selectors.
target.find('#jform_associations_' + referenceLang + '_id').val('');
target.find('#jform_associations_' + referenceLang + '_name').val('');
// - For chosen association selectors (menus).
target.find('#jform_associations_' + referenceLang).val('');
// Reset switcher after removing association
var currentLangSelect = $('#jform_itemlanguage');
var currentSwitcher = currentLangSelect.val();
var currentLang = targetLang.replace(/_/,'-');
$('#jform_itemlanguage option[value=\"' + currentSwitcher + '\"]').val(currentLang + ':0:add');
currentLangSelect.val('');
currentLangSelect[0].dispatchEvent(new CustomEvent('change', {
bubbles: true,
cancelable: true,
}));
// Save one of the items to confirm action
Joomla.submitbutton('reference');
} else {
// Saving target or reference, send the save action to the target/reference iframe.
// We need to re-enable the language field to save.
$('#' + task + '-association').contents().find('#jform_language').attr('disabled', false);
window.frames[task + '-association'].Joomla.submitbutton(document.getElementById('adminForm').getAttribute('data-associatedview') + '.apply');
}
return false;
};
// Attach behaviour to toggle button.
$(document).on('click', '#toggle-left-panel', function() {
var referenceHide = this.getAttribute('data-hide-reference');
var referenceShow = this.getAttribute('data-show-reference');
if ($(this).text() === referenceHide) {
$(this).text(referenceShow);
} else {
$(this).text(referenceHide);
}
$('#left-panel').toggle();
$('#right-panel').toggleClass('full-width');
});
// Attach behaviour to language selector change event.
$(document).on('change', '#jform_itemlanguage', function() {
var target = document.getElementById('target-association');
var selected = $(this).val();
// Populate the data attributes and load the the edit page in target frame.
if (selected !== '' && typeof selected !== 'undefined') {
target.setAttribute('data-action', selected.split(':')[2]);
target.setAttribute('data-id', selected.split(':')[1]);
target.setAttribute('data-language', selected.split(':')[0]);
// Iframe load start, show Joomla loading layer.
document.body.appendChild(document.createElement('joomla-core-loader'));
// Load the target frame.
target.src = target.getAttribute('data-editurl') + '&task=' + target.getAttribute('data-item') + '.' + target.getAttribute('data-action') + '&id=' + target.getAttribute('data-id');
} else {
// Reset the data attributes and no item to load.
$('#toolbar-target').hide();
$('#toolbar-copy').hide();
$('#select-change').addClass("hidden");
$('#remove-assoc').addClass("hidden");
target.setAttribute('data-action', '');
target.setAttribute('data-id', '0');
target.setAttribute('data-language', '');
target.src = '';
}
});
// Attach behaviour to reference frame load event.
$('#reference-association').on('load', function() {
// Waiting until the reference has loaded before loading the target to avoid race conditions
var targetURL = Joomla.getOptions('targetSrc', false);
if (targetURL)
{
targetURL = targetURL.split('&amp;').join('&');
document.getElementById('target-association').setAttribute('src', targetURL);
Joomla.loadOptions({'targetSrc': false});
return;
}
// Load Target Pane AFTER reference pane has loaded to prevent session conflict with checkout
document.getElementById('target-association').setAttribute('src', document.getElementById('target-association').getAttribute('src'));
// If copy button used
if ($(this).contents().find('#jform_id').val() !== this.getAttribute('data-id')) {
var target = document.getElementById('target-association');
target.src = target.getAttribute('data-editurl') + '&task=' + target.getAttribute('data-item') + '.edit' + '&id=' + $(this).contents().find('#jform_id').val();
this.src = this.getAttribute('data-editurl') + '&task=' + this.getAttribute('data-item') + '.edit' + '&id=' + this.getAttribute('data-id');
}
var reference = $(this).contents();
// Disable language field.
reference.find('#jform_language').attr('disabled', '');
// Remove modal buttons on the reference
reference.find('#associations').find('.btn').remove();
var parse = '';
$('#jform_itemlanguage option').each(function() {
parse = $(this).val().split(':');
if (typeof parse[0] !== 'undefined') {
// - For modal association selectors.
var langAssociation = parse[0].replace(/-/,'_');
if (reference.find('#jform_associations_' + langAssociation + '_id').val() == '') {
reference.find('#jform_associations_' + langAssociation + '_name')
.val(document.getElementById('reference-association').getAttribute('data-no-assoc'));
}
}
});
// Iframe load finished, hide Joomla loading layer.
var spinner = document.querySelector('joomla-core-loader');
if (spinner) {
spinner.parentNode.removeChild(spinner);
}
});
// Attach behaviour to target frame load event.
$('#target-association').on('load', function() {
// We need to check if we are not loading a blank iframe.
if (this.getAttribute('src') != '') {
$('#toolbar-target').show();
$('#toolbar-copy').show();
$('#select-change').removeClass("hidden");
var targetLanguage = this.getAttribute('data-language');
var targetId = this.getAttribute('data-id');
var targetLoadedId = $(this).contents().find('#jform_id').val() || '0';
// Remove modal buttons on the target
$(this).contents().find('a[href=\"#associations\"]').parent().find('.btn').remove();
$(this).contents().find('#associations').find('.btn').remove();
// Always show General tab first if associations tab is selected on the reference
if ($(this).contents().find('#associations').hasClass('active')) {
$(this).contents().find('a[href=\"#associations\"]').parent().removeClass('active');
$(this).contents().find('#associations').removeClass('active');
$(this).contents().find('.nav-tabs').find('li').first().addClass('active');
$(this).contents().find('.tab-content').find('.tab-pane').first().addClass('active');
}
// Update language field with the selected language and them disable it.
$(this).contents().find('#jform_language').val(targetLanguage).attr('disabled', '');
// If we are creating a new association (before save) we need to add the new association.
if (targetLoadedId == '0')
{
document.getElementById('select-change-text').innerHTML = Joomla.sanitizeHtml(document.getElementById('select-change').getAttribute('data-select'));
}
// If we are editing an association.
else
{
// Show change language button
document.getElementById('select-change-text').innerHTML = Joomla.sanitizeHtml(document.getElementById('select-change').getAttribute('data-change'));
$('#remove-assoc').removeClass("hidden");
$('#toolbar-copy').hide();
// Add the id to list of items to check in on close.
var currentIdList = document.getElementById('target-id').value;
var updatedList = currentIdList == '' ? targetLoadedId : currentIdList + ',' + targetLoadedId;
document.getElementById('target-id').value = updatedList;
// If we created a new association (after save).
if (targetLoadedId != targetId) {
// Refresh the language selector with the new id (used after save).
$('#jform_itemlanguage option[value^=\"' + targetLanguage + ':' + targetId + ':add\"]').val(targetLanguage + ':' + targetLoadedId + ':edit');
// Update main frame data-id attribute (used after save).
this.setAttribute('data-id', targetLoadedId);
this.setAttribute('data-action', 'edit');
}
// Update the reference item associations tab.
var reference = document.getElementById('reference-association');
var languageCode = targetLanguage.replace(/-/, '_');
var referenceTitle = reference.getAttribute('data-title');
var title = $(this).contents().find('#jform_' + referenceTitle).val();
// - For modal association selectors.
$(reference).contents().find('#jform_associations_' + languageCode + '_id').val(targetLoadedId);
$(reference).contents().find('#jform_associations_' + languageCode + '_name').val(title);
// - For chosen association selectors (menus).
$(reference).contents().find('#jform_associations_' + languageCode).append('<option value=\"'+ targetLoadedId + '\">' + title + '</option>');
$(reference).contents().find('#jform_associations_' + languageCode).val(targetLoadedId);
}
// Update the target item associations tab.
var reference = document.getElementById('reference-association');
var referenceId = reference.getAttribute('data-id');
var languageCode = reference.getAttribute('data-language').replace(/-/, '_');
var target = document.getElementById('target-association');
var targetTitle = target.getAttribute('data-title');
var title = reference.getAttribute('data-title-value');
var target = $(this).contents();
// - For modal association selectors.
target.find('#jform_associations_' + languageCode + '_id').val(referenceId);
target.find('#jform_associations_' + languageCode + '_name').val(title);
// - For chosen association selectors (menus).
var chosenField = target.find('#jform_associations_' + languageCode);
chosenField.append('<option value=\"'+ referenceId + '\">' + title + '</option>');
chosenField.val(referenceId);
var parse, langAssociation;
$('#jform_itemlanguage option').each(function() {
parse = $(this).val().split(':');
if (typeof parse[1] !== 'undefined' && parse[1] !== '0') {
// - For modal association selectors.
langAssociation = parse[0].replace(/-/,'_');
target.find('#jform_associations_' + langAssociation + '_id').val(parse[1]);
// - For chosen association selectors (menus).
chosenField = target.find('#jform_associations_' + langAssociation);
chosenField.append('<option value=\"'+ parse[1] + '\"></option>');
chosenField.val(parse[1]);
}
});
// Iframe load finished, hide Joomla loading layer.
var spinner = document.querySelector('joomla-core-loader');
if (spinner) {
spinner.parentNode.removeChild(spinner);
}
}
});
});

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,21 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_banners",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_banners.admin-banner-edit",
"type": "script",
"uri": "com_banners/admin-banner-edit.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "167a61"
}
]
}

View File

@ -0,0 +1,40 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(document => {
const updateBannerFields = value => {
const imgWrapper = document.getElementById('image');
const custom = document.getElementById('custom');
switch (value) {
case '0':
// Image
imgWrapper.classList.remove('hidden');
custom.classList.add('hidden');
break;
case '1':
// Custom
imgWrapper.classList.add('hidden');
custom.classList.remove('hidden');
break;
// Do nothing
}
};
document.addEventListener('DOMContentLoaded', () => {
const jformType = document.getElementById('jform_type');
if (jformType) {
// Hide/show parameters initially
updateBannerFields(jformType.value);
// Hide/show parameters when the type has been selected
jformType.addEventListener('change', ({
target
}) => {
updateBannerFields(target.value);
});
}
});
})(document);

View File

@ -0,0 +1 @@
(e=>{const t=t=>{const d=e.getElementById("image"),s=e.getElementById("custom");switch(t){case"0":d.classList.remove("hidden"),s.classList.add("hidden");break;case"1":d.classList.add("hidden"),s.classList.remove("hidden")}};e.addEventListener("DOMContentLoaded",(()=>{const d=e.getElementById("jform_type");d&&(t(d.value),d.addEventListener("change",(({target:e})=>{t(e.value)})))}))})(document);

Binary file not shown.

View File

@ -0,0 +1,21 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_cache",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_cache.admin-cache",
"type": "script",
"uri": "com_cache/admin-cache-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "8490a9"
}
]
}

View File

@ -0,0 +1,18 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
((document, Joomla) => {
document.addEventListener('DOMContentLoaded', () => {
[].slice.call(document.querySelectorAll('.cache-entry')).forEach(el => {
el.addEventListener('click', ({
currentTarget
}) => {
Joomla.isChecked(currentTarget.checked);
});
});
});
})(document, Joomla);

View File

@ -0,0 +1 @@
Joomla=window.Joomla||{},((e,c)=>{e.addEventListener("DOMContentLoaded",(()=>{[].slice.call(e.querySelectorAll(".cache-entry")).forEach((e=>{e.addEventListener("click",(({currentTarget:e})=>{c.isChecked(e.checked)}))}))}))})(document,Joomla);

Binary file not shown.

View File

@ -0,0 +1,17 @@
.com-content-categories__item {
border-bottom: 1px solid #dfe3e7;
}
.com-content-categories__item-title-wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: .5rem 0;
}
.com-content-categories__children {
flex-basis: 100%;
padding-inline-start: 1.5rem;
border-top: 1px solid #dfe3e7;
}
.com-content-categories__children .com-content-categories__item:last-child {
border-bottom: none;
}

View File

@ -0,0 +1 @@
.com-content-categories__item{border-bottom:1px solid #dfe3e7}.com-content-categories__item-title-wrapper{-webkit-box-pack:justify;-ms-flex-pack:justify;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;justify-content:space-between;padding:.5rem 0}.com-content-categories__children{-ms-flex-preferred-size:100%;-webkit-padding-start:1.5rem;border-top:1px solid #dfe3e7;flex-basis:100%;padding-inline-start:1.5rem}.com-content-categories__children .com-content-categories__item:last-child{border-bottom:none}

View File

@ -0,0 +1,35 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_categories",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_categories.shared-categories-accordion",
"type": "preset",
"dependencies": [
"com_categories.shared-categories-accordion#style",
"com_categories.shared-categories-accordion#script"
]
},
{
"name": "com_categories.shared-categories-accordion",
"type": "script",
"uri": "com_categories/shared-categories-accordion.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "39ae85"
},
{
"name": "com_categories.shared-categories-accordion",
"type": "style",
"uri": "com_categories/shared-categories-accordion.min.css",
"version": "b93a2b"
}
]
}

View File

@ -0,0 +1,40 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
if (!Joomla || !Joomla.Text) {
throw new Error('core.js was not properly initialised');
}
// Selectors used by this script
const buttonsSelector = '[id^=category-btn-]';
/**
* Handle the category toggle button click event
* @param event
*/
const handleCategoryToggleButtonClick = ({
currentTarget
}) => {
const button = currentTarget;
const icon = button.querySelector('span');
// Toggle icon class
icon.classList.toggle('icon-plus');
icon.classList.toggle('icon-minus');
// Toggle aria label, aria-expanded
const ariaLabel = button.getAttribute('aria-label');
const ariaExpanded = button.getAttribute('aria-expanded');
button.setAttribute('aria-label', ariaLabel === Joomla.Text._('JGLOBAL_EXPAND_CATEGORIES') ? Joomla.Text._('JGLOBAL_COLLAPSE_CATEGORIES') : Joomla.Text._('JGLOBAL_EXPAND_CATEGORIES'));
button.setAttribute('aria-expanded', ariaExpanded === 'false' ? 'true' : 'false');
const {
categoryId
} = button.dataset;
const target = document.getElementById(`category-${categoryId}`);
target.toggleAttribute('hidden');
};
Array.from(document.querySelectorAll(buttonsSelector)).forEach(button => {
button.addEventListener('click', handleCategoryToggleButtonClick);
});

View File

@ -0,0 +1 @@
if(!Joomla||!Joomla.Text)throw new Error("core.js was not properly initialised");const buttonsSelector="[id^=category-btn-]",handleCategoryToggleButtonClick=({currentTarget:t})=>{const e=t,o=e.querySelector("span");o.classList.toggle("icon-plus"),o.classList.toggle("icon-minus");const a=e.getAttribute("aria-label"),r=e.getAttribute("aria-expanded");e.setAttribute("aria-label",a===Joomla.Text._("JGLOBAL_EXPAND_CATEGORIES")?Joomla.Text._("JGLOBAL_COLLAPSE_CATEGORIES"):Joomla.Text._("JGLOBAL_EXPAND_CATEGORIES")),e.setAttribute("aria-expanded","false"===r?"true":"false");const{categoryId:l}=e.dataset;document.getElementById(`category-${l}`).toggleAttribute("hidden")};Array.from(document.querySelectorAll(buttonsSelector)).forEach((t=>{t.addEventListener("click",handleCategoryToggleButtonClick)}));

View File

@ -0,0 +1,57 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_config",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_config.config",
"type": "script",
"uri": "com_config/config-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "7fff86"
},
{
"name": "com_config.modules",
"type": "script",
"uri": "com_config/modules-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "e3d9c2"
},
{
"name": "com_config.templates",
"type": "script",
"uri": "com_config/templates-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "ed437d"
},
{
"name": "com_config.filters",
"type": "script",
"uri": "com_config/config-filters.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "8b334f"
}
]
}

View File

@ -0,0 +1,37 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, submitForm) => {
// Selectors used by this script
const buttonDataSelector = 'data-submit-task';
/**
* Submit the task
* @param task
* @param form
*/
const submitTask = (task, form) => {
if (task === 'config.cancel' || document.formvalidator.isValid(form)) {
submitForm(task, form);
}
};
/**
* Register events
*/
const registerEvents = () => {
const buttons = [].slice.call(document.querySelectorAll(`[${buttonDataSelector}]`));
buttons.forEach(button => {
button.addEventListener('click', e => {
e.preventDefault();
const task = e.currentTarget.getAttribute(buttonDataSelector);
submitTask(task, e.currentTarget.form);
});
});
};
document.addEventListener('DOMContentLoaded', () => {
registerEvents();
});
})(document, Joomla.submitform);

View File

@ -0,0 +1 @@
((t,e)=>{const r="data-submit-task",a=()=>{[].slice.call(t.querySelectorAll(`[${r}]`)).forEach((a=>{a.addEventListener("click",(a=>{a.preventDefault();((r,a)=>{("config.cancel"===r||t.formvalidator.isValid(a))&&e(r,a)})(a.currentTarget.getAttribute(r),a.currentTarget.form)}))}))};t.addEventListener("DOMContentLoaded",(()=>{a()}))})(document,Joomla.submitform);

Binary file not shown.

View File

@ -0,0 +1,27 @@
/**
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
const recursiveApplyChanges = id => {
const childs = [].slice.call(document.querySelectorAll(`#filter-config select[data-parent="${id}"]`));
childs.map(child => {
recursiveApplyChanges(child.dataset.id);
child.value = 'NONE';
return child;
});
};
const applyChanges = event => {
const currentElement = event.currentTarget;
const currentFilter = currentElement.options[currentElement.selectedIndex].value;
if (currentFilter === 'NONE') {
const childs = [].slice.call(document.querySelectorAll(`#filter-config select[data-parent="${currentElement.dataset.id}"]`));
if (childs.length && window.confirm(Joomla.Text._('COM_CONFIG_TEXT_FILTERS_NOTE'))) {
childs.map(child => {
recursiveApplyChanges(child.dataset.id);
child.value = 'NONE';
return child;
});
}
}
};
[].slice.call(document.querySelectorAll('#filter-config select')).map(select => select.addEventListener('change', applyChanges));

View File

@ -0,0 +1 @@
const recursiveApplyChanges=e=>{[].slice.call(document.querySelectorAll(`#filter-config select[data-parent="${e}"]`)).map((e=>(recursiveApplyChanges(e.dataset.id),e.value="NONE",e)))},applyChanges=e=>{const l=e.currentTarget;if("NONE"===l.options[l.selectedIndex].value){const e=[].slice.call(document.querySelectorAll(`#filter-config select[data-parent="${l.dataset.id}"]`));e.length&&window.confirm(Joomla.Text._("COM_CONFIG_TEXT_FILTERS_NOTE"))&&e.map((e=>(recursiveApplyChanges(e.dataset.id),e.value="NONE",e)))}};[].slice.call(document.querySelectorAll("#filter-config select")).map((e=>e.addEventListener("change",applyChanges)));

Binary file not shown.

View File

@ -0,0 +1,37 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, submitForm) => {
// Selectors used by this script
const buttonDataSelector = 'data-submit-task';
/**
* Submit the task
* @param task
* @param form
*/
const submitTask = (task, form) => {
if (task === 'modules.cancel' || document.formvalidator.isValid(form)) {
submitForm(task, form);
}
};
/**
* Register events
*/
const registerEvents = () => {
const buttons = [].slice.call(document.querySelectorAll(`[${buttonDataSelector}]`));
buttons.forEach(button => {
button.addEventListener('click', e => {
e.preventDefault();
const task = e.currentTarget.getAttribute(buttonDataSelector);
submitTask(task, e.currentTarget.form);
});
});
};
document.addEventListener('DOMContentLoaded', () => {
registerEvents();
});
})(document, Joomla.submitform);

View File

@ -0,0 +1 @@
((e,t)=>{const r="data-submit-task",a=()=>{[].slice.call(e.querySelectorAll(`[${r}]`)).forEach((a=>{a.addEventListener("click",(a=>{a.preventDefault();((r,a)=>{("modules.cancel"===r||e.formvalidator.isValid(a))&&t(r,a)})(a.currentTarget.getAttribute(r),a.currentTarget.form)}))}))};e.addEventListener("DOMContentLoaded",(()=>{a()}))})(document,Joomla.submitform);

Binary file not shown.

View File

@ -0,0 +1,37 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, submitForm) => {
// Selectors used by this script
const buttonDataSelector = 'data-submit-task';
/**
* Submit the task
* @param task
* @param form
*/
const submitTask = (task, form) => {
if (task === 'templates.cancel' || document.formvalidator.isValid(form)) {
submitForm(task, form);
}
};
/**
* Register events
*/
const registerEvents = () => {
const buttons = [].slice.call(document.querySelectorAll(`[${buttonDataSelector}]`));
buttons.forEach(button => {
button.addEventListener('click', e => {
e.preventDefault();
const task = e.currentTarget.getAttribute(buttonDataSelector);
submitTask(task, e.currentTarget.form);
});
});
};
document.addEventListener('DOMContentLoaded', () => {
registerEvents();
});
})(document, Joomla.submitform);

View File

@ -0,0 +1 @@
((t,e)=>{const a="data-submit-task",r=()=>{[].slice.call(t.querySelectorAll(`[${a}]`)).forEach((r=>{r.addEventListener("click",(r=>{r.preventDefault();((a,r)=>{("templates.cancel"===a||t.formvalidator.isValid(r))&&e(a,r)})(r.currentTarget.getAttribute(a),r.currentTarget.form)}))}))};t.addEventListener("DOMContentLoaded",(()=>{r()}))})(document,Joomla.submitform);

Binary file not shown.

View 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"
}
]
}

View 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();
}
});
}
});
})();

View 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()}))}));

Binary file not shown.

View 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);

View 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);

Binary file not shown.

View File

@ -0,0 +1,108 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_content",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_content.admin-article-pagebreak",
"type": "script",
"uri": "com_content/admin-article-pagebreak.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module",
"defer": true
},
"version": "b6b30a"
},
{
"name": "com_content.admin-article-readmore",
"type": "script",
"uri": "com_content/admin-article-readmore.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "a38c94"
},
{
"name": "com_content.admin-articles-batch",
"type": "script",
"uri": "com_content/admin-articles-default-batch-footer.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "f06806"
},
{
"name": "com_content.admin-articles-modal",
"type": "script",
"uri": "com_content/admin-articles-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": "599bae"
},
{
"name": "com_content.admin-articles-stage",
"type": "script",
"uri": "com_content/admin-articles-default-stage-footer.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "479151"
},
{
"name": "com_content.form-edit",
"type": "script",
"uri": "com_content/form-edit.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "86b1be"
},
{
"name": "com_content.articles-list",
"type": "script",
"uri": "com_content/articles-list.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "c512d2"
},
{
"name": "com_content.articles-status",
"type": "script",
"uri": "com_content/articles-status.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "678d9a"
}
]
}

View File

@ -0,0 +1,26 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(() => {
window.insertPagebreak = editor => {
// Get the pagebreak title
let title = document.getElementById('title').value;
if (!window.parent.Joomla.getOptions('xtd-pagebreak')) {
// Something went wrong!
window.parent.Joomla.Modal.getCurrent().close();
return false;
}
// Get the pagebreak toc alias -- not inserting for now don't know which attribute to use..
let alt = document.getElementById('alt').value;
title = title !== '' ? `title="${title}"` : '';
alt = alt !== '' ? `alt="${alt}"` : '';
const tag = `<hr class="system-pagebreak" ${title} ${alt}>`;
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
window.parent.Joomla.Modal.getCurrent().close();
return false;
};
})();

View File

@ -0,0 +1 @@
window.insertPagebreak=e=>{let t=document.getElementById("title").value;if(!window.parent.Joomla.getOptions("xtd-pagebreak"))return window.parent.Joomla.Modal.getCurrent().close(),!1;let a=document.getElementById("alt").value;t=""!==t?`title="${t}"`:"",a=""!==a?`alt="${a}"`:"";const n=`<hr class="system-pagebreak" ${t} ${a}>`;return window.parent.Joomla.editors.instances[e].replaceSelection(n),window.parent.Joomla.Modal.getCurrent().close(),!1};

Binary file not shown.

View File

@ -0,0 +1,29 @@
import { JoomlaEditor, JoomlaEditorButton } from 'editor-api';
import JoomlaDialog from 'joomla.dialog';
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
const insertReadmoreHandler = editor => {
const content = editor.getValue();
if (!content) {
editor.replaceSelection('<hr id="system-readmore">');
} else if (content && !content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) {
editor.replaceSelection('<hr id="system-readmore">');
} else {
JoomlaDialog.alert(Joomla.Text._('PLG_READMORE_ALREADY_EXISTS'));
}
};
// @TODO: Remove in Joomla 6
window.insertReadmore = () => {
// eslint-disable-next-line no-console
console.warn('Method window.insertReadmore() is deprecated, use button action "insert-readmore."');
const editor = JoomlaEditor.getActive();
if (!editor) {
throw new Error('An active editor are not available');
}
insertReadmoreHandler(editor);
};
JoomlaEditorButton.registerAction('insert-readmore', insertReadmoreHandler);

View File

@ -0,0 +1 @@
import{JoomlaEditor,JoomlaEditorButton}from"editor-api";import JoomlaDialog from"joomla.dialog";const insertReadmoreHandler=e=>{const o=e.getValue();o?o&&!o.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)?e.replaceSelection('<hr id="system-readmore">'):JoomlaDialog.alert(Joomla.Text._("PLG_READMORE_ALREADY_EXISTS")):e.replaceSelection('<hr id="system-readmore">')};window.insertReadmore=()=>{console.warn('Method window.insertReadmore() is deprecated, use button action "insert-readmore."');const e=JoomlaEditor.getActive();if(!e)throw new Error("An active editor are not available");insertReadmoreHandler(e)},JoomlaEditorButton.registerAction("insert-readmore",insertReadmoreHandler);

Binary file not shown.

View File

@ -0,0 +1,33 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, submitForm) => {
// Selectors used by this script
const buttonDataSelector = 'data-submit-task';
const formId = 'adminForm';
/**
* Submit the task
* @param task
*/
const submitTask = task => {
const form = document.getElementById(formId);
if (form && task === 'article.batch') {
submitForm(task, form);
}
};
// Register events
document.addEventListener('DOMContentLoaded', () => {
const button = document.getElementById('batch-submit-button-id');
if (button) {
button.addEventListener('click', e => {
const task = e.target.getAttribute(buttonDataSelector);
submitTask(task);
return false;
});
}
});
})(document, Joomla.submitform);

View File

@ -0,0 +1 @@
((t,e)=>{t.addEventListener("DOMContentLoaded",(()=>{const n=t.getElementById("batch-submit-button-id");n&&n.addEventListener("click",(n=>((n=>{const a=t.getElementById("adminForm");a&&"article.batch"===n&&e(n,a)})(n.target.getAttribute("data-submit-task")),!1)))}))})(document,Joomla.submitform);

View File

@ -0,0 +1,32 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, submitForm) => {
// Selectors used by this script
const buttonDataSelector = 'data-submit-task';
const formId = 'adminForm';
/**
* Submit the task
* @param task
*/
const submitTask = task => {
const form = document.getElementById(formId);
if (form) {
submitForm(task, form);
}
};
// Register events
document.addEventListener('DOMContentLoaded', () => {
const button = document.getElementById('stage-submit-button-id');
if (button) {
button.addEventListener('click', e => {
const task = e.target.getAttribute(buttonDataSelector);
submitTask(task);
});
}
});
})(document, Joomla.submitform);

View File

@ -0,0 +1 @@
((t,e)=>{t.addEventListener("DOMContentLoaded",(()=>{const n=t.getElementById("stage-submit-button-id");n&&n.addEventListener("click",(n=>{(n=>{const d=t.getElementById("adminForm");d&&e(n,d)})(n.target.getAttribute("data-submit-task"))}))}))})(document,Joomla.submitform);

View File

@ -0,0 +1,53 @@
/**
* @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 jSelectArticle when an article is clicked
* jSelectArticle creates the link tag, sends it to the editor,
* and closes the select frame.
* */
window.jSelectArticle = (id, title, catid, object, link, lang) => {
// eslint-disable-next-line no-console
console.warn('Method jSelectArticle() is deprecated. Use postMessage() instead.');
if (!Joomla.getOptions('xtd-articles')) {
return;
}
const {
editor
} = Joomla.getOptions('xtd-articles');
const tag = `<a href="${link}"${lang !== '' ? ` hreflang="${lang}"` : ''}>${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();
}
};
document.querySelectorAll('.select-link').forEach(element => {
// Listen for click event
element.addEventListener('click', event => {
event.preventDefault();
const {
target
} = event;
const functionName = target.getAttribute('data-function');
if (functionName === 'jSelectArticle' && window[functionName]) {
// Used in xtd_contacts
window[functionName](target.getAttribute('data-id'), target.getAttribute('data-title'), target.getAttribute('data-cat-id'), null, target.getAttribute('data-uri'), target.getAttribute('data-language'));
} else if (window.parent[functionName]) {
// Used in com_menus
window.parent[functionName](target.getAttribute('data-id'), target.getAttribute('data-title'), target.getAttribute('data-cat-id'), null, target.getAttribute('data-uri'), target.getAttribute('data-language'));
}
if (window.parent.Joomla.Modal && window.parent.Joomla.Modal.getCurrent()) {
window.parent.Joomla.Modal.getCurrent().close();
}
});
});
})();

View File

@ -0,0 +1 @@
window.parent.JoomlaExpectingPostMessage||(window.jSelectArticle=(t,e,a,o,i,n)=>{if(console.warn("Method jSelectArticle() is deprecated. Use postMessage() instead."),!Joomla.getOptions("xtd-articles"))return;const{editor:r}=Joomla.getOptions("xtd-articles"),d=`<a href="${i}"${""!==n?` hreflang="${n}"`:""}>${e}</a>`;window.parent.Joomla.editors.instances[r].replaceSelection(d),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()},document.querySelectorAll(".select-link").forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault();const{target:e}=t,a=e.getAttribute("data-function");"jSelectArticle"===a&&window[a]?window[a](e.getAttribute("data-id"),e.getAttribute("data-title"),e.getAttribute("data-cat-id"),null,e.getAttribute("data-uri"),e.getAttribute("data-language")):window.parent[a]&&window.parent[a](e.getAttribute("data-id"),e.getAttribute("data-title"),e.getAttribute("data-cat-id"),null,e.getAttribute("data-uri"),e.getAttribute("data-language")),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()}))})));

Binary file not shown.

View 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);

View 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);

Binary file not shown.

View File

@ -0,0 +1,16 @@
/**
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(() => {
document.addEventListener('DOMContentLoaded', () => {
const elements = [].slice.call(document.querySelectorAll('.article-status'));
elements.forEach(element => {
element.addEventListener('click', event => {
event.stopPropagation();
});
});
});
})();

View File

@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",(()=>{[].slice.call(document.querySelectorAll(".article-status")).forEach((e=>{e.addEventListener("click",(e=>{e.stopPropagation()}))}))}));

Binary file not shown.

View File

@ -0,0 +1,33 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, submitForm) => {
// Selectors used by this script
const buttonDataSelector = 'data-submit-task';
const formId = 'adminForm';
/**
* Submit the task
* @param task
*/
const submitTask = task => {
const form = document.getElementById(formId);
if (task === 'article.cancel' || document.formvalidator.isValid(form)) {
submitForm(task, form);
}
};
// Register events
document.addEventListener('DOMContentLoaded', () => {
const buttons = [].slice.call(document.querySelectorAll(`[${buttonDataSelector}]`));
buttons.forEach(button => {
button.addEventListener('click', e => {
e.preventDefault();
const task = e.target.getAttribute(buttonDataSelector);
submitTask(task);
});
});
});
})(document, Joomla.submitform);

1
media/com_content/js/form-edit.min.js vendored Normal file
View File

@ -0,0 +1 @@
((t,e)=>{const a="data-submit-task";t.addEventListener("DOMContentLoaded",(()=>{[].slice.call(t.querySelectorAll(`[${a}]`)).forEach((l=>{l.addEventListener("click",(l=>{l.preventDefault();(a=>{const l=t.getElementById("adminForm");("article.cancel"===a||t.formvalidator.isValid(l))&&e(a,l)})(l.target.getAttribute(a))}))}))}))})(document,Joomla.submitform);

Binary file not shown.

View File

@ -0,0 +1,45 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_contenthistory",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_contenthistory.admin-history-versions",
"type": "script",
"uri": "",
"deprecated": true,
"dependencies": [
"core"
],
"attributes": {
"type": "module"
}
},
{
"name": "com_contenthistory.admin-compare-compare",
"type": "script",
"uri": "com_contenthistory/admin-compare-compare.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "75ba63"
},
{
"name": "com_contenthistory.admin-history-modal",
"type": "script",
"uri": "com_contenthistory/admin-history-modal.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "fbc6a9"
}
]
}

View File

@ -0,0 +1,45 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(() => {
// This method is used to decode HTML entities
const decodeHtml = html => {
const textarea = document.createElement('textarea');
textarea.innerHTML = Joomla.sanitizeHtml(html);
return textarea.value;
};
const compare = (original, changed) => {
const display = changed.nextElementSibling;
const diff = window.Diff.diffWords(original.innerHTML, changed.innerHTML);
const fragment = document.createDocumentFragment();
diff.forEach(part => {
let color = '';
if (part.added) {
color = '#a6f3a6';
}
if (part.removed) {
color = '#f8cbcb';
}
// @todo use the tag MARK here not SPAN
const span = document.createElement('span');
span.style.backgroundColor = color;
span.style.borderRadius = '.2rem';
span.appendChild(document.createTextNode(decodeHtml(part.value)));
fragment.appendChild(span);
});
display.appendChild(fragment);
};
const onBoot = () => {
const diffs = [].slice.call(document.querySelectorAll('.original'));
diffs.forEach(fragment => {
compare(fragment, fragment.nextElementSibling);
});
// Cleanup
document.removeEventListener('DOMContentLoaded', onBoot);
};
document.addEventListener('DOMContentLoaded', onBoot);
})();

View File

@ -0,0 +1 @@
(()=>{const e=(e,n)=>{const t=n.nextElementSibling,o=window.Diff.diffWords(e.innerHTML,n.innerHTML),d=document.createDocumentFragment();o.forEach((e=>{let n="";e.added&&(n="#a6f3a6"),e.removed&&(n="#f8cbcb");const t=document.createElement("span");t.style.backgroundColor=n,t.style.borderRadius=".2rem",t.appendChild(document.createTextNode((e=>{const n=document.createElement("textarea");return n.innerHTML=Joomla.sanitizeHtml(e),n.value})(e.value))),d.appendChild(t)})),t.appendChild(d)},n=()=>{[].slice.call(document.querySelectorAll(".original")).forEach((n=>{e(n,n.nextElementSibling)})),document.removeEventListener("DOMContentLoaded",n)};document.addEventListener("DOMContentLoaded",n)})();

View File

@ -0,0 +1,72 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, Joomla) => {
if (!Joomla || typeof Joomla.Text._ !== 'function') {
throw new Error('core.js was not properly initialised');
}
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('toolbar-load').addEventListener('click', () => {
const toolbarLoad = document.getElementById('toolbar-load');
if (!toolbarLoad.disabled) {
const ids = document.querySelectorAll('input[id*="cb"]:checked');
if (ids.length === 1) {
// Add version item id to URL
const url = `${toolbarLoad.childNodes[1].getAttribute('data-url')}&version_id=${ids[0].value}`;
if (window.parent && url) {
window.parent.location = url;
}
} else {
Joomla.renderMessages({
error: [Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION')]
});
}
}
return false;
});
document.getElementById('toolbar-preview').addEventListener('click', () => {
const toolbarPreview = document.getElementById('toolbar-preview');
if (!toolbarPreview.disabled) {
const windowSizeArray = ['width=800, height=600, resizable=yes, scrollbars=yes'];
const ids = document.querySelectorAll('input[id*="cb"]:checked');
if (ids.length === 1) {
// Add version item id to URL
const url = `${toolbarPreview.childNodes[1].getAttribute('data-url')}&version_id=${ids[0].value}`;
if (window.parent && url) {
window.open(url, '', windowSizeArray.toString());
}
} else {
Joomla.renderMessages({
error: [Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION')]
});
}
}
return false;
});
document.getElementById('toolbar-compare').addEventListener('click', () => {
const toolbarCompare = document.getElementById('toolbar-compare');
if (!toolbarCompare.disabled) {
const windowSizeArray = ['width=1000, height=600, resizable=yes, scrollbars=yes'];
const ids = document.querySelectorAll('input[id*="cb"]:checked');
if (ids.length === 0) {
Joomla.renderMessages({
error: [Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]
});
} else if (ids.length === 2) {
// Add version item ids to URL
const url = `${toolbarCompare.childNodes[1].getAttribute('data-url')}&id1=${ids[0].value}&id2=${ids[1].value}`;
if (window.parent && url) {
window.open(url, '', windowSizeArray.toString());
}
} else {
Joomla.renderMessages({
error: [Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_TWO_VERSIONS')]
});
}
}
return false;
});
});
})(document, Joomla);

View File

@ -0,0 +1 @@
((e,t)=>{if(!t||"function"!=typeof t.Text._)throw new Error("core.js was not properly initialised");e.addEventListener("DOMContentLoaded",(()=>{e.getElementById("toolbar-load").addEventListener("click",(()=>{const r=e.getElementById("toolbar-load");if(!r.disabled){const o=e.querySelectorAll('input[id*="cb"]:checked');if(1===o.length){const e=`${r.childNodes[1].getAttribute("data-url")}&version_id=${o[0].value}`;window.parent&&e&&(window.parent.location=e)}else t.renderMessages({error:[t.Text._("COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION")]})}return!1})),e.getElementById("toolbar-preview").addEventListener("click",(()=>{const r=e.getElementById("toolbar-preview");if(!r.disabled){const o=["width=800, height=600, resizable=yes, scrollbars=yes"],n=e.querySelectorAll('input[id*="cb"]:checked');if(1===n.length){const e=`${r.childNodes[1].getAttribute("data-url")}&version_id=${n[0].value}`;window.parent&&e&&window.open(e,"",o.toString())}else t.renderMessages({error:[t.Text._("COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION")]})}return!1})),e.getElementById("toolbar-compare").addEventListener("click",(()=>{const r=e.getElementById("toolbar-compare");if(!r.disabled){const o=["width=1000, height=600, resizable=yes, scrollbars=yes"],n=e.querySelectorAll('input[id*="cb"]:checked');if(0===n.length)t.renderMessages({error:[t.Text._("JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST")]});else if(2===n.length){const e=`${r.childNodes[1].getAttribute("data-url")}&id1=${n[0].value}&id2=${n[1].value}`;window.parent&&e&&window.open(e,"",o.toString())}else t.renderMessages({error:[t.Text._("COM_CONTENTHISTORY_BUTTON_SELECT_TWO_VERSIONS")]})}return!1}))}))})(document,Joomla);

View File

@ -0,0 +1,46 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_cpanel",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_cpanel.admin-addmodule",
"type": "script",
"uri": "com_cpanel/admin-add_module.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "eed527"
},
{
"name": "com_cpanel.admin-cpanel",
"type": "script",
"uri": "com_cpanel/admin-cpanel-default.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "433d95"
},
{
"name": "com_cpanel.admin-system-loader",
"type": "script",
"uri": "com_cpanel/admin-system-loader.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module",
"defer": true
},
"version": "43ff08"
}
]
}

View File

@ -0,0 +1,70 @@
/**
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(document => {
document.addEventListener('DOMContentLoaded', () => {
window.jSelectModuleType = () => {
const elements = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn.hidden');
if (elements.length) {
setTimeout(() => {
elements.forEach(button => {
button.classList.remove('hidden');
});
}, 1000);
}
};
const buttons = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn');
const hideButtons = [];
let isSaving = false;
if (buttons.length) {
buttons.forEach(button => {
if (button.classList.contains('hidden')) {
hideButtons.push(button);
}
button.addEventListener('click', event => {
let elem = event.currentTarget;
// There is some bug with events in iframe where currentTarget is "null"
// => prevent this here by bubble up
if (!elem) {
elem = event.target;
}
if (elem) {
const clickTarget = elem.dataset.bsTarget;
// We remember to be in the saving process
isSaving = clickTarget === '#saveBtn';
// Reset saving process, if e.g. the validation of the form fails
setTimeout(() => {
isSaving = false;
}, 1500);
const iframe = document.querySelector('#moduleDashboardAddModal iframe');
const content = iframe.contentDocument || iframe.contentWindow.document;
const targetBtn = content.querySelector(clickTarget);
if (targetBtn) {
targetBtn.click();
}
}
});
});
}
const elementH = document.querySelector('#moduleDashboardAddModal');
if (elementH) {
elementH.addEventListener('hide.bs.modal', () => {
hideButtons.forEach(button => {
button.classList.add('hidden');
});
});
elementH.addEventListener('hidden.bs.modal', () => {
if (isSaving) {
setTimeout(() => {
window.parent.location.reload();
}, 1000);
}
});
}
});
})(document);

View File

@ -0,0 +1 @@
(e=>{e.addEventListener("DOMContentLoaded",(()=>{window.jSelectModuleType=()=>{const t=e.querySelectorAll("#moduleDashboardAddModal .modal-footer .btn.hidden");t.length&&setTimeout((()=>{t.forEach((e=>{e.classList.remove("hidden")}))}),1e3)};const t=e.querySelectorAll("#moduleDashboardAddModal .modal-footer .btn"),d=[];let o=!1;t.length&&t.forEach((t=>{t.classList.contains("hidden")&&d.push(t),t.addEventListener("click",(t=>{let d=t.currentTarget;if(d||(d=t.target),d){const t=d.dataset.bsTarget;o="#saveBtn"===t,setTimeout((()=>{o=!1}),1500);const n=e.querySelector("#moduleDashboardAddModal iframe"),a=(n.contentDocument||n.contentWindow.document).querySelector(t);a&&a.click()}}))}));const n=e.querySelector("#moduleDashboardAddModal");n&&(n.addEventListener("hide.bs.modal",(()=>{d.forEach((e=>{e.classList.add("hidden")}))})),n.addEventListener("hidden.bs.modal",(()=>{o&&setTimeout((()=>{window.parent.location.reload()}),1e3)})))}))})(document);

Binary file not shown.

View File

@ -0,0 +1,104 @@
/**
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* Debounce
* https://gist.github.com/nmsdvid/8807205
*
* @param { function } callback The callback function to be executed
* @param { int } time The time to wait before firing the callback
* @param { int } interval The interval
*/
// eslint-disable-next-line no-param-reassign, no-return-assign, default-param-last
const debounce = (callback, time = 250, interval) => (...args) => clearTimeout(interval, interval = setTimeout(callback, time, ...args));
((window, document, Joomla) => {
Joomla.unpublishModule = element => {
// Get variables
const baseUrl = 'index.php?option=com_modules&task=modules.unpublish&format=json';
const id = element.getAttribute('data-module-id');
Joomla.request({
url: `${baseUrl}&cid=${id}`,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
onSuccess: () => {
const wrapper = element.closest('.module-wrapper');
wrapper.parentNode.removeChild(wrapper);
Joomla.renderMessages({
message: [Joomla.Text._('COM_CPANEL_UNPUBLISH_MODULE_SUCCESS')]
});
},
onError: () => {
Joomla.renderMessages({
error: [Joomla.Text._('COM_CPANEL_UNPUBLISH_MODULE_ERROR')]
});
}
});
};
const onBoot = () => {
const cpanelModules = document.getElementById('content');
if (cpanelModules) {
const links = [].slice.call(cpanelModules.querySelectorAll('.unpublish-module'));
links.forEach(link => {
link.addEventListener('click', ({
target
}) => Joomla.unpublishModule(target));
});
}
// Cleanup
document.removeEventListener('DOMContentLoaded', onBoot);
};
// Initialise
document.addEventListener('DOMContentLoaded', onBoot);
// Masonry layout for cpanel cards
const MasonryLayout = {
$gridBox: null,
gridAutoRows: 0,
gridRowGap: 10,
// Calculate "grid-row-end" property
resizeGridItem($cell, rowHeight, rowGap) {
const $content = $cell.querySelector('.card');
if ($content) {
const contentHeight = $content.getBoundingClientRect().height + rowGap;
const rowSpan = Math.ceil(contentHeight / (rowHeight + rowGap));
$cell.style.gridRowEnd = `span ${rowSpan}`;
}
},
// Check a size of every cell in the grid
resizeAllGridItems() {
const $gridCells = [].slice.call(this.$gridBox.children);
$gridCells.forEach($cell => {
this.resizeGridItem($cell, this.gridAutoRows, this.gridRowGap);
});
},
initialise() {
this.$gridBox = document.querySelector('#cpanel-modules .card-columns');
const gridStyle = window.getComputedStyle(this.$gridBox);
this.gridAutoRows = parseInt(gridStyle.getPropertyValue('grid-auto-rows'), 10) || this.gridAutoRows;
this.gridRowGap = parseInt(gridStyle.getPropertyValue('grid-row-gap'), 10) || this.gridRowGap;
this.resizeAllGridItems();
// Recheck the layout after all content (fonts and images) is loaded.
window.addEventListener('load', () => this.resizeAllGridItems());
// Recheck the layout when the menu is toggled
window.addEventListener('joomla:menu-toggle', () => {
// 300ms is animation time, need to wait for the animation to end
setTimeout(() => this.resizeAllGridItems(), 330);
});
// Watch on window resize
window.addEventListener('resize', debounce(() => this.resizeAllGridItems(), 50));
}
};
// Initialise Masonry layout at the very beginning, to avoid jumping.
// We can do this because the script is deferred.
MasonryLayout.initialise();
})(window, document, window.Joomla);

View File

@ -0,0 +1 @@
const debounce=(e,t=250,i)=>(...o)=>clearTimeout(i,i=setTimeout(e,t,...o));((e,t,i)=>{i.unpublishModule=e=>{const t=e.getAttribute("data-module-id");i.request({url:`index.php?option=com_modules&task=modules.unpublish&format=json&cid=${t}`,method:"POST",headers:{"Content-Type":"application/json"},onSuccess:()=>{const t=e.closest(".module-wrapper");t.parentNode.removeChild(t),i.renderMessages({message:[i.Text._("COM_CPANEL_UNPUBLISH_MODULE_SUCCESS")]})},onError:()=>{i.renderMessages({error:[i.Text._("COM_CPANEL_UNPUBLISH_MODULE_ERROR")]})}})};const o=()=>{const e=t.getElementById("content");if(e){[].slice.call(e.querySelectorAll(".unpublish-module")).forEach((e=>{e.addEventListener("click",(({target:e})=>i.unpublishModule(e)))}))}t.removeEventListener("DOMContentLoaded",o)};t.addEventListener("DOMContentLoaded",o);({$gridBox:null,gridAutoRows:0,gridRowGap:10,resizeGridItem(e,t,i){const o=e.querySelector(".card");if(o){const s=o.getBoundingClientRect().height+i,r=Math.ceil(s/(t+i));e.style.gridRowEnd=`span ${r}`}},resizeAllGridItems(){[].slice.call(this.$gridBox.children).forEach((e=>{this.resizeGridItem(e,this.gridAutoRows,this.gridRowGap)}))},initialise(){this.$gridBox=t.querySelector("#cpanel-modules .card-columns");const i=e.getComputedStyle(this.$gridBox);this.gridAutoRows=parseInt(i.getPropertyValue("grid-auto-rows"),10)||this.gridAutoRows,this.gridRowGap=parseInt(i.getPropertyValue("grid-row-gap"),10)||this.gridRowGap,this.resizeAllGridItems(),e.addEventListener("load",(()=>this.resizeAllGridItems())),e.addEventListener("joomla:menu-toggle",(()=>{setTimeout((()=>this.resizeAllGridItems()),330)})),e.addEventListener("resize",debounce((()=>this.resizeAllGridItems()),50))}}).initialise()})(window,document,window.Joomla);

Binary file not shown.

View File

@ -0,0 +1,62 @@
/**
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((document, Joomla) => {
const init = () => {
// Cleanup
window.removeEventListener('load', init);
// Get the elements
const elements = [].slice.call(document.querySelectorAll('.system-counter'));
if (elements.length) {
elements.forEach(element => {
const badgeurl = element.getAttribute('data-url');
if (badgeurl && Joomla && Joomla.request && typeof Joomla.request === 'function') {
Joomla.enqueueRequest({
url: badgeurl,
method: 'POST',
promise: true
}).then(xhr => {
const resp = xhr.responseText;
let response;
try {
response = JSON.parse(resp);
} catch (error) {
throw new Error('Failed to parse JSON');
}
if (response.error || !response.success) {
element.classList.remove('icon-spin');
element.classList.remove('icon-spinner');
element.classList.add('text-danger');
element.classList.add('icon-remove');
} else if (response.data) {
const elem = document.createElement('span');
elem.classList.add('float-end');
elem.classList.add('badge');
elem.classList.add('bg-warning', 'text-dark');
elem.innerHTML = Joomla.sanitizeHtml(response.data);
element.parentNode.replaceChild(elem, element);
} else {
element.classList.remove('icon-spin');
element.classList.remove('icon-spinner');
element.classList.add('icon-check');
element.classList.add('text-success');
}
}).catch(() => {
element.classList.remove('icon-spin');
element.classList.remove('icon-spinner');
element.classList.add('text-danger');
element.classList.add('icon-remove');
});
}
});
}
};
// Give some times to the layout and other scripts to settle their stuff
window.addEventListener('load', () => {
setTimeout(init, 300);
});
})(document, Joomla);

Some files were not shown because too many files have changed in this diff Show More