load expanded buttons only for contact form

This commit is contained in:
Christophe Robillard 2020-09-17 13:23:34 +02:00
parent 5bd4644c2c
commit 8baaee8810

View file

@ -101,22 +101,24 @@ ButtonExpand.prototype.handleBlur = function () {
/* Initialize Hide/Show Buttons */ /* Initialize Hide/Show Buttons */
window.addEventListener( if (document.querySelector('#contact-form')) {
'load', window.addEventListener(
function () { 'load',
var buttons = document.querySelectorAll( function () {
'button[aria-expanded][aria-controls], button.button-without-hint' var buttons = document.querySelectorAll(
); 'button[aria-expanded][aria-controls], button.button-without-hint'
var expandButtons = []; );
var formInput = document.querySelector('form input#type'); var expandButtons = [];
var formInput = document.querySelector('form input#type');
buttons.forEach((button) => { buttons.forEach((button) => {
var be = new ButtonExpand(button); var be = new ButtonExpand(button);
be.init(); be.init();
expandButtons.push(be); expandButtons.push(be);
}); });
expandButtons.forEach((button) => button.setAllButtons(expandButtons)); expandButtons.forEach((button) => button.setAllButtons(expandButtons));
expandButtons.forEach((button) => button.setFormInput(formInput)); expandButtons.forEach((button) => button.setFormInput(formInput));
}, },
false false
); );
}