[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 (function () { 2 'use strict'; 3 4 /** 5 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 (function () { 9 var fetchUpdate = function fetchUpdate() { 10 if (Joomla.getOptions('js-extensions-update')) { 11 var options = Joomla.getOptions('js-extensions-update'); 12 13 var update = function update(type, text) { 14 var link = document.getElementById('plg_quickicon_extensionupdate'); 15 var linkSpans = [].slice.call(link.querySelectorAll('span.j-links-link')); 16 17 if (link) { 18 link.classList.add(type); 19 } 20 21 if (linkSpans.length) { 22 linkSpans.forEach(function (span) { 23 span.innerHTML = Joomla.sanitizeHtml(text); 24 }); 25 } 26 }; 27 /** 28 * DO NOT use fetch() for QuickIcon requests. They must be queued. 29 * 30 * @see https://github.com/joomla/joomla-cms/issues/38001 31 */ 32 33 34 Joomla.enqueueRequest({ 35 url: options.ajaxUrl, 36 method: 'GET', 37 promise: true 38 }).then(function (xhr) { 39 var response = xhr.responseText; 40 var updateInfoList = JSON.parse(response); 41 42 if (Array.isArray(updateInfoList)) { 43 if (updateInfoList.length === 0) { 44 // No updates 45 update('success', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPTODATE')); 46 } else { 47 update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND').replace('%s', "<span class=\"badge text-dark bg-light\">" + updateInfoList.length + "</span>")); 48 } 49 } else { 50 // An error occurred 51 update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_ERROR')); 52 } 53 }).catch(function () { 54 // An error occurred 55 update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_ERROR')); 56 }); 57 } 58 }; // Give some times to the layout and other scripts to settle their stuff 59 60 61 window.addEventListener('load', function () { 62 setTimeout(fetchUpdate, 330); 63 }); 64 })(); 65 66 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |