PageSourceSearch

https://enas-kniga.ru/local/components/approof/favorites1/templates/.default/script.js

js enas-kniga.ru collected 2026-10-07 22:35:55 UTC 1,893 bytes, 47 lines download raw bytes

1$(document).ready(function () {
2    /* Favorites */
3    $('.favorite_i').on('click', function (e) {
4
5        var favorID = $(this).attr('data-item');
6        if ($(this).hasClass('active')) {
7            var doAction = 'delete';
8
9            //$('.fav_page').find('.favor[data-item="' + favorID + '"]').parents('.cat_list').remove(); // Моментальное удаление, если мы на странице избранного
10        }
11    else {
12            var doAction = 'add';
13
14        }
15        addFavorite(favorID, doAction);
16    });
17    /* Favorites */
18});
19
20/* Избранное */
21function addFavorite(id, action) {
22    var param = 'id=' + id + "&action=" + action;
23    $.ajax({
24        url: '/bitrix/components/approof/favorites1/ajax.php', // URL отправки запроса
25        type: "GET",
26        dataType: "html",
27        data: param,
28        success: function (response) {
29            var result = $.parseJSON(response);
30            if (result == 1) { // Если всё хорошо, то выполняем действия, которые показывают, что данные отправлены
31                $('.favor[data-item="' + id + '"]').addClass('active');
32                var wishCount = parseInt($('#want .col').html()) + 1;
33                $('#want .col').html(wishCount); // Визуально меняем количество у иконки
34            }
35            if (result == 2) {
36                $('.favor[data-item="' + id + '"]').removeClass('active');
37                var wishCount = parseInt($('#want .col').html()) - 1;
38                $('#want .col').html(wishCount); // Визуально меняем количество у иконки
39            }
40        },
41        error: function (jqXHR, textStatus, errorThrown) {
42            console.log('Error: ' + errorThrown);
43        }
44    });
45}
46
47/* Избранное */

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.