PageSourceSearch

http://www.helleas.com/modules/blockwishlist/js/ajax-wishlist.js

js helleas.com collected 2026-09-27 05:30:43 UTC 7,089 bytes, 254 lines download raw bytes

1/*
2* 2007-2011 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-2011 PrestaShop SA
22*  @version  Release: $Revision: 6594 $
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
27/**
28 * Update WishList Cart by adding, deleting, updating objects
29 *
30 * @return void
31 */
32function WishlistCart(id, action, id_product, id_product_attribute, quantity)
33{
34	$.ajax({
35		type: 'GET',
36		url:	baseDir + 'modules/blockwishlist/cart.php',
37		async: true,
38		cache: false,
39		data: 'action=' + action + '&id_product=' + id_product + '&quantity=' + quantity + '&token=' + static_token + '&id_product_attribute=' + id_product_attribute,
40		success: function(data)
41		{
42			if (action == 'add')
43			{
44				var $element = $('#bigpic');
45				if (!$element.length)
46					var $element = $('#wishlist_button');
47				var $picture = $element.clone();
48				var pictureOffsetOriginal = $element.offset();
49				$picture.css({'position': 'absolute', 'top': pictureOffsetOriginal.top, 'left': pictureOffsetOriginal.left});
50				var pictureOffset = $picture.offset();
51				var wishlistBlockOffset = $('#wishlist_block').offset();
52
53				$picture.appendTo('body');
54				$picture.css({ 'position': 'absolute', 'top': $picture.css('top'), 'left': $picture.css('left') })
55				.animate({ 'width': $element.attr('width')*0.66, 'height': $element.attr('height')*0.66, 'opacity': 0.2, 'top': wishlistBlockOffset.top + 30, 'left': wishlistBlockOffset.left + 15 }, 1000)
56				.fadeOut(800);
57			}
58			
59			if($('#' + id).length != 0)
60			{
61				$('#' + id).slideUp('normal');
62				document.getElementById(id).innerHTML = data;
63				$('#' + id).slideDown('normal');
64			}
65		}
66	});
67}
68
69/**
70 * Change customer default wishlist
71 *
72 * @return void
73 */
74function WishlistChangeDefault(id, id_wishlist)
75{
76	$.ajax({
77		type: 'GET',
78		url:	baseDir + 'modules/blockwishlist/cart.php',
79		async: true,
80		data: 'id_wishlist=' + id_wishlist + '&token=' + static_token,
81		cache: false,
82		success: function(data)
83		{
84			$('#' + id).slideUp('normal');
85			document.getElementById(id).innerHTML = data;
86			$('#' + id).slideDown('normal');
87		}
88	});
89}
90
91/**
92 * Buy Product
93 *
94 * @return void
95 */
96function WishlistBuyProduct(token, id_product, id_product_attribute, id_quantity, button, ajax)
97{
98	if(ajax)
99		ajaxCart.add(id_product, id_product_attribute, false, button, 1, [token, id_quantity]);
100	else
101	{
102		$('#' + id_quantity).val(0);
103		WishlistAddProductCart(token, id_product, id_product_attribute, id_quantity)
104		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].method='POST';
105		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].action=baseDir + 'cart.php';
106		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].elements['token'].value = static_token;
107		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].submit();
108	}
109	return (true);
110}
111
112function WishlistAddProductCart(token, id_product, id_product_attribute, id_quantity)
113{
114	if ($('#' + id_quantity).val() <= 0)
115		return (false);
116	$.ajax({
117		type: 'GET',
118		url: baseDir + 'modules/blockwishlist/buywishlistproduct.php',
119		data: 'token=' + token + '&static_token=' + static_token + '&id_product=' + id_product  + '&id_product_attribute=' + id_product_attribute,
120		async: true,
121		cache: false, 
122		success: function(data)
123		{
124			if (data)
125				alert(data);
126			else
127			{
128				$('#' + id_quantity).val($('#' + id_quantity).val() - 1);
129			}
130		}
131	});
132	return (true);
133}
134
135/**
136 * Show wishlist managment page
137 *
138 * @return void
139 */
140function WishlistManage(id, id_wishlist)
141{
142	$.ajax({
143		type: 'GET',
144		async: true,
145		url: baseDir + 'modules/blockwishlist/managewishlist.php',
146		data: 'id_wishlist=' + id_wishlist + '&refresh=' + false,
147		cache: false,
148		success: function(data)
149		{
150			$('#' + id).hide();
151			document.getElementById(id).innerHTML = data;
152			$('#' + id).fadeIn('slow');
153		}
154	});
155}
156
157/**
158 * Show wishlist product managment page
159 *
160 * @return void
161 */
162function WishlistProductManage(id, action, id_wishlist, id_product, id_product_attribute, quantity, priority)
163{
164	$.ajax({
165		type: 'GET',
166		async: true,
167		url: baseDir + 'modules/blockwishlist/managewishlist.php',
168		data: 'action=' + action + '&id_wishlist=' + id_wishlist + '&id_product=' + id_product + '&id_product_attribute=' + id_product_attribute + '&quantity=' + quantity + '&priority=' + priority + '&refresh=' + true,
169		cache: false,
170		success: function(data)
171		{
172			if (action == 'delete')
173				$('#wlp_' + id_product + '_' + id_product_attribute).fadeOut('fast');
174			else if (action == 'update')
175			{
176				$('#wlp_' + id_product + '_' + id_product_attribute).fadeOut('fast');
177				$('#wlp_' + id_product + '_' + id_product_attribute).fadeIn('fast');
178			}
179		}
180	});
181}
182
183/**
184 * Delete wishlist
185 *
186 * @return boolean succeed
187 */
188function WishlistDelete(id, id_wishlist, msg)
189{
190	var res = confirm(msg);
191	if (res == false)
192		return (false);
193	$.ajax({
194		type: 'GET',
195		async: true,
196		url: baseDir + 'modules/blockwishlist/mywishlist.php',
197		cache: false,
198		data: 'deleted&id_wishlist=' + id_wishlist,
199		success: function(data)
200		{
201			$('#' + id).fadeOut('slow');
202		}
203	});
204}
205
206/**
207 * Hide/Show bought product
208 *
209 * @return void
210 */
211function WishlistVisibility(bought_class, id_button)
212{
213	if ($('#hide' + id_button).css('display') == 'none')
214	{
215		$('.' + bought_class).slideDown('fast');
216		$('#show' + id_button).hide();
217		$('#hide' + id_button).fadeIn('fast');
218	}
219	else
220	{
221		$('.' + bought_class).slideUp('fast');
222		$('#hide' + id_button).hide();
223		$('#show' + id_button).fadeIn('fast');
224	}
225}
226
227/**
228 * Send wishlist by email
229 *
230 * @return void
231 */
232function WishlistSend(id, id_wishlist, id_email)
233{
234	$.post(baseDir + 'modules/blockwishlist/sendwishlist.php',
235	{ token: static_token,
236	  id_wishlist: id_wishlist,
237	  email1: $('#' + id_email + '1').val(),
238	  email2: $('#' + id_email + '2').val(),
239	  email3: $('#' + id_email + '3').val(),
240	  email4: $('#' + id_email + '4').val(),
241	  email5: $('#' + id_email + '5').val(),
242	  email6: $('#' + id_email + '6').val(),
243	  email7: $('#' + id_email + '7').val(),
244	  email8: $('#' + id_email + '8').val(),
245	  email9: $('#' + id_email + '9').val(),
246	  email10: $('#' + id_email + '10').val() },
247	function(data)
248	{
249		if (data)
250			alert(data);
251		else
252			WishlistVisibility(id, 'hideSendWishlist');
253	});
254}

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.