PageSourceSearch

https://shop.virya.com/modules/an_wishlist/views/js/front.js

js virya.com collected 2026-10-05 04:13:38 UTC 2,507 bytes, 87 lines download raw bytes

1/**
2* 2019 Anvanto
3*
4* NOTICE OF LICENSE
5*
6* This source file is subject to the Academic Free License (AFL 3.0)
7* that is bundled with this package in the file LICENSE.txt.
8* It is also available through the world-wide-web at this URL:
9* http://opensource.org/licenses/afl-3.0.php
10* If you did not receive a copy of the license and are unable to
11* obtain it through the world-wide-web, please send an email
12* to [email protected] so we can send you a copy immediately.
13*
14* DISCLAIMER
15*
16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17* versions in the future. If you wish to customize PrestaShop for your
18* needs please refer to http://www.prestashop.com for more information.
19*
20*  @author Anvanto ([email protected])
21*  @copyright  2019 anvanto.com
22
23*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
24*  International Registered Trademark & Property of PrestaShop SA
25*/
26(function ($, window, undefined) {
27    'use strict';
28    
29    $(document).on('click', '.js-an_wishlist-addremove', function () {
30        
31        var self = this;
32
33        toggleData($(self).data('url'), function (data) {
34            toggleStatus(self, data);
35            removeProduct(self, data);
36            changeCount(self, data);
37            showModalAuth(data);
38        });
39        
40    });
41    
42    function changeCount(self, data)
43    {
44        $('.js-an_wishlist-nav-count').html(data.count);
45        $(self).closest('.js-an_wishlist-container').find('.js-an_wishlist-product-count').html(data.countWishlists);
46    }
47    
48    function toggleStatus(self, data)
49    {
50        if (data.status) {
51            $(self).addClass('an_wishlist-in');
52        } else {
53            $(self).removeClass('an_wishlist-in');
54        }
55    }
56    
57    function removeProduct(self, data)
58    {
59        if ($('body').attr('id') == 'cart' || $('body').attr('id') == 'module-an_wishlist-list') {
60            $(self).closest('.js-product-miniature').remove();
61        }
62    }
63    
64    function showModalAuth(data)
65    {
66        if (data.modal) {
67            $.magnificPopup.open({
68                items: {
69                    src: data.modal,
70                    type: 'inline'
71                }
72            });
73        }
74    }
75    
76    function toggleData(url, callback)
77    {
78        $.ajax({
79            type: "POST",
80            url: url,
81            dataType: 'json',
82        }).done(function (data) {
83            callback(data);
84        });
85    }
86
87})(jQuery, window);

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.