PageSourceSearch

https://www.sediarreda.com/content/templates/sa-h/assets/js/modules/saWishCatalog.js

js sediarreda.com collected 2026-10-10 02:13:02 UTC 2,164 bytes, 68 lines download raw bytes

1import saHelper from './saHelper.js';//HELPER CLASS
2/* GESTIONE WISHLIST */
3
4export default class SaWishCatalog {
5	
6	static addToWishlist(){
7		let buttons = document.querySelectorAll('.wishlist-heart');
8		let wishlist_page = document.querySelector('#sa_products__wishlist');
9		//console.log(buttons);
10		buttons.forEach(button => {						
11			button.onclick = () =>{ 	
12				let art_cod = button.dataset.artcod;
13							
14				//DEBUG--> console.log('click per wishlist');
15				
16				fetch('https://www.sediarreda.com/it/mysa/wlistdo', {
17					method: 'POST',
18					body: 'mysa_artcod='+art_cod,
19					headers: {
20						'Content-type': 'application/x-www-form-urlencoded'
21					}
22				}).then(function (response) {
23					if (response.ok) {
24						return response.json();
25					}
26					return Promise.reject(response);
27				}).then(function (data) {
28					//console.log('tutto ok' + data);
29					// aggiungo coloro al cuore
30					//button.classList.toggle('wishlist-heart--active');
31					console.log(data);
32								
33					let svg = document.querySelectorAll('span[data-artcod="'+ art_cod +'"]')//data-artcodwish
34					//necessario un foreache perchè le splide gallery usano i cloni
35					svg.forEach(item => {
36							item.classList.contains('wishShow') ? (item.classList.remove('wishShow'),item.classList.add('wishHide')) :
37																							 (item.classList.add('wishShow'),item.classList.remove('wishHide'))
38					})
39					
40					//svg.classList.contains('wishShow') ? (svg.classList.remove('wishShow'),svg.classList.add('wishHide')) :
41																							// (svg.classList.add('wishShow'),svg.classList.remove('wishHide'))
42								
43				}).catch(function (error) {
44					console.warn('Something went wrong.', error);
45				});
46				
47				//se sono in wishlist page
48				if(wishlist_page){
49					let article = document.querySelector('article[data-artcod="'+ art_cod +'"]').parentNode;
50					console.log(article);
51					article.style.display='none';
52				}
53				
54			}//end arrow function						
55		});//end foreach
56	
57	}
58	
59	
60	/* Inizializza la classe SaWishCatalog */
61	static init(){
62		this.addToWishlist()
63	}
64
65	
66}//end SaFitlers
67
68

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.