[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 3 * @license GNU General Public License version 2 or later; see LICENSE.txt 4 */ 5 (() => { 6 7 const onChange = ({ 8 target 9 }) => { 10 const self = target; 11 const value = parseInt(self.value, 10); 12 self.classList.remove('form-select-success', 'form-select-danger'); 13 14 if (value === 1) { 15 self.classList.add('form-select-success'); 16 } else if (value === 0 || value === -2) { 17 self.classList.add('form-select-danger'); 18 } 19 }; 20 21 const updateSelectboxColour = () => { 22 const colourSelects = [].slice.call(document.querySelectorAll('.form-select-color-state')); 23 colourSelects.forEach(colourSelect => { 24 const value = parseInt(colourSelect.value, 10); // Add class on page load 25 26 if (value === 1) { 27 colourSelect.classList.add('form-select-success'); 28 } else if (value === 0 || value === -2) { 29 colourSelect.classList.add('form-select-danger'); 30 } // Add class when value is changed 31 32 33 colourSelect.addEventListener('change', onChange); 34 }); // Cleanup 35 36 document.removeEventListener('DOMContentLoaded', updateSelectboxColour, true); 37 }; // On document loaded 38 39 40 document.addEventListener('DOMContentLoaded', updateSelectboxColour, true); // On Joomla updated 41 42 document.addEventListener('joomla:updated', updateSelectboxColour, true); 43 })();
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 |