From 0795c8e0ae89642a3cda4f9f52db55dd19f26c31 Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Fri, 1 Nov 2024 16:41:13 +0500 Subject: [PATCH 01/70] Rewrite window.search.Query as an ES6 class And moving the initialization from init to the constructor. --- core/code/search.js | 411 ++++++++++++++++++++++---------------------- 1 file changed, 205 insertions(+), 206 deletions(-) diff --git a/core/code/search.js b/core/code/search.js index 275351531..3975cfeb0 100644 --- a/core/code/search.js +++ b/core/code/search.js @@ -36,245 +36,244 @@ window.search = { * @memberof window.search * @class * @name window.search.Query - * @param {string} term - The search term. - * @param {boolean} confirmed - Indicates if the search is confirmed (e.g., by pressing Enter). - */ -window.search.Query = function (term, confirmed) { - this.term = term; - this.confirmed = confirmed; - this.init(); -}; - -/** - * Initializes the search query, setting up the DOM elements and triggering the 'search' hook. - * - * @function */ -window.search.Query.prototype.init = function () { - this.results = []; - - this.container = $('
').addClass('searchquery'); - - this.header = $('

') - .text( - this.confirmed - ? this.term - : (this.term.length > 16 ? this.term.substr(0, 8) + '…' + this.term.substr(this.term.length - 8, 8) : this.term) + ' (Return to load more)' - ) - .appendTo(this.container); - - this.list = $('