PageSourceSearch

https://montessoriparatodos.es/blog/wp-content/plugins/presta-products/assets/javascript/ppgbo-custom.js?ver=1

js montessoriparatodos.es collected 2026-10-03 23:15:22 UTC 8,392 bytes, 209 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function(event) {
2	var classname = document.getElementsByClassName("ppgbo_qcd");
3	for (var i = 0; i < classname.length; i++) {
4		//click gauche
5		classname[i].addEventListener('click', ppgboLeftClick, false);
6		//click droit
7		classname[i].addEventListener('contextmenu', ppgboRightClick, false);
8	}
9    var images = document.getElementsByClassName("product_link");
10    for (var i = 0; i < images.length; i++) {
11        images[i].addEventListener('mouseover', ppgboHoverImages, false);
12        images[i].addEventListener('mouseout', ppgboOutImages, false);
13    }
14    
15    var array_carrousel = document.querySelectorAll('.ppgbo_carrousel');
16    for (let j = 0; j < array_carrousel.length; j++) {
17        if (array_carrousel[j]) {
18            const li = array_carrousel[j].querySelectorAll('li');
19            const col_number = array_carrousel[j].getElementsByClassName('carrousel')[0].classList[1].replace('col-', '');
20            var count = {
21                2: 6,
22                3: 4,
23                4: 3,
24                6: 2,
25                12: 1
26            };
27            
28            for (let i = 0; i < li.length; i++) {
29                li[i].style.width = (((array_carrousel[j].offsetWidth - 100) / count[col_number]) - 20) + 'px';
30            }
31            
32            var arrows = document.querySelectorAll('.carrousel-prev');
33            if (arrows.length > 0) {
34                array_carrousel[j].getElementsByClassName('carrousel-prev')[0].addEventListener('click', function(){ppgbo_carousel_previous_link(j)}, false);
35                array_carrousel[j].getElementsByClassName('carrousel-next')[0].addEventListener('click', function(){ppgbo_carousel_next_link(j)}, false);
36            }
37            array_carrousel[j].querySelector('ul').style.marginLeft = 0;
38            
39            var dots = document.querySelectorAll('.dots_navigation');
40            if (dots[j]) {
41                var dots_links = dots[j].getElementsByTagName('a');
42                var class_active = '';
43                var class_inactive = '';
44                
45                for (let i = 0; i < dots_links.length; i++) {
46                    dots_links[i].addEventListener('click', function(){ppgbo_carousel_dots_link(i, j)}, false);
47                }
48            }
49            
50            if (array_carrousel[j].getElementsByClassName('carrousel')[0].classList.length > 1 && array_carrousel[j].getElementsByClassName('carrousel')[0].classList[2] == 'autoplay') {
51                var timer = 5000;
52                if (array_carrousel[j].getElementsByClassName('carrousel')[0].classList.length > 2) {
53                    timer = Math.floor(array_carrousel[j].getElementsByClassName('carrousel')[0].classList[3].replace('autoplay-', ''));
54                }
55                setTimeout(function() {
56                    ppgbo_carousel_next_link_autoplay(j, timer);
57                }, timer);
58            }
59        }
60    }
61});
62//fonction du click gauche
63var ppgboLeftClick = function(event) {
64	var attribute = this.getAttribute("data-qcd");     
65	var tab = this.getAttribute("data-tab");
66	
67    var newWindow = window.open(decodeURIComponent(window.atob(attribute)), tab);    
68	newWindow.focus();                
69};
70//fonction du click droit
71var ppgboRightClick = function(event) {
72    var attribute = this.getAttribute("data-qcd");    
73	var tab = this.getAttribute("data-tab");
74	
75    var newWindow = window.open(decodeURIComponent(window.atob(attribute)), tab);    
76	newWindow.focus();   
77} 
78//fonction de hover de l'image
79var ppgboHoverImages = function(event) {
80    var image = this.parentNode.getElementsByClassName("product_image");
81    var attribute = image[0].getAttribute("data-hover");
82    
83    if (attribute) {
84        image[0].setAttribute('src', attribute);
85    }
86}
87//fonction de out de l'image
88var ppgboOutImages = function(event) {
89    var image = this.parentNode.getElementsByClassName("product_image");
90    var attribute = image[0].getAttribute("data-src");
91    
92    if (attribute) {
93        image[0].setAttribute('src', attribute);
94    }
95}
96
97/* CARROUSEL */
98function ppgbo_carousel_show_another_link(direction, index) {
99    var array_carrousel = document.querySelectorAll('.ppgbo_carrousel');
100    var ul = array_carrousel[index].getElementsByTagName('ul');
101    var current = -parseInt(ul[0].style.marginLeft) / 100;
102    var new_link = current + direction;
103    var links_number = ul[0].children.length;
104    const col_number = array_carrousel[index].getElementsByClassName('carrousel')[0].classList[1].replace('col-', '');
105    var count = {
106        2: 6,
107        3: 4,
108        4: 3,
109        6: 2,
110        12: 1
111    };
112    
113    var dots = document.querySelectorAll('.dots_navigation');
114    if (dots[index]) {
115        var dots_links = dots[index].getElementsByTagName('a');
116        var class_active = '';
117        var class_inactive = '';
118        
119        for (let i = 0; i < dots_links.length; i++) {
120            if (hasClass(dots_links[i], 'dots-active')) {
121                class_active = dots_links[i].getElementsByTagName('img')[0].src;
122            }
123            else if (hasClass(dots_links[i], 'dots')) {
124                class_inactive = dots_links[i].getElementsByTagName('img')[0].src;
125            }
126        }
127    }
128
129    if (new_link >= 0 && new_link < (links_number / count[col_number])) {
130        if (dots[index]) {
131            var dots_links = dots[index].getElementsByTagName('a');
132            
133            for (let i = 0; i < dots_links.length; i++) {
134                dots_links[i].classList.remove('dots-active');
135                dots_links[i].getElementsByTagName('img')[0].src = class_inactive;
136            }
137            
138            dots[index].getElementsByTagName('a')[new_link].classList.add('dots-active');
139            dots[index].getElementsByTagName('a')[new_link].getElementsByTagName('img')[0].src = class_active;
140        }
141        
142        ul[0].style.transition = 'margin-left 2s';
143        ul[0].style.marginLeft = -(new_link * 100) + '%';
144    }
145    else if (new_link >= (links_number / count[col_number])) {
146        if (dots[index]) {
147            var dots_links = dots[index].getElementsByTagName('a');
148            
149            for (let i = 0; i < dots_links.length; i++) {
150                dots_links[i].classList.remove('dots-active');
151                dots_links[i].getElementsByTagName('img')[0].src = class_inactive;
152            }
153            
154            dots[index].getElementsByTagName('a')[0].classList.add('dots-active');
155            dots[index].getElementsByTagName('a')[0].getElementsByTagName('img')[0].src = class_active;
156        }
157        
158        ul[0].style.transition = 'margin-left 2s';
159        ul[0].style.marginLeft = 0;
160    }
161    else if (new_link < 0) {
162        if (dots[index]) {
163            var dots_links = dots[index].getElementsByTagName('a');
164            
165            for (let i = 0; i < dots_links.length; i++) {
166                dots_links[i].classList.remove('dots-active');
167                dots_links[i].getElementsByTagName('img')[0].src = class_inactive;
168            }
169            
170            dots[index].getElementsByTagName('a')[dots_links.length].classList.add('dots-active');
171            dots[index].getElementsByTagName('a')[dots_links.length].getElementsByTagName('img')[0].src = class_active;
172        }
173        
174        ul[0].style.transition = 'margin-left 2s';
175        ul[0].style.marginLeft = -(Math.floor(links_number / count[col_number]) * 100) + '%';
176    }
177}
178
179function hasClass( target, className ) {
180    return new RegExp('(\\s|^)' + className + '(\\s|$)').test(target.className);
181}
182
183function ppgbo_carousel_previous_link(index) {
184	ppgbo_carousel_show_another_link(-1, index);
185	return false;
186}
187
188function ppgbo_carousel_next_link(index) {
189	ppgbo_carousel_show_another_link(1, index);
190	return false;
191}
192
193function ppgbo_carousel_dots_link(position, index) {
194    var array_carrousel = document.querySelectorAll('.ppgbo_carrousel');
195    var ul = array_carrousel[index].getElementsByTagName('ul');
196    var current = -parseInt(ul[0].style.marginLeft) / 100;
197    
198	ppgbo_carousel_show_another_link(position - current, index);
199	return false;
200}
201
202function ppgbo_carousel_next_link_autoplay(index, timer) {
203    ppgbo_carousel_show_another_link(1, index);
204    
205	timeout = setTimeout(function() {
206        ppgbo_carousel_next_link_autoplay(index, timer);
207    }, timer);
208	//return false;
209}

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.