shortcode, so
// top-level `const` declarations collided ("Identifier 'searchField' has
// already been declared") on any page holding more than one shortcode, which
// killed the whole block. The element lookups are also guarded - the search
// field is not always rendered, and unguarded access threw
// "Cannot read properties of null".
( function () {
const searchField = document.querySelector( '.wedocs-shortcode-wrap .wedocs-search-input .search-field' );
const searchSubmit = document.querySelector( '.wedocs-shortcode-wrap .wedocs-search-input .search-submit' );
const activeSelectors = document.querySelectorAll( '.wedocs-shortcode-wrap ul.wedocs-docs-list li.wedocs-docs-single .wedocs-doc-link a' );
const activeListSelectors = document.querySelectorAll( '.wedocs-shortcode-wrap ul.wedocs-doc-sections li a' );
if ( searchSubmit ) {
const submitIcon = searchSubmit.querySelector( 'svg path' );
if ( submitIcon ) {
submitIcon.style.fill = '#2b2b2bff';
}
searchSubmit.style.background = '#29ffa1ff';
}
if ( searchField ) {
searchField.addEventListener( 'focus', () => {
searchField.style.borderColor = '#29ffa1ff';
} );
searchField.addEventListener( 'blur', () => {
searchField.style.borderColor = '#dbdbdb';
} );
}
activeSelectors.forEach( item => {
item.style.color = '#2b2b2bff';
item.style.background = '#29ffa1ff';
} );
activeListSelectors.forEach( item => {
item.addEventListener( 'mouseover', () => {
item.style.color = '#1c9c6eff';
item.style.borderColor = '#1c9c6eff';
} );
item.addEventListener( 'mouseout', () => {
item.style.color = '#333';
item.style.borderColor = 'transparent';
} );
} );
} )();