From 1120ab276c2818ba4b5fd9ec4ae3ace1029d1ee1 Mon Sep 17 00:00:00 2001 From: Amire80 Date: Thu, 15 Mar 2018 17:05:01 +0200 Subject: [PATCH] Update the argument for noResults in lcd Follow up to #306. --- src/jquery.uls.lcd.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/jquery.uls.lcd.js b/src/jquery.uls.lcd.js index 2a737b5..b2ff461 100644 --- a/src/jquery.uls.lcd.js +++ b/src/jquery.uls.lcd.js @@ -382,9 +382,9 @@ /** * No-results event handler * @param {Event} event - * @param {string} [currentSearchQuery] Current search query that gave mp results + * @param {Object} data Information about the failed search query */ - noResults: function ( event, currentSearchQuery ) { + noResults: function ( event, data ) { var $noResults; this.$element.addClass( 'uls-no-results' ); @@ -393,7 +393,7 @@ if ( typeof this.options.noResultsTemplate === 'function' ) { $noResults = - this.options.noResultsTemplate.call( this, currentSearchQuery ); + this.options.noResultsTemplate.call( this, data.query ); } else if ( this.options.noResultsTemplate instanceof jQuery ) { $noResults = this.options.noResultsTemplate; } else { @@ -448,7 +448,8 @@ quickList: [], // Callback function for language selection clickhandler: undefined, - // Callback function when no search results + // Callback function when no search results. + // If overloaded, it can accept the search string as an argument. noResultsTemplate: function () { var $suggestionsContainer, $suggestions, $noResultsTemplate = $( noResultsTemplate );