PageSourceSearch

https://zdanie.info/js/search/Search.js?v=191115?v=

js zdanie.info collected 2026-10-02 17:51:36 UTC 3,179 bytes, 117 lines download raw bytes

1/*!
2 * @author Semenov Alexander <[email protected]>
3 * @link http://skeeks.com/
4 * @copyright 2010 SkeekS (ÑêèêÑ)
5 * @date 20.07.2015
6 */
7(function(sx, $, _)
8{
9    sx.createNamespace('classes.search', sx);
10
11    /**
12     * Îñíîâíîé îáúåêò óïïðàâëÿþùèé ïîèñêîì è ñïèñêîì îáúåêòîâ, èõ ñîñòîÿíèÿìè.
13     *
14     * available options:
15     * {
16     *      'instance':'list',
17     *      'MapInstance':{
18     *          'sx-tmpl-map': 'sx-tmpl-map' //id êîíòåéíåðà øàáëîíà ñîñòîÿíèÿ êàðòû
19     *          'YandexMap': {
20     *              'id': 'map',
21     *              'ymapsOptions': {
22     *                  'center': [55.76, 37.64],
23                        'zoom': 13,
24                        'controls': ['zoomControl', 'rulerControl', 'fullscreenControl', 'trafficControl', 'typeSelector']
25     *              }
26     *          }
27     *      },
28     *      'ListInstance': {},
29     * }
30     */
31    sx.classes.search.Search = sx.classes.Component.extend({
32
33        _init: function()
34        {
35            this.MapInstance    = new sx.classes.search.MapInstance(this, this.get('MapInstance', {}) );
36            this.ListInstance   = new sx.classes.search.ListInstance(this, this.get('ListInstance', {}));
37
38            this.FiltersForm    = new sx.classes.search.FiltersForm(this, this.get('FiltersForm', {}));
39        },
40
41        /**
42         * @private
43         */
44        _onDomReady: function()
45        {
46            var self = this;
47
48            if (this.get('instance', 'list') == 'map')
49            {
50                this.ListInstance.hide();
51                this.MapInstance.show();
52            } else
53            {
54                this.ListInstance.show();
55            }
56        },
57
58        /**
59         * Ïåðåêëþ÷èòü ñîñòîÿíèå â êàðòó.
60         * @returns {sx.classes.search.Search}
61         */
62        goMap: function()
63        {
64            if (this.get('instance', 'list') == 'map')
65            {
66                return this;
67            }
68
69            this.set('instance', 'map');
70
71            this.MapInstance.show();
72            this.ListInstance.hide();
73
74            return this;
75        },
76
77        /**
78         * Ïåðåêëþ÷èòü ñîñòîÿíèå â ñïèñîê.
79         * @returns {sx.classes.search.Search}
80         */
81        goList: function()
82        {
83            if (this.get('instance', 'list') == 'list')
84            {
85                return this;
86            }
87
88            this.set('instance', 'list');
89
90            this.ListInstance.show();
91            this.MapInstance.hide();
92
93			var filters = getObjectsSearchFormFilters();
94			if ($('#objectsSearchForm').data('isDataChanged')) {
95				window.location.href = '/search/?' + $.param(filters);
96			}
97			
98			
99            return this;
100        },
101
102        /**
103         * @returns {sx.classes.search._Instance}
104         */
105        getActiveInstance: function()
106        {
107            if (this.MapInstance.isActive === true)
108            {
109                return this.MapInstance;
110            } else
111            {
112                return this.ListInstance;
113            }
114        }
115
116    });
117})(sx, sx.$, sx._);

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.