- md5
- f0cf9484197b4cf405eb34f36d1c4133
- sha1
- 91a52a7052d817ec6e1cf5f1bb045cb0d970f375
- sha256
- 3c3a72ca66279b8bd3bef72138db199c6c4bb5e4004b1146a16221774b7e5f3d
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
/**
* @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);
});
}
};
Joomla.request({
url: options.ajaxUrl,
method: 'GET',
data: '',
perform: 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 43 releases, Joomla 4.0.0-rc6 to 4.2.0-beta1. See them all, or every version of this file.