PageSourceSearch

https://malishop.ro/modules/ybc_productimagehover/views/js/productimagehover.js

js malishop.ro collected 2026-10-09 02:46:31 UTC 7,299 bytes, 160 lines download raw bytes

1/*
2* 2007-2017 PrestaShop
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 PrestaShop SA <[email protected]>
21*  @copyright  2007-2017 PrestaShop SA
22*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23*  International Registered Trademark & Property of PrestaShop SA
24*/
25var Ets_ImageHover = {
26    inArray: function (item, items) {
27        var length = items.length;
28        for(var i = 0; i < length; i++) {
29            if(items[i] == item) return true;
30        }
31        return false;
32    },
33    ets_run_v17: function(){
34        if($('article.product-miniature').length >0){
35            var temps = [], ids = '', item = 0;
36            $('article.product-miniature').each(function(){
37                item = parseInt($(this).data('id-product'));
38                if(item > 0 && !Ets_ImageHover.inArray(item, temps))
39                    temps.push(item);
40            });
41            for(var i = 0; i < temps.length; i++)
42                (i != temps.length - 1)? ids += temps[i] + ',' : ids += temps[i];
43            if(ids !=''){
44                $.ajax({
45                    url : baseAjax,
46                    data : 'ids=' + ids,
47                    type : 'get',
48                    dataType: 'json',
49                    success : function(json){
50                        if(json){                            
51                            $.each(json,function(i,image){
52                                if($('.product-miniature[data-id-product="'+i+'"] a.product-thumbnail img').length > 0){
53                                    $('.product-miniature[data-id-product="'+i+'"] a.product-thumbnail img').after(image);
54                                }
55                            });
56                        }
57                    }
58                });
59            }
60        }
61    },
62    ets_run_v16: function(){
63        if($('.ajax_add_to_cart_button').length >0){
64            var temps = [], ids = '', item = 0;
65            $('.ajax_add_to_cart_button').each(function(){
66                item = parseInt($(this).data('id-product'));
67                if(item > 0 && !Ets_ImageHover.inArray(item, temps))
68                    temps.push(item);
69            });
70            for(var i = 0; i < temps.length; i++)
71                (i != temps.length - 1)? ids += temps[i] + ',' : ids += temps[i];
72            if(ids !=''){
73                $.ajax({
74                    url : baseAjax,
75                    data : 'ids=' + ids,
76                    type : 'get',
77                    dataType: 'json',
78                    success : function(json){
79                        if(json){
80                            $.each(json,function(i,image){
81                                /*product list*/
82                                if($('.ajax_add_to_cart_button[data-id-product="'+i+'"]').closest('.ajax_block_product').find('a.product_img_link img').length >0)
83                                    $('.ajax_add_to_cart_button[data-id-product="'+i+'"]').closest('.ajax_block_product').find('a.product_img_link img').after(image);
84                                /*module products category*/
85                                if($('.ajax_add_to_cart_button[data-id-product="'+i+'"]').closest('li.product-box').find('a.product-image img').length >0)
86                                    $('.ajax_add_to_cart_button[data-id-product="'+i+'"]').closest('li.product-box').find('a.product-image img').after(image);
87                            });
88                        }
89                    }
90                });
91            }
92        }
93    },
94    ets_run_v15: function(){
95        if($('.ajax_add_to_cart_button').length >0){
96            var temps = [], ids = '', item = 0;
97            $('.ajax_add_to_cart_button').each(function(){
98                item = parseInt($(this).attr('rel').replace('ajax_id_product_',''));
99                if(item > 0 && !Ets_ImageHover.inArray(item, temps))
100                    temps.push(item);
101            });
102            for(var i = 0; i < temps.length; i++)
103                (i != temps.length - 1)? ids += temps[i] + ',' : ids += temps[i];
104            if(ids !=''){
105                $.ajax({
106                    url : baseAjax,
107                    data : 'ids=' + ids,
108                    type : 'get',
109                    dataType: 'json',
110                    global: false,
111                    success : function(json){
112                        if(json){                        
113                            $.each(json,function(i,image){
114                                /*home product*/
115                                if($('.ajax_add_to_cart_button[rel="ajax_id_product_'+i+'"]').closest('.ajax_block_product').find('a.product_image img').length >0 && !$('.accessories_block').length)
116                                    $('.ajax_add_to_cart_button[rel="ajax_id_product_'+i+'"]').closest('.ajax_block_product').find('a.product_image img').after(image);
117                                 /*product list*/
118                                if($('.ajax_add_to_cart_button[rel="ajax_id_product_'+i+'"]').closest('.ajax_block_product').find('a.product_img_link img').length >0)
119                                    $('.ajax_add_to_cart_button[rel="ajax_id_product_'+i+'"]').closest('.ajax_block_product').find('a.product_img_link img').after(image);
120                            });
121                        }
122                    }
123                });
124            }
125        }
126    }    
127}
128$(document).ready(function(){
129    /*ver 1.7*/
130    if(_PI_VER_17_ >0)
131    {
132        Ets_ImageHover.ets_run_v17();
133        $(document).ajaxStop(function(){
134            if($('a.product-thumbnail img').length < 2*$('a.product-thumbnail').length){
135                Ets_ImageHover.ets_run_v17();
136            }
137        });
138    }
139    
140    /*ver 1.6*/
141    if(_PI_VER_17_ < 1 && _PI_VER_16_ >0)
142    {
143        Ets_ImageHover.ets_run_v16();
144        $(document).ajaxStop(function(){
145            if(($('a.product_img_link img').length < 2*$('a.product_img_link').length) || ($('a.product-image img').length < 2*$('a.product-image').length)){
146                Ets_ImageHover.ets_run_v16();
147            }
148        });
149    }
150    /*ver 1.5*/
151    if(_PI_VER_16_ < 1)
152    {
153        Ets_ImageHover.ets_run_v15();
154        $(document).ajaxStop(function(){
155            if(($('a.product_image img').length < 2*$('a.product_image').length) || ($('a.product_img_link img').length < 2*$('a.product_img_link').length)){
156                Ets_ImageHover.ets_run_v15();
157            }
158        });
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.