PageSourceSearch

https://www.xanax.com/-/media/Base-Themes/SearchTheme/Scripts/component-search-base-model.js

js xanax.com collected 2026-09-24 22:54:43 UTC 1,163 bytes, 39 lines download raw bytes

1/**
2 * include functionality for sorting facet array
3 * @module searchBaseModel
4 * @param  {jQuery} $ Instance of jQuery
5 * @param  {Document} document dom document object
6 * @return {baseModel} list of methods for working with facet array
7*/
8XA.component.search.baseModel = (function ($, document) {
9	/**
10	* @name module:searchBaseModel.baseModel
11	* @constructor
12	* @augments Backbone.Model
13	*/
14	return Backbone.Model.extend(
15		/** @lends module:searchBaseModel.baseModel.prototype **/
16		{
17			/**
18			 * Sort facets by sort order option
19			 * @param {String} sortOrder method of sorting - SortByCount|SortByNames
20			 * @param {Array} facetArray  list of facets that should be sorted
21			 */
22			sortFacetArray: function (sortOrder, facetArray) {
23				switch (sortOrder) {
24					case 'SortByCount': {
25						facetArray.sort(function (a, b) { return b.Count - a.Count });
26						break;
27					}
28					case 'SortByNames':
29					default: {
30						//no need to sort by names as values are sorted that way by default
31						break;
32					}
33				}
34			}
35		});
36
37}(jQuery, document));
38
39XA.register('searchBaseModel', XA.component.search.baseModel);

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.