PageSourceSearch

https://hobbygames.by/assets/js/checkout/app/pages/catalog.js?bust=b

js hobbygames.by collected 2026-09-26 02:59:52 UTC 6,174 bytes, 160 lines download raw bytes

1define(['jquery', 'modules/lists', 'modules/search.left', 'modules/select.stock', 'vex'],
2    (function ($, lists, LeftSearch, SelectStock, vex) {
3        var view = $('.product-content'),
4            container = view.find('.product-container'),
5            select_sort = $('.sort-view select.sortBy'),
6            $selectStockModule;
7
8        select_sort.on('change', function (e, trigger) {
9            if (trigger !== false) {
10                var sel = $(e.target), val = sel.val(), split = val.split(' '),
11                    sort = split[0], order = split.length > 1 ? split[1] : null;
12                view.lists('changeState', {sort: sort, order: order}, true);
13            }
14        });
15
16        $('.switch-btns').on('click', 'a', function (e) {
17            var btn = $(this),
18                display = btn.hasClass('view__line')
19                    ? 'line'
20                    : 'grid',
21                active = btn.hasClass('view__selected');
22            if (active) return false;
23            $('.switch-btns a').toggleClass('view__selected');
24            view.lists('changeDisplay', display);
25        });
26
27        view.lists({
28            state: window.searchState,
29            url: window.config.url.productsFeed,
30            mode: 'replace',
31            spinnerTemplate: '',
32            moreButtonTemplate: null,
33            stateLine: true,
34            saveState: true,
35            afterLoad: function (state, answer, prototype) {
36                var results = state.results,
37                    display = state.getDisplay();
38                state = state.state;
39
40                // sort
41                var sort = 'sort' in state
42                    ? state.sort.trim().toLowerCase()
43                    : 'rating',
44                    order = 'order' in state
45                        ? ' ' + state.order.trim().toUpperCase()
46                        : 'ASC',
47                    sort_val = sort + order;
48
49                select_sort.val(sort_val).trigger('change', false);
50
51                //display
52                var is_grid = display === 'grid';
53                container.toggleClass('product-list', !is_grid);
54
55                $('.switch-btns a')
56                    .removeClass('view__selected')
57                    .filter('.view__' + display).addClass('view__selected');
58
59                // Balloons total
60                var $balloon = $('.balloon__content'),
61                    $balloon_mobile = $('.category-left__result__product');
62                $balloon.find('span').text(results.total);
63                $balloon_mobile.find('span').text(results.total);
64
65                var title_text = "result_text" in answer ?
66                    answer["result_text"] :
67                    _s.sprintf(window.Application.nls.localize('@label-part-products'), results.total);
68                $(".catalog-info-count").html(title_text);
69            }
70        });
71
72        window.onpopstate = function (e) {
73            if (e.state) {
74                console.log('STATE: ', e.state);
75                view.lists('changeState', e.state, false);
76            }
77        };
78
79        var $leftSearch = new LeftSearch(view);
80
81        var $leftWrap = $('.category-left'),
82            $leftCategory = $('#catalog-category-menu-block'),
83            $leftFilter = $('#catalog-filter-menu-block'),
84            $showLeftFilterBtn = $('#js-showFilter'),
85            $showLeftCategoryBtn = $('#js-showCategory'),
86            toggleLeftFilter = function (e) {
87                e.preventDefault();
88                $('body').toggleClass('is-filter');
89                $leftWrap.toggleClass('is-visible');
90                $leftCategory.hide();
91                $leftFilter.show();
92            },
93            closeLeftFilter = function (e) {
94                e.preventDefault();
95                $('body').removeClass('is-filter');
96                $leftWrap.removeClass('is-visible');
97                $leftCategory.hide();
98                $leftFilter.show();
99            },
100            toggleLeftCategory = function (e) {
101                e.preventDefault();
102                $('body').toggleClass('is-filter');
103                $leftWrap.toggleClass('is-visible');
104                $leftCategory.show();
105                $leftFilter.hide();
106            };
107
108        $showLeftFilterBtn.click(toggleLeftFilter);
109        $showLeftCategoryBtn.click(toggleLeftCategory);
110
111        $leftWrap.find('.category-left__result__close').click(function (e) {
112            closeLeftFilter(e);
113        });
114        $leftWrap.find('.category-left__result2__close').click(function (e) {
115            toggleLeftCategory(e);
116        });
117        $leftWrap.find('.do-search').click(function (e) {
118            if ($leftSearch.isMobile()) {
119                $leftSearch.updateAllFilters();
120            }
121        });
122        $(document).keyup(function (e) {
123            if ($leftFilter.hasClass('is-visible') && e.keyCode === 27) {
124                toggleLeftFilter(e);
125            }
126        });
127
128        $('.select-store').click(function (e) {
129            e.preventDefault();
130            var dialog = vex.dialog.open({
131                buttons: false,
132                contentClassName: 'store-selection-popup',
133                showCloseButton: true,
134                closeClassName: 'vex-close',
135                callback: function () {
136                    if (window.stocks_list_changed) {
137                        $leftSearch.onDialogClose();
138                    }
139                },
140            });
141
142            var content = $('#js-storeSelectionModalTemplate').html();
143            $(dialog.contentEl).find(".vex-dialog-form").replaceWith(content);
144            window.stocks_list_changed = false;
145            console.group('!! new SelectStock');
146            $selectStockModule = new SelectStock();
147
148            $(dialog.contentEl).find("#store-selection").tabs({
149                active: 0
150            });
151        });
152        $(document).on('click', '.mobile-subcategories-head', function () {
153            if ($(this).attr('href')) {
154                return;
155            }
156
157            $(this).toggleClass('active-subcategories wrapper');
158            $(".filter-button").toggleClass('active-wrapper');
159        });
160    }));

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.