PageSourceSearch

https://mi.by/local/templates/mi/js/init_icons.js?17381248071924

js mi.by collected 2026-10-04 02:40:03 UTC 1,924 bytes, 46 lines download raw bytes

1$(document).ready(function () {
2    IconsInitializer.initialize()
3})
4class IconsInitializer {
5    static initialize() {
6        const items = $('#favorites-container').length ? $('.container-recently').find('.card-item') : $('.card-item')
7        let itemIDs = []
8        if (items.length > 0) {
9
10            BX.ajax.runComponentAction('manao:favorite.action', 'get', {
11                mode: 'class',
12            }).then(response => {
13                items.each(function () {
14                    const productID = $(this).data('product-id')
15                    itemIDs.push(productID)
16                    if (Object.hasOwn(response.data, productID)) {
17                        $(this).find('.card-item__to-favorites').addClass('active')
18                    }
19                })
20                BX.ajax.runComponentAction('manao:product.rating', 'getList', {
21                    mode: 'class',
22                    data: {
23                        productIDs: itemIDs
24                    }
25                }).then(function (response) {
26                    const ratingItemIDs = Object.keys(response.data)
27                    if (ratingItemIDs.length > 0) {
28                        ratingItemIDs.forEach(id => {
29                            const sameItems = items.closest(`div[data-product-id="${id}"]`)
30                            sameItems.each(function () {
31                                const starElement = $(this).find('.card-item__reviews .stars .star')
32                                starElement.each(function (index) {
33                                    if(index <= response.data[id].rating - 1) this.classList.add('star-full')
34                                });
35                            })
36                        })
37                    }
38                }, function (response) {
39                    //
40                });
41            }, function (response) {
42                //
43            });
44        }
45    }
46}

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.