- md5
- 05ce03c5a36f600b3b912df270f2c7f4
- sha1
- 3ce34b049952b6c1961ac9e54b669a4b344f8b1f
- sha256
- 0b2aa275b73afdef7e494d0c995e33b10820b6784e9f3e25656954be02b0df9f
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(() => {
const fetchUpdate = () => {
if (Joomla.getOptions('js-extensions-update')) {
const options = Joomla.getOptions('js-extensions-update');
const update = (type, text) => {
const link = document.getElementById('plg_quickicon_extensionupdate');
const linkSpans = [].slice.call(link.querySelectorAll('span.j-links-link'));
if (link) {
link.classList.add(type);
}
if (linkSpans.length) {
linkSpans.forEach(span => {
span.innerHTML = Joomla.sanitizeHtml(text);
});
}
};
/**
* DO NOT use fetch() for QuickIcon requests. They must be queued.
*
* @see https://github.com/joomla/joomla-cms/issues/38001
*/
Joomla.request({
url: options.ajaxUrl,
method: 'GET',
data: '',
perform: true,
queued: true,
onSuccess: response => {
const updateInfoList = JSON.parse(response);
if (Array.isArray(updateInfoList)) {
if (updateInfoList.length === 0) {
// No updates
update('success', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPTODATE'));
} else {
update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND').replace('%s', `<span class="badge text-dark bg-light">${updateInfoList.length}</span>`));
}
} else {
// An error occurred
update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_ERROR'));
}
},
onError: () => {
// An error occurred
update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_ERROR'));
}
});
}
}; // Give some times to the layout and other scripts to settle their stuff
window.addEventListener('load', () => {
setTimeout(fetchUpdate, 330);
});
})();
The same content is in 2 releases, Joomla 4.2.0-beta2 to 4.2.0-beta3. See them all, or every version of this file.