Usage
.nebula-search
Parameters
This function does not accept any parameters. Is this incorrect?
Additional Notes
Here is where to add the class to the menu item. If this is not available, check the “Screen Options” dropdown at the very top of the screen to enable it.
Source File
Located in /assets/js/modules/search.js on line 85.
No Hooks
This function does not have any filters or actions available. Request one?nebula.menuSearchReplacement = async function(){ if ( jQuery('.nebula-search').length ){ jQuery('.menu .nebula-search').each(async function(){ await nebula.yield(); let randomMenuSearchID = Math.floor((Math.random()*100)+1); //Why does it need this again? Add comment please. jQuery(this).html('<form class="wp-menu-nebula-search nebula-search search footer-search" method="get" action="' + nebula.site.home_url + '/"><div class="nebula-input-group"><i class="fa-solid fa-magnifying-glass"></i><label class="visually-hidden" for="nebula-menu-search-' + randomMenuSearchID + '">Search</label><input type="search" id="nebula-menu-search-' + randomMenuSearchID + '" class="nebula-search input search" name="s" placeholder="Search" autocomplete="off" x-webkit-speech /></div></form>'); }); jQuery('.nebula-search input').on('focus', function(){ jQuery(this).addClass('focus active'); }); jQuery('.nebula-search input').on('blur', function(){ if ( jQuery(this).val() === '' || jQuery(this).val().trim().length === 0 ){ jQuery(this).removeClass('focus active focusError').attr('placeholder', jQuery(this).attr('placeholder')); } else { jQuery(this).removeClass('active'); } }); } };
Override
To override or disable this JavaScript function, simply redeclare it with the exact same function name. Remember: Some functionality is conditionally loaded via dynamic imports, so if your function is not overriding properly, try listening for a DOM event (described below).
For non-module import functions:
nebula.menuSearchReplacement = function(){ //Write your own code here, leave it blank, or return false. }
For dynamically imported module function overrides:
jQuery(window).on('load', function(){ nebula.menuSearchReplacement = function(){ //Write your own code here, leave it blank, or return false. } });
Custom Nebula DOM events do also exist, so you could also try the following if the Window Load listener does not work:
jQuery(document).on('nebula_module_loaded', function(module){ //Note that the module variable is also available to know which module specifically was imported if ( typeof nebula.menuSearchReplacement === 'function' ){ nebula.menuSearchReplacement = function(){ //Write your own code here, leave it blank, or return false. } } });