(function(){ var html = ''; function GetProducts(top) { var productArray = [{"pid":99105003,"name":"Apple MacBook Air 13,3\"/M1/8GB/256GB/macOS (MGN63ZEA)","price":3860.0100,"sprice":"3860,01","url":"https://www.ceneo.pl/99105003#pid=19822&crid=668038&cid=34260","imgurl":"//image.ceneostatic.pl/data/products/99105003/f-apple-macbook-air-13-3-m1-8gb-256gb-macos-mgn63zea.jpg","newpage":false,"format":"160x600","rating":4.78,"drawchance":1,"urltype":0,"position":1},{"pid":106847422,"name":"Apple iMac 24 2021 8GB 256GB Niebieski (MGPK3ZEA)","price":5540.5900,"sprice":"5540,59","url":"https://www.ceneo.pl/106847422#pid=19822&crid=668038&cid=34260","imgurl":"//image.ceneostatic.pl/data/products/106847422/f-apple-imac-24-2021-8gb-256gb-niebieski-mgpk3zea.jpg","newpage":false,"format":"160x600","rating":2.75,"drawchance":1,"urltype":0,"position":2},{"pid":142592845,"name":"HP LaserJet Pro 4002dn (2Z605F)","price":674.5900,"sprice":"674,59","url":"https://www.ceneo.pl/142592845#pid=19822&crid=668038&cid=34260","imgurl":"//image.ceneostatic.pl/data/products/142592845/f-hp-laserjet-pro-4002dn-2z605f.jpg","newpage":false,"format":"160x600","rating":4.0,"drawchance":1,"urltype":0,"position":3},{"pid":25686244,"name":"Brother DCP-1510E","price":549.0000,"sprice":"549,00","url":"https://www.ceneo.pl/25686244#pid=19822&crid=668038&cid=34260","imgurl":"//image.ceneostatic.pl/data/products/25686244/f-brother-dcp-1510e.jpg","newpage":false,"format":"160x600","rating":4.6,"drawchance":1,"urltype":0,"position":4}]; var sum = 4; var result = []; var i = 0, n = 0; for (var n = 0; n < top; n++) { var r = Math.floor(Math.random() * sum); var lsum = 0; for (i = 0; i < productArray.length; i++) { var prod = productArray[i]; lsum += prod.drawchance; if (r < lsum) { sum -= prod.drawchance; result.push(prod); productArray.splice(i, 1); break; } } } return result; } function htmlEncode(value){ var div = document.createElement('div'); var text = document.createTextNode(value); div.appendChild(text); return div.innerHTML; } var products = GetProducts(4); html += '
'; var first = true, i = 0; html += '
'; for (i = 0; i< products.length; i++) { html += '
'; first = false; html += ''; html += '' + products[i].name + ''; html += ''; html += ''; html += products[i].name; html += ''; if(products[i].urltype == 0){ html += ''; html += 'Od ' + products[i].sprice + ' zł'; html += ''; } if(products[i].urltype == 1){ html += ''; html += 'Sprawdź'; } html += '
'; } html += '
'; html += '
'; html += ''; html += '
'; html += '
'; try { var _logo = document.getElementById('ceneoaff-logo'); if (_logo != null) { _logo.parentNode.removeChild(_logo); } } catch(err) {} if($CeneoAP.options.ad_onAfterRender != null) $CeneoAP.options.ad_onAfterRender(); document.getElementById('ceneoaffcontainer668038').innerHTML = html; if (false === true) { var hrefs = document.getElementById('ceneoaffcontainer668038').querySelectorAll(".ceneoaff-items a"); for (i = 0; i < hrefs.length; i++) { var href = hrefs[i]; (function(href) { href.addEventListener('click', function(event) { var pid = href.parentElement.getAttribute('data-pid'); var request = '' + "?productId=" + pid + "&creationId=" + $CeneoAP.options.ad_creation + "&referrerUrl=" + encodeURIComponent(window.location); var img = new Image(); img.src = request; } , false) ; } ) (href); } var percentage = 0; var trackView = false; if (percentage === 100) { trackView = true; } else { var rotatorRandomVal = Math.floor((Math.random()*100) + 1); if (rotatorRandomVal < percentage) { trackView = true; } } if (trackView) { var stamp = parseInt(new Date().getTime()/86400, 10); var img = new Image(); var imgSrc = location.protocol + '' + '&_=' + (new Date).getTime(); img.src = imgSrc.replace(/&/g,'&'); } } })();