| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/valence/media/regularlabs/js/ |
Upload File : |
/**
* @package Regular Labs Library
* @version 25.9.9174
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2025 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
(function() {
'use strict';
document.querySelectorAll('rl-field-simple-category').forEach((simplecategory) => {
const fancy_select = simplecategory.querySelector('joomla-field-fancy-select');
const select = simplecategory.querySelector('select');
const input = simplecategory.querySelector('input.choices__input');
if ( ! fancy_select || ! select || ! input) {
return;
}
const choices = fancy_select.choicesInstance;
// fancy_select.addEventListener('change', () => {
// const new_category = input.value;
// select.add(new Option(new_category, new_category));
// select.value = new_category;
// console.log('----');
// console.log(select.value);
// choices.clearInput();
// });
input.addEventListener('change', (event) => {
choices.clearInput();
});
input.addEventListener('keyup', (event) => {
if (event.keyCode !== 13) {
return;
}
choices.clearInput();
});
const setNewCategory = (() => {
const new_category = input.value;
choices.clearInput();
if ( ! new_category.length) {
return;
}
const new_option = new Option(new_category, new_category);
select.add(new_option);
select.value = new_category;
choices._addChoice(new_option);
choices._triggerChange(new_category);
choices.setChoiceByValue(new_category);
choices.clearInput();
});
});
})();