PageSourceSearch

https://kleibait.co.il/js/wishlist.js?num=9

js kleibait.co.il collected 2026-10-07 07:31:05 UTC 8,416 bytes, 297 lines download raw bytes

1var selected_product_color = "";
2var selected_product_size = "";
3//alert("wishlist.js 2");
4function UpdateWishlistIcon(total_products)
5{
6	//alert($(".wishlist_block .num"));
7	//alert(total_products);
8	//$(".wishlist_block .num").html(total_products);
9	//alert("ok");
10	var url = pre_path + "template/ajax/wishlist_hover.php";
11	url += "?pre_path=" + pre_path;
12	ExecutePageAsync(url,"UpdateWishlistIcon2('#')");
13	
14	ShowPopup("wishlist_ok.php");
15	$('html, body').animate({ scrollTop: 0 }, 500);
16}
17function UpdateWishlistIcon2(content)
18{
19	$(".wishlist_block").html(content);
20	//InitWishlistBlock();
21}
22
23function AddToWishlistFull(product_id, amount_to_add, color, size)
24{
25	selected_product_color = color;
26	selected_product_size = size;
27	AddToWishlist(product_id, amount_to_add);
28}
29function AddToWishlist(product_id, amount_to_add)
30{
31	//alert("AddToWishlist test1");
32	//alert(cookie_name_user);
33	var user_id = YalooGetCookie(cookie_name_user);
34	
35	var product_exists = false;
36	var new_wishlist_info = "";
37	//alert(cookie_name_wishlist);
38	var old_wishlist_info = YalooGetCookie(cookie_name_wishlist);
39	if(old_wishlist_info == undefined) old_wishlist_info = "";
40	if(old_wishlist_info == false) old_wishlist_info = "";
41	//alert("old_wishlist_info: " + old_wishlist_info);
42	var old_wishlist_products = old_wishlist_info.split(",");
43	var total_products = 0;
44	if(old_wishlist_info != "") total_products = old_wishlist_products.length;
45	//alert("before loop");
46	for(var i = 0; i < old_wishlist_products.length; i++)
47	{
48		if(old_wishlist_products[i] == "") continue;
49		var id_amount = old_wishlist_products[i].split(":");
50		var id = id_amount[0];
51		if(isNaN(id)) continue;
52		var amount = parseInt(id_amount[1]);
53		var color = id_amount[2];
54		var size = id_amount[3];
55	
56		if( (id == product_id) && (color == selected_product_color) && (size == selected_product_size) )
57		{
58			amount += parseInt(amount_to_add);
59			product_exists = true;
60		}
61		
62		if(new_wishlist_info != "") new_wishlist_info += ",";
63		new_wishlist_info += id + ":" + amount;
64		new_wishlist_info += ":" + color;
65		new_wishlist_info += ":" + size;
66	}
67	//alert("after loop");
68	if(!product_exists)
69	{
70		if(new_wishlist_info != "") new_wishlist_info += ",";
71		new_wishlist_info += product_id + ":" + amount_to_add;
72		new_wishlist_info += ":" + selected_product_color;
73		new_wishlist_info += ":" + selected_product_size;
74		total_products++;
75	}
76	//alert(new_wishlist_info);
77	//new_wishlist_info = "";
78	
79	YalooSetCookie(cookie_name_wishlist,new_wishlist_info,7);
80	
81	UpdateWishlistIcon(total_products);
82	//alert("ok");
83	//window.open("?page=wishlist&rnd" + Math.random(),"_self");
84	
85	/*
86	if(user_id)
87	{
88		var url = "/template/ajax/update_wishlist.php?user_id=" + user_id;
89		url += "&wishlist=" + new_wishlist_info;
90		ExecutePageAsync(url,"");
91	}
92	*/
93}
94function AddToWishlistFullAlert(product_id, amount_to_add, color, size)
95{
96	selected_product_color = color;
97	selected_product_size = size;
98	AddToWishlistAlert(product_id, amount_to_add);
99}
100function AddToWishlistAlert(product_id, amount_to_add)
101{
102	AddToWishlist(product_id, amount_to_add);
103	alert("מוצר נוסף בהצלחה");
104}
105
106function UpdateWishlist(product_id, new_amount)
107{
108	var user_id = YalooGetCookie(cookie_name_user);
109	
110	var product_exists = false;
111	var new_wishlist_info = "";
112	var old_wishlist_info = YalooGetCookie(cookie_name_wishlist);
113	if(old_wishlist_info == false) old_wishlist_info = "";
114	//alert("old_wishlist_info: " + old_wishlist_info);
115	var old_wishlist_products = old_wishlist_info.split(",");
116	var total_products = 0;
117	if(old_wishlist_info != "") total_products = old_wishlist_products.length;
118	for(var i = 0; i < old_wishlist_products.length; i++)
119	{
120		if(old_wishlist_products[i] == "") continue;
121		var id_amount = old_wishlist_products[i].split(":");
122		var id = id_amount[0];
123		var amount = id_amount[1];
124		var color = id_amount[2];
125		var size = id_amount[3];
126		
127		if( (id == product_id) && (color == selected_product_color) && (size == selected_product_size) )
128		{
129			amount = new_amount;
130			product_exists = true;
131		}
132		
133		if(new_wishlist_info != "") new_wishlist_info += ",";
134		new_wishlist_info += id + ":" + amount;
135		new_wishlist_info += ":" + color;
136		new_wishlist_info += ":" + size;
137	}
138	if(!product_exists)
139	{
140		if(new_wishlist_info != "") new_wishlist_info += ",";
141		new_wishlist_info += product_id + ":" + new_amount;
142		new_wishlist_info += ":" + selected_product_color;
143		new_wishlist_info += ":" + selected_product_size;
144		total_products++;
145	}
146	//alert(new_wishlist_info);
147	//new_wishlist_info = "";
148	
149	YalooSetCookie(cookie_name_wishlist,new_wishlist_info,7);
150	
151	var url = pre_path + "template/ajax/wishlist_hover.php";
152	ExecutePageAsync(url,"UpdateWishlistIcon2('#')");
153	
154	//window.open("?page=wishlist&rnd" + Math.random(),"_self");
155	
156	/*
157	if(user_id)
158	{
159		var url = "/template/ajax/update_wishlist.php?user_id=" + user_id;
160		url += "&wishlist=" + new_wishlist_info;
161		ExecutePageAsync(url,"");
162	}
163	*/
164}
165function UpdateWishlistFull(product_id, new_amount, color, size)
166{
167	selected_product_color = color;
168	selected_product_size = size;
169	UpdateWishlist(product_id, new_amount);
170}
171
172
173function RemoveProductFromWishlist(product_id)
174{
175	var user_id = YalooGetCookie(cookie_name_user);
176	
177	var product_exists = false;
178	var new_wishlist_info = "";
179	var old_wishlist_info = YalooGetCookie(cookie_name_wishlist);
180	if(old_wishlist_info == false) old_wishlist_info = "";
181	//alert("old_wishlist_info: " + old_wishlist_info);
182	var old_wishlist_products = old_wishlist_info.split(",");
183	var total_products = 0;
184	if(old_wishlist_info != "") total_products = old_wishlist_products.length;
185	for(var i = 0; i < old_wishlist_products.length; i++)
186	{
187		if(old_wishlist_products[i] == "") continue;
188		var id_amount = old_wishlist_products[i].split(":");
189		var id = id_amount[0];
190		var amount = id_amount[1];
191		var color = id_amount[2];
192		var size = id_amount[3];
193		
194		if( (id == product_id) && (color == selected_product_color) && (size == selected_product_size) ) continue;
195		
196		if(new_wishlist_info != "") new_wishlist_info += ",";
197		new_wishlist_info += id + ":" + amount;
198		new_wishlist_info += ":" + color;
199		new_wishlist_info += ":" + size;
200	}
201	//alert(new_wishlist_info);
202	//new_wishlist_info = "";
203	
204	YalooSetCookie(cookie_name_wishlist,new_wishlist_info,7);
205	
206	var url = pre_path + "template/ajax/wishlist_hover.php";
207	ExecutePageAsync(url,"UpdateWishlistIcon2('#')");
208	
209	//window.open("?rnd" + Math.random(),"_self");
210	//location.reload();
211	
212	/*
213	if(user_id)
214	{
215		var url = "/template/ajax/update_wishlist.php?user_id=" + user_id;
216		url += "&wishlist=" + new_wishlist_info;
217		ExecutePageAsync(url,"");
218	}
219	*/
220	
221}
222function RemoveProductFromWishlistFull(product_id, color, size)
223{
224	selected_product_color = color;
225	selected_product_size = size;
226	RemoveProductFromWishlist(product_id);
227}
228
229var wishlist_error_none_selected = "";
230function AddToCartFromWishlist()
231{
232	var index_list = "";
233	
234	$(".wishlist_block .cart_hover .product_line input[type=checkbox]").each(function(index, element)
235	{
236		if(element.checked)
237		{
238			if(index_list != "") index_list += ",";
239			index_list += element.value;
240		}
241	});
242	
243	//PrintLogView("index_list: " + index_list);
244	if(index_list == "")
245	{
246		alert(wishlist_error_none_selected);
247		return;
248	}
249	
250	var selected_indexed = index_list.split(",");
251	
252	cart_silent_mode = true;
253	
254	var old_wishlist_info = YalooGetCookie(cookie_name_wishlist);
255	if(old_wishlist_info == undefined) old_wishlist_info = "";
256	if(old_wishlist_info == false) old_wishlist_info = "";
257	var old_wishlist_products = old_wishlist_info.split(",");
258	var total_products = 0;
259	if(old_wishlist_info != "") total_products = old_wishlist_products.length;
260	//alert("before loop");
261	for(var i = 0; i < old_wishlist_products.length; i++)
262	{
263		if(old_wishlist_products[i] == "") continue;
264		var id_amount = old_wishlist_products[i].split(":");
265		var id = id_amount[0];
266		if(isNaN(id)) continue;
267		var amount = parseInt(id_amount[1]);
268		var color = id_amount[2];
269		var size = id_amount[3];
270		
271		var checkbox_index = i + 1;
272		checkbox_index = "" + checkbox_index;
273		//PrintLogView("checkbox_index=" + checkbox_index);
274		//PrintLogView("found: " + selected_indexed.indexOf(checkbox_index));
275		if(selected_indexed.indexOf(checkbox_index) < 0) continue;
276	
277		AddToCartFull(id, 1, color, size);
278		RemoveProductFromWishlistFull(id, color, size);
279	}
280	
281	cart_silent_mode = false;
282	
283	UpdateCartIcon(0);
284	
285}
286
287
288
289
290
291
292
293
294
295
296
297

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.