[ 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 onChange = function onChange(_ref) { 10 var target = _ref.target; 11 var self = target; 12 var value = parseInt(self.value, 10); 13 self.classList.remove('form-select-success', 'form-select-danger'); 14 15 if (value === 1) { 16 self.classList.add('form-select-success'); 17 } else if (value === 0 || value === -2) { 18 self.classList.add('form-select-danger'); 19 } 20 }; 21 22 var updateSelectboxColour = function updateSelectboxColour() { 23 var colourSelects = [].slice.call(document.querySelectorAll('.form-select-color-state')); 24 colourSelects.forEach(function (colourSelect) { 25 var value = parseInt(colourSelect.value, 10); // Add class on page load 26 27 if (value === 1) { 28 colourSelect.classList.add('form-select-success'); 29 } else if (value === 0 || value === -2) { 30 colourSelect.classList.add('form-select-danger'); 31 } // Add class when value is changed 32 33 34 colourSelect.addEventListener('change', onChange); 35 }); // Cleanup 36 37 document.removeEventListener('DOMContentLoaded', updateSelectboxColour, true); 38 }; // On document loaded 39 40 41 document.addEventListener('DOMContentLoaded', updateSelectboxColour, true); // On Joomla updated 42 43 document.addEventListener('joomla:updated', updateSelectboxColour, true); 44 })(); 45 46 })();
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 |