[ 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 checkOverride = function checkOverride() { 10 if (Joomla.getOptions('js-override-check')) { 11 var options = Joomla.getOptions('js-override-check'); 12 13 var update = function update(type, text, linkHref) { 14 var link = document.getElementById('plg_quickicon_overridecheck'); 15 var linkSpans = link.querySelectorAll('span.j-links-link'); 16 17 if (link) { 18 link.classList.add(type); 19 20 if (linkHref) { 21 link.setAttribute('href', linkHref); 22 } 23 } 24 25 if (linkSpans.length) { 26 linkSpans.forEach(function (span) { 27 span.innerHTML = Joomla.sanitizeHtml(text); 28 }); 29 } 30 }; 31 /** 32 * DO NOT use fetch() for QuickIcon requests. They must be queued. 33 * 34 * @see https://github.com/joomla/joomla-cms/issues/38001 35 */ 36 37 38 Joomla.enqueueRequest({ 39 url: options.ajaxUrl, 40 method: 'GET', 41 promise: true 42 }).then(function (xhr) { 43 var response = xhr.responseText; 44 var updateInfoList = JSON.parse(response); 45 46 if (updateInfoList.installerOverride !== 'disabled') { 47 if (Array.isArray(updateInfoList)) { 48 if (updateInfoList.length === 0) { 49 // No overrides found 50 update('success', Joomla.Text._('PLG_QUICKICON_OVERRIDECHECK_UPTODATE'), ''); 51 } else { 52 // Scroll to page top 53 window.scrollTo(0, 0); 54 update('danger', Joomla.Text._('PLG_QUICKICON_OVERRIDECHECK_OVERRIDEFOUND').replace('%s', "<span class=\"badge text-dark bg-light\">" + updateInfoList.length + "</span>"), ''); 55 } 56 } else { 57 throw new Error('Override check: unexpected value type'); 58 } 59 } else { 60 update('danger', Joomla.Text._('PLG_QUICKICON_OVERRIDECHECK_ERROR_ENABLE'), "index.php?option=com_plugins&task=plugin.edit&extension_id=" + options.pluginId); 61 } 62 }).catch(function () { 63 // An error occurred 64 update('danger', Joomla.Text._('PLG_QUICKICON_OVERRIDECHECK_ERROR'), ''); 65 }); 66 } 67 }; // Give some times to the layout and other scripts to settle their stuff 68 69 70 window.addEventListener('load', function () { 71 setTimeout(checkOverride, 390); 72 }); 73 })(); 74 75 })();
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 |