1/** 2 * Copyright since 2007 PrestaShop SA and Contributors 3 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 * 5 * NOTICE OF LICENSE 6 * 7 * This source file is subject to the Academic Free License 3.0 (AFL-3.0) 8 * that is bundled with this package in the file LICENSE.md. 9 * It is also available through the world-wide-web at this URL: 10 * https://opensource.org/licenses/AFL-3.0 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to [email protected] so we can send you a copy immediately. 14 * 15 * DISCLAIMER 16 * 17 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 18 * versions in the future. If you wish to customize PrestaShop for your 19 * needs please refer to https://devdocs.prestashop.com/ for more information. 20 * 21 * @author PrestaShop SA and Contributors <[email protected]> 22 * @copyright Since 2007 PrestaShop SA and Contributors 23 * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) 24 */ 25var $productNotificationClass = $('.product-notification'); 26var duration = $productNotificationClass.data('time') || 0; 27var cookieTime = $productNotificationClass.data('cookie') || 0; 28 29if (duration == 0 || duration == '') { 30 duration = 7000; 31} else{ 32 duration = duration+3000; 33} 34 35if (cookieTime == 0 || cookieTime == '') { 36 cookieTime = 12; 37} 38 39$(document).ready(function() { 40 SomeonePurchased(); 41}); 42 43function createNotifCookie(cookiename, cookievalue, exdays) { 44 const d = new Date(); 45 d.setTime(d.getTime() + (exdays*60*60*1000)); 46 let expires = "expires="+ d.toUTCString(); 47 document.cookie = cookiename + "=" + cookievalue + ";" + expires + ";path=/"; 48} 49 50function getNotifCookie(cookiename) { 51 let name = cookiename + "="; 52 let decodedCookie = decodeURIComponent(document.cookie); 53 let ca = decodedCookie.split(';'); 54 for(let i = 0; i <ca.length; i++) { 55 let c = ca[i]; 56 while (c.charAt(0) == ' ') { 57 c = c.substring(1); 58 } 59 if (c.indexOf(name) == 0) { 60 return c.substring(name.length, c.length); 61 } 62 } 63 return ""; 64} 65 66function SomeonePurchased() 67{ 68 if (getNotifCookie("cookieNotificat") == 'closed') { 69 $productNotificationClass.remove(); 70 } 71 72 $('.notify-close').on('click',function() { 73 $productNotificationClass.remove(); 74 createNotifCookie("cookieNotificat",'closed', cookieTime); 75 }); 76 77 function toggleNotification() { 78 79 var arrayProducts = $('.data-product'), 80 randomProduct = Math.floor(Math.random() * arrayProducts.length), 81 Object = $(arrayProducts[randomProduct]); 82 83 $productNotificationClass.find('.product-image').attr('href', Object.data('url')).find('img').attr('src', Object.data('image')); 84 $productNotificationClass.find('.product-name').text(Object.data('title')).attr('href', Object.data('url')); 85 $productNotificationClass.find('.time-ago').text(Object.data('time')); 86 $productNotificationClass.find('.customer-detail').text(Object.data('detail')); 87 88 $productNotificationClass.addClass('active'); 89 90 if ($productNotificationClass.hasClass('active')) { 91 setTimeout(function(){ 92 $productNotificationClass.removeClass('active'); 93 }, 3000); 94 } 95 } 96 97 if (duration !== 0) { 98 setInterval(toggleNotification, duration); 99 } 100}
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.