PageSourceSearch

https://www.honda.com.au/-/media/base-themes/searchtheme/scripts/component-search-parameters.js

js honda.com.au collected 2026-10-02 08:00:47 UTC 2,009 bytes, 65 lines download raw bytes

1/**
2 * Provides api for manipulating with hashes
3 * @module searchParameters
4 * @param  {jQuery} $ Instance of jQuery
5 * @param  {Document} document dom document object
6 * @return {Object} list of methods for work with hash
7*/
8XA.component.search.parameters = (function ($, document) {
9    /**
10    * This object stores all public api methods
11    * @type {Object.<Methods>}
12    * @memberOf module:searchParameters
13    */
14    var api = {},
15        queryModel,
16        searchResultModels,
17        initialized = false,
18        defaults = {};
19    /**
20    * Registers modules that search parameter module needs
21    * @memberOf module:searchParameters
22    * @alias module:searchParameters.init
23    */
24
25    api.init = function () {
26        if ($("body").hasClass("on-page-editor") || initialized) {
27            return;
28        }
29
30        queryModel = XA.component.search.query;
31        searchResultModels = XA.component.search.results.searchResultModels;
32        initialized = true;
33    };
34    /**
35    * Fills default variable with hashes and their values
36    * @param {Object} hash Hash represented as an object
37    * @memberOf module:searchParameters
38    * @alias module:searchParameters.registerDefault
39    */
40    api.registerDefault = function (hash) {
41        _.each(hash, function (item, key) {
42            defaults[key] = hash[key].toString();
43        });
44    };
45    /**
46    * Updates hash with new one provided as an parameter
47    * @param {Object} newHash Hash represented as an object
48    * @memberOf module:searchParameters
49    * @alias module:searchParameters.updateHash
50    */
51    api.updateHash = function (newHash) {
52        _.each(newHash, function (item, key) {
53            if (defaults[key] === newHash[key].toString()) {
54                newHash[key] = "";
55            }
56        });
57
58        queryModel.updateHash(newHash);
59    }
60
61    return api;
62
63}(jQuery, document));
64
65XA.register('searchParameters', XA.component.search.parameters);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.