Files
liceo-ariosto/media/com_fields/js/admin-field-changecontext.js
2025-06-17 11:53:18 +02:00

9 lines
322 B
JavaScript

Joomla.fieldsChangeContext = context => {
const regex = /([?;&])context[^&;]*[;&]?/;
const url = window.location.href;
const query = url.replace(regex, '$1').replace(/&$/, '');
// eslint-disable-next-line
window.location.href = (query.length > 2 ? query + '&' : '?') + (context ? 'context=' + context : '');
};