- md5
- ab1a7dc6605449955304f21b5a93369e
- sha1
- 3486cbaa59cc48727c6ce65443a1a9f35bc86cbf
- sha256
- fbe55da3a1c5543c443ad82c84e323174d6214331d7a6d934e03dfcc8b412549
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
/**
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(document => {
const checkPrivacy = () => {
const variables = Joomla.getOptions('js-privacy-check');
const ajaxUrl = variables.plg_quickicon_privacycheck_ajax_url;
const url = variables.plg_quickicon_privacycheck_url;
const text = variables.plg_quickicon_privacycheck_text;
const quickicon = document.getElementById('plg_quickicon_privacycheck');
const link = quickicon.querySelector('span.j-links-link');
Joomla.request({
url: ajaxUrl,
method: 'GET',
data: '',
perform: true,
onSuccess: response => {
try {
const request = JSON.parse(response);
if (request.data.number_urgent_requests) {
// Quickicon on dashboard shows message
const countBadge = document.createElement('span');
countBadge.classList.add('badge', 'text-dark', 'bg-light');
countBadge.textContent = request.data.number_urgent_requests;
link.textContent = `${text.REQUESTFOUND} `;
link.appendChild(countBadge); // Quickicon becomes red
quickicon.classList.add('danger'); // Span in alert
const countSpan = document.createElement('span');
countSpan.classList.add('label', 'label-important');
countSpan.textContent = `${text.REQUESTFOUND_MESSAGE.replace('%s', request.data.number_urgent_requests)} `; // Button in alert to 'view requests'
const requestButton = document.createElement('button');
requestButton.classList.add('btn', 'btn-primary', 'btn-sm');
requestButton.setAttribute('onclick', `document.location='${url}'`);
requestButton.textContent = text.REQUESTFOUND_BUTTON;
const div = document.createElement('div');
div.classList.add('alert', 'alert-error', 'alert-joomlaupdate');
div.appendChild(countSpan);
div.appendChild(requestButton); // Add elements to container for alert messages
const container = document.querySelector('#system-message-container');
container.insertBefore(div, container.firstChild);
} else {
quickicon.classList.add('success');
link.textContent = text.NOREQUEST;
}
} catch (e) {
quickicon.classList.add('danger');
link.textContent = text.ERROR;
}
},
onError: () => {
quickicon.classList.add('danger');
link.textContent = text.ERROR;
}
});
}; // Give some times to the layout and other scripts to settle their stuff
window.addEventListener('load', () => {
setTimeout(checkPrivacy, 360);
});
})(document);
The same content is in 43 releases, Joomla 4.0.0-rc6 to 4.2.0-beta1. See them all, or every version of this file.