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 version 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 * @author PrestaShop SA and Contributors <[email protected]> 16 * @copyright Since 2007 PrestaShop SA and Contributors 17 * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 18 */ 19 20function getTimeRemaining (endtime) { 21 var t = Date.parse(endtime) - Date.parse(new Date()); 22 var seconds = Math.floor((t / 1000) % 60); 23 var minutes = Math.floor((t / 1000 / 60) % 60); 24 var hours = Math.floor((t / (1000 * 60 * 60)) % 24); 25 var days = Math.floor(t / (1000 * 60 * 60 * 24)); 26 return { 27 'total': t, 28 'days': days, 29 'hours': hours, 30 'minutes': minutes, 31 'seconds': seconds 32 }; 33} 34 35function initializeClock (id, endtime) { 36 var clock = document.getElementById(id); 37 if(clock != null) { 38 var daysSpan = clock.querySelector('.days'); 39 var hoursSpan = clock.querySelector('.hours'); 40 var minutesSpan = clock.querySelector('.minutes'); 41 var secondsSpan = clock.querySelector('.seconds'); 42 } 43 44 function updateClock () { 45 var t = getTimeRemaining(endtime); 46 47 if(t.days < 0 || t.hours < 0 || t.minutes < 0 || t.seconds < 0) { 48 $('#ps_topbanner_wrapper').hide(); 49 return false; 50 } 51 if(clock != null) { 52 daysSpan.innerHTML = t.days; 53 hoursSpan.innerHTML = ('0' + t.hours).slice(-2); 54 minutesSpan.innerHTML = ('0' + t.minutes).slice(-2); 55 secondsSpan.innerHTML = ('0' + t.seconds).slice(-2); 56 57 if(t.days < 1) { 58 $('.days_part').hide(); 59 } else if(t.days === 1) { 60 $('.days_part.singular').show(); 61 $('.days_part.plural').hide(); 62 } else { 63 $('.days_part.singular').hide(); 64 $('.days_part.plural').show(); 65 } 66 67 if(t.total <= 0) { 68 clearInterval(timeinterval); 69 } 70 } 71 } 72 73 updateClock(); 74 var timeinterval = setInterval(updateClock, 1000); 75}
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.