1/** 2 * 3 * Function to update quantity of product in popout cart or popout quote 4 * @param sign 5 * @param quantityId 6 * @param quantityStep 7 */ 8function quantityUpdate(sign, quantityId, quantityStep) 9{ 10 quantityId = quantityId.toString(); 11 quantityStep = parseInt(quantityStep); 12 13 if (isNaN(quantityStep)) 14 { 15 quantityStep = 1; 16 } 17 18 var oldQuantity = parseInt(jQuery('#' + quantityId).val()); 19 20 if (sign == '+') 21 { 22 newQuantity = oldQuantity + quantityStep; 23 } 24 else if (sign == '-') 25 { 26 var newQuantity = oldQuantity - quantityStep; 27 } 28 29 if (newQuantity <= 0) 30 { 31 newQuantity = 0; 32 } 33 34 jQuery('#' + quantityId).val(newQuantity); 35} 36 37// Function to add a product to the cart 38function addToCart(productId, quantity, site, lang, popout, cartUrl, message) 39{ 40 var date = new Date(); 41 quantity = typeof(quantity) != 'undefined' ? quantity : 1; 42 lang = typeof(lang) != 'undefined' ? lang : ''; 43 if (typeof(jQuery('#quantity_' + productId)) != 'undefined') 44 quantity = jQuery('#quantity_' + productId).val(); 45 jQuery.ajax({ 46 url: site + 'index.php?option=com_eshop&task=cart.add' + lang, 47 type: 'POST', 48 data: 'id=' + productId + '&quantity=' + quantity, 49 dataType: 'json', 50 beforeSend: function() { 51 jQuery('#add-to-cart-' + productId).attr('disabled', true); 52 jQuery('#add-to-cart-' + productId).after('<span class="wait-' + productId + '"> <img src="' + site + 'components/com_eshop/assets/images/loading.gif" alt="" /></span>'); 53 }, 54 success: function(json) { 55 if (json['redirect']) 56 { 57 jQuery('#add-to-cart-' + productId).attr('disabled', false); 58 jQuery('.wait-' + productId).remove(); 59 window.location.href = json['redirect']; 60 } 61 if (json['success']) 62 { 63 if (popout == 'message' && typeof(message) !== 'undefined') 64 { 65 jQuery.ajax({ 66 url: site + 'index.php?option=com_eshop&view=cart&layout=mini&format=raw' + lang + '&pt=' + date.getTime(), 67 dataType: 'html', 68 success: function(html) { 69 jQuery('#add-to-cart-' + productId).attr('disabled', false); 70 jQuery('.wait-' + productId).remove(); 71 jQuery('#eshop-cart').html(html); 72 jQuery('.eshop-content').hide(); 73 jQuery('.alert-success').remove(); 74 jQuery('#add-to-cart-' + productId).before('<div class="alert-success">' + message + '</div>'); 75 }, 76 error: function(xhr, ajaxOptions, thrownError) { 77 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 78 } 79 }); 80 } 81 else if (popout == 'redirect') 82 { 83 window.location.href = cartUrl; 84 } 85 else 86 { 87 jQuery.ajax({ 88 url: site + 'index.php?option=com_eshop&view=cart&layout=popout&format=raw' + lang + '&pt=' + date.getTime(), 89 dataType: 'html', 90 success: function(html) { 91 jQuery('#add-to-cart-' + productId).attr('disabled', false); 92 jQuery('.wait-' + productId).remove(); 93 jQuery.colorbox({ 94 overlayClose: true, 95 opacity: 0.5, 96 width: '90%', 97 maxWidth: '800px', 98 href: false, 99 html: html 100 }); 101 jQuery.ajax({ 102 url: site + 'index.php?option=com_eshop&view=cart&layout=mini&format=raw' + lang + '&pt=' + date.getTime(), 103 dataType: 'html', 104 success: function(html) { 105 jQuery('#eshop-cart').html(html); 106 jQuery('.eshop-content').hide(); 107 }, 108 error: function(xhr, ajaxOptions, thrownError) { 109 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 110 } 111 }); 112 }, 113 error: function(xhr, ajaxOptions, thrownError) { 114 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 115 } 116 }); 117 } 118 } 119 }, 120 error: function(xhr, ajaxOptions, thrownError) { 121 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 122 } 123 }); 124} 125 126function multipleProductsAddToCart(site, lang, popout, cartUrl) 127{ 128 var products = jQuery("input[name='product_id[]']"); 129 var date = new Date(); 130 131 if (products.length > 0) 132 { 133 var productIds = ''; 134 var productQuantities = ''; 135 for (var i = 0; i < products.length; i++) 136 {
137 if (parseInt(jQuery('#quantity_' + products[i].value).val()) > 0) 138 { 139 productIds += products[i].value; 140 productQuantities += jQuery('#quantity_' + products[i].value).val(); 141 } 142 if (i < products.length - 1) 143 { 144 productIds += ','; 145 productQuantities += ','; 146 } 147 } 148 jQuery.ajax({ 149 url: site + 'index.php?option=com_eshop&task=cart.addMultipleProducts' + lang, 150 type: 'POST', 151 data: 'product_ids=' + productIds + '&product_quantities=' + productQuantities, 152 dataType: 'json', 153 beforeSend: function() { 154 jQuery('#multiple-products-add-to-cart').attr('disabled', true); 155 jQuery('#multiple-products-add-to-cart').after('<span class="wait-multiple-products-add"> <img src="' + site + 'components/com_eshop/assets/images/loading.gif" alt="" /></span>'); 156 }, 157 success: function(json) { 158 if (json['redirect']) 159 { 160 jQuery('#add-to-cart-' + productId).attr('disabled', false); 161 jQuery('.wait-' + productId).remove(); 162 window.location.href = json['redirect']; 163 } 164 if (json['success']) 165 { 166 if (popout == 'popout') 167 { 168 jQuery.ajax({ 169 url: site + 'index.php?option=com_eshop&view=cart&layout=popout&format=raw' + lang + '&pt=' + date.getTime(), 170 dataType: 'html', 171 success: function(html) { 172 jQuery('#multiple-products-add-to-cart').attr('disabled', false); 173 jQuery('.wait-multiple-products-add').remove(); 174 jQuery.colorbox({ 175 overlayClose: true, 176 opacity: 0.5, 177 width: '90%', 178 maxWidth: '800px', 179 href: false, 180 html: html 181 });
182 jQuery.ajax({ 183 url: site + 'index.php?option=com_eshop&view=cart&layout=mini&format=raw' + lang + '&pt=' + date.getTime(), 184 dataType: 'html', 185 success: function(html) { 186 jQuery('#eshop-cart').html(html); 187 jQuery('.eshop-content').hide(); 188 }, 189 error: function(xhr, ajaxOptions, thrownError) { 190 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 191 } 192 }); 193 }, 194 error: function(xhr, ajaxOptions, thrownError) { 195 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 196 } 197 }); 198 } 199 else if (cartUrl != '') 200 { 201 window.location.href = cartUrl; 202 } 203 } 204 }, 205 error: function(xhr, ajaxOptions, thrownError) { 206 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 207 } 208 }); 209 } 210 else 211 { 212 alert('there is no products to add to cart'); 213 } 214} 215 216//Function to add a product to the quote 217function addToQuote(productId, quantity, site, lang) 218{ 219 var date = new Date(); 220 quantity = typeof(quantity) != 'undefined' ? quantity : 1; 221 lang = typeof(lang) != 'undefined' ? lang : ''; 222 if (typeof(jQuery('#quantity_' + productId)) != 'undefined') 223 quantity = jQuery('#quantity_' + productId).val(); 224 jQuery.ajax({ 225 url: site + 'index.php?option=com_eshop&task=quote.add' + lang, 226 type: 'POST', 227 data: 'id=' + productId + '&quantity=' + quantity, 228 dataType: 'json', 229 beforeSend: function() { 230 jQuery('#add-to-quote-' + productId).attr('disabled', true); 231 jQuery('#add-to-quote-' + productId).after('<span class="wait-' + productId + '"> <img src="' + site + 'components/com_eshop/assets/images/loading.gif" alt="" /></span>'); 232 }, 233 success: function(json) { 234 if (json['redirect']) 235 { 236 jQuery('#add-to-quote-' + productId).attr('disabled', false); 237 jQuery('.wait-' + productId).remove(); 238 window.location.href = json['redirect']; 239 } 240 if (json['success']) 241 { 242 jQuery.ajax({ 243 url: site + 'index.php?option=com_eshop&view=quote&layout=popout&format=raw' + lang + '&pt=' + date.getTime(), 244 dataType: 'html', 245 success: function(html) { 246 jQuery('#add-to-quote-' + productId).attr('disabled', false); 247 jQuery('.wait-' + productId).remove(); 248 jQuery.colorbox({ 249 overlayClose: true, 250 opacity: 0.5, 251 width: '90%', 252 maxWidth: '800px', 253 href: false, 254 html: html 255 }); 256 jQuery.ajax({ 257 url: site + 'index.php?option=com_eshop&view=quote&layout=mini&format=raw' + lang + '&pt=' + date.getTime(), 258 dataType: 'html', 259 success: function(html) { 260 jQuery('#eshop-quote').html(html); 261 jQuery('.eshop-content').hide(); 262 }, 263 error: function(xhr, ajaxOptions, thrownError) { 264 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 265 } 266 }); 267 }, 268 error: function(xhr, ajaxOptions, thrownError) { 269 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 270 } 271 }); 272 } 273 } 274 }); 275} 276 277//Function to show make Notify about product popout 278function makeNotify(productId, site, lang) 279{ 280 lang = typeof(lang) != 'undefined' ? lang : ''; 281 jQuery.ajax({ 282 url: site + 'index.php?option=com_eshop&view=product&layout=notify&format=raw' + lang, 283 type: 'POST', 284 data: 'id=' + productId, 285 dataType: 'html', 286 success: function(html) { 287 jQuery.colorbox({ 288 overlayClose: true, 289 opacity: 0.5, 290 width: '90%', 291 maxWidth: '800px', 292 href: false, 293 html: html 294 }); 295 } 296 }); 297} 298 299// Function to add a product to the wish list 300function addToWishList(productId, site, lang) 301{ 302 lang = typeof(lang) != 'undefined' ? lang : ''; 303 jQuery.ajax({ 304 url: site + 'index.php?option=com_eshop&task=wishlist.add' + lang, 305 type: 'post', 306 data: 'product_id=' + productId, 307 dataType: 'json', 308 success: function(json) { 309 if (json['success']) { 310 jQuery.colorbox({ 311 overlayClose: true, 312 opacity: 0.5, 313 width: '90%', 314 maxWidth: '800px', 315 href: false, 316 html: json['success']['message'] 317 }); 318 } 319 } 320 }); 321} 322 323//Function to remove a product from the wish list 324function removeFromWishlist(productId, site, lang) 325{ 326 lang = typeof(lang) != 'undefined' ? lang : ''; 327 jQuery.ajax({ 328 url: site + 'index.php?option=com_eshop&task=wishlist.remove' + lang, 329 type: 'post', 330 data: 'product_id=' + productId, 331 dataType: 'json', 332 success: function(json) { 333 window.location.href = json['redirect']; 334 } 335 }); 336} 337 338// Function to add product to compare 339function addToCompare(productId, site, lang) 340{ 341 lang = typeof(lang) != 'undefined' ? lang : ''; 342 jQuery.ajax({ 343 url: site + 'index.php?option=com_eshop&task=compare.add' + lang, 344 type: 'post', 345 data: 'product_id=' + productId, 346 dataType: 'json', 347 success: function(json) { 348 if (json['success']) { 349 jQuery.colorbox({ 350 overlayClose: true, 351 opacity: 0.5, 352 width: '90%', 353 maxWidth: '800px', 354 href: false, 355 html: json['success']['message'] 356 }); 357 } 358 } 359 }); 360} 361 362//Function to remove a product from compare 363function removeFromCompare(productId, site, lang) 364{ 365 lang = typeof(lang) != 'undefined' ? lang : ''; 366 jQuery.ajax({ 367 url: site + 'index.php?option=com_eshop&task=compare.remove' + lang, 368 type: 'post', 369 data: 'product_id=' + productId, 370 dataType: 'json', 371 success: function(json) { 372 window.location.href = json['redirect']; 373 } 374 }); 375} 376 377//Function to show ask question about product popout 378function askQuestion(productId, site, lang) 379{ 380 lang = typeof(lang) != 'undefined' ? lang : ''; 381 jQuery.ajax({ 382 url: site + 'index.php?option=com_eshop&view=product&layout=askquestion&format=raw' + lang, 383 type: 'POST', 384 data: 'id=' + productId, 385 dataType: 'html', 386 success: function(html) { 387 jQuery.colorbox({ 388 overlayClose: true, 389 opacity: 0.5, 390 width: '90%', 391 maxWidth: '800px', 392 href: false, 393 html: html 394 }); 395 } 396 }); 397} 398 399//Function to show email a friend about product popout 400function emailAFriend(productId, site, lang) 401{ 402 lang = typeof(lang) != 'undefined' ? lang : ''; 403 jQuery.ajax({ 404 url: site + 'index.php?option=com_eshop&view=product&layout=emailafriend&format=raw' + lang, 405 type: 'POST', 406 data: 'id=' + productId, 407 dataType: 'html', 408 success: function(html) { 409 jQuery.colorbox({ 410 overlayClose: true, 411 opacity: 0.5, 412 width: '90%', 413 maxWidth: '800px', 414 href: false, 415 html: html 416 }); 417 } 418 }); 419} 420 421if("undefined"===typeof Eshop) { 422 var Eshop={}; 423} 424 425Eshop.updateStateList = function(countryId, stateInputId) { 426 // First of all, we need to empty the state dropdown 427 var list = document.getElementById(stateInputId); 428 // empty the list 429 for (i = 1; i < list.options.length; i++) {
430 list.options[i] = null; 431 } 432 list.length = 1; 433 var stateNames = stateList[countryId]; 434 if (stateNames) { 435 var arrStates = stateNames.split(','); 436 i = 0; 437 var state = ''; 438 var stateName = ''; 439 for ( var j = 0; j < arrStates.length; j++) { 440 state = arrStates[j]; 441 stateName = state.split(':'); 442 opt = new Option(); 443 opt.value = stateName[0]; 444 opt.text = stateName[1]; 445 list.options[i++] = opt; 446 } 447 list.length = i; 448 } 449} 450 451EShopInitReCaptcha2 = function() 452{ 453 var item = document.getElementById('dynamic_recaptcha_1'), 454 option_keys = ['sitekey', 'theme', 'size', 'tabindex', 'callback', 'expired-callback', 'error-callback'], 455 options = {}, 456 option_key_fq 457 ; 458 459 if (item.dataset) { 460 options = item.dataset; 461 } else { 462 for (var j = 0; j < option_keys.length; j++) { 463 option_key_fq = ('data-' + option_keys[j]); 464 if (item.hasAttribute(option_key_fq)) { 465 options[option_keys[j]] = item.getAttribute(option_key_fq); 466 } 467 } 468 } 469 470 // Set the widget id of the recaptcha item 471 item.setAttribute( 472 'data-recaptcha-widget-id', 473 grecaptcha.render(item, options) 474 ); 475}; 476 477EShopInitReCaptchaInvisible = function() 478{ 479 var item = document.getElementById('dynamic_recaptcha_1'), 480 option_keys = ['sitekey', 'badge', 'size', 'tabindex', 'callback', 'expired-callback', 'error-callback'], 481 options = {}, 482 option_key_fq 483 ; 484 485 if (item.dataset) { 486 options = item.dataset; 487 } else { 488 for (var j = 0; j < option_keys.length; j++) { 489 option_key_fq = ('data-' + option_keys[j]); 490 if (item.hasAttribute(option_key_fq)) { 491 options[option_keys[j]] = item.getAttribute(option_key_fq); 492 } 493 } 494 } 495 // Set the widget id of the recaptcha item 496 item.setAttribute( 497 'data-recaptcha-widget-id', 498 grecaptcha.render(item, options) 499 ); 500 // Execute the invisible reCAPTCHA 501 grecaptcha.execute(item.getAttribute('data-recaptcha-widget-id')); 502};
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.