1(function(){ 2 3 var countdowns = []; 4 var basetime = 0; 5 6 function updateAuctionCountdowns() 7 { 8 if (countdowns.length > 0) 9 { 10 // calculate offset 11 var now = new Date(); 12 var offset = Math.round((now - basetime) / 1000); 13 14 // loop countdowns 15 for (var i=0; i < countdowns.length; ++i) 16 { 17 var e = countdowns[i]; 18 var s = e.sec - offset; 19 if (s > 0) 20 e.element.text(formatCountdown(s)); 21 else 22 { 23 e.element.remove(); // remove from html/dom 24 countdowns.splice(i, 1); // remove from the array 25 } 26 } 27 // output countdown values 28 29 setTimeout(function(){updateAuctionCountdowns();}, 1000); 30 } 31 } 32 33 function formatCountdown(s) 34 { 35 var d = parseInt(s / 86400); // full days 36 s = s - (d * 86400); 37 var h = parseInt(s / 3600); // full hours 38 s = s - (h * 3600); 39 var m = parseInt(s / 60); // full minutes 40 s = s - (m * 60); 41 // seconds remain in s 42 43 return ((d > 0) ? (d + ' day' + (d > 1 ? 's' : '') + ', ') : "") + out2D(h) + ":" + out2D(m) + ":" + out2D(s); 44 } 45 46 $(function() 47 { 48 $(".auctionslisting .countdown").each(function(){ 49 var e = $(this); 50 countdowns.push({element:e, sec:e.attr("data-sec")}); 51 }); 52 53 basetime = new Date(); // current time 54 55 setTimeout(function(){updateAuctionCountdowns();}, 1000); 56 }); 57 58 // ----------------- 59 // update auctions listing per instant-approval eligibility 60 61 $(function () { 62 63 var elesAuctionRowsWithInstantApprove = $(".auctionslisting li [data-instantapprove]"); 64 // Note that instant-approve attributes will only be added if user is signed-in. 65 // No need to bother continuing if no instant-approve auctions, or user not signed in. 66 if (!elesAuctionRowsWithInstantApprove || !elesAuctionRowsWithInstantApprove.length) { 67 return; 68 } 69 70 lag.GetUserPreferences().then(function () { 71 72 elesAuctionRowsWithInstantApprove.each(function () { 73 var e = $(this); 74 var auctioneerID = e.attr('data-auctioneer'), instantApproveType = e.attr('data-instantapprove'); 75 76 lag.CheckInstantApproveEligible(auctioneerID, instantApproveType).then(function (eligible) { 77 if (eligible) { 78 e.text("You're Approved"); 79 e.attr("title", "You are pre-approved for this auction."); 80 e.parent().addClass('bidding_approved'); 81 e.removeAttr('href'); 82 } 83 }); 84 }); 85 86 }); 87 88 }); 89 90})();
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.