[ 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) 2019 Open Source Matters, Inc. <https://www.joomla.org> 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 (function (document) { 9 var checkPrivacy = function checkPrivacy() { 10 var variables = Joomla.getOptions('js-privacy-check'); 11 var ajaxUrl = variables.plg_quickicon_privacycheck_ajax_url; 12 var url = variables.plg_quickicon_privacycheck_url; 13 var text = variables.plg_quickicon_privacycheck_text; 14 var quickicon = document.getElementById('plg_quickicon_privacycheck'); 15 var link = quickicon.querySelector('span.j-links-link'); 16 /** 17 * DO NOT use fetch() for QuickIcon requests. They must be queued. 18 * 19 * @see https://github.com/joomla/joomla-cms/issues/38001 20 */ 21 22 Joomla.enqueueRequest({ 23 url: ajaxUrl, 24 method: 'GET', 25 promise: true 26 }).then(function (xhr) { 27 var response = xhr.responseText; 28 var request = JSON.parse(response); 29 30 if (request.data.number_urgent_requests) { 31 // Quickicon on dashboard shows message 32 var countBadge = document.createElement('span'); 33 countBadge.classList.add('badge', 'text-dark', 'bg-light'); 34 countBadge.textContent = request.data.number_urgent_requests; 35 link.textContent = text.REQUESTFOUND + " "; 36 link.appendChild(countBadge); // Quickicon becomes red 37 38 quickicon.classList.add('danger'); // Span in alert 39 40 var countSpan = document.createElement('span'); 41 countSpan.classList.add('label', 'label-important'); 42 countSpan.textContent = text.REQUESTFOUND_MESSAGE.replace('%s', request.data.number_urgent_requests) + " "; // Button in alert to 'view requests' 43 44 var requestButton = document.createElement('button'); 45 requestButton.classList.add('btn', 'btn-primary', 'btn-sm'); 46 requestButton.setAttribute('onclick', "document.location='" + url + "'"); 47 requestButton.textContent = text.REQUESTFOUND_BUTTON; 48 var div = document.createElement('div'); 49 div.classList.add('alert', 'alert-error', 'alert-joomlaupdate'); 50 div.appendChild(countSpan); 51 div.appendChild(requestButton); // Add elements to container for alert messages 52 53 var container = document.querySelector('#system-message-container'); 54 container.insertBefore(div, container.firstChild); 55 } else { 56 quickicon.classList.add('success'); 57 link.textContent = text.NOREQUEST; 58 } 59 }).catch(function () { 60 quickicon.classList.add('danger'); 61 link.textContent = text.ERROR; 62 }); 63 }; // Give some times to the layout and other scripts to settle their stuff 64 65 66 window.addEventListener('load', function () { 67 setTimeout(checkPrivacy, 360); 68 }); 69 })(document); 70 71 })();
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 |