1function handleResponse(advert, data) { 2 if (advert.type === "empty" || advert.type === "error") { 3 console.log("Nevydala se žádná reklama!"); 4 sssp.served(advert.tracking.served); 5 return; 6 } 7 renderAd(advert, data.id); 8} 9 10function renderAd(advert, divId) { 11 const el = document.getElementById(divId); 12 if (el) { 13 if (el.firstChild) { 14 return; 15 } 16 if (advert.iframe == 1) { 17 var mobileQuery = window.matchMedia("(max-width: 479px)"); 18 var wrapperStyle = "display: flex;justify-content: center;margin-bottom: 16px;"; 19 20 if (mobileQuery.matches) { 21 if (window.innerWidth < advert.width) { 22 let ratio = (window.innerWidth - 15) / advert.width; 23 wrapperStyle = wrapperStyle + "width: 480px;height: 480px;transform-origin: left top;transform: scale(" + ratio + ");"; 24 el.style.height = window.innerWidth + "px"; 25 } 26 } 27 if (advert.dsp == "SKLIK") { 28 const wrapper = document.createElement("div"); 29 wrapper.setAttribute("style", wrapperStyle); 30 const iframe = document.createElement("iframe"); 31 iframe.setAttribute("src", advert.data); 32 iframe.setAttribute("width", advert.width); 33 iframe.setAttribute("height", advert.height); 34 iframe.setAttribute("scrolling", "no"); 35 iframe.setAttribute("class", "ad-div__sklik"); 36 wrapper.appendChild(iframe); 37 el.appendChild(wrapper); 38 } else { 39 const wrapper = document.createElement("div"); 40 wrapper.setAttribute("style", wrapperStyle); 41 wrapper.innerHTML = advert.data; 42 el.appendChild(wrapper); 43 } 44 } else { 45 const data = JSON.parse(advert.data.trim()); 46 const type = el.getAttribute("data-type"); 47 if (type == "sticky-bottom-text") { 48 renderBannerLikeAd(el, data); 49 } else if (type == "in-article") { 50 renderAdInArticle(el, data); 51 } else { 52 renderArticleLikeAd(el, data); 53 } 54 } 55 56 sssp.served(advert.tracking.served); 57 } 58} 59 60const renderBannerLikeAd = (el, data) => { 61 if (data.ads.length) { 62 ad = data.ads[0]; 63 const wrapper = document.createElement("a"); 64 const inner = document.createElement("div"); 65 const closeAd = document.createElement("button"); 66 const title = document.createElement("h2"); 67 const perex = document.createElement("div"); 68 wrapper.setAttribute("class", "ad-item ad-item-banner"); 69 wrapper.setAttribute("target", "_blank"); 70 inner.setAttribute("class", "ad-item-banner-inner"); 71 closeAd.addEventListener("click", (e) => { 72 e.preventDefault(); 73 el.style.display = "none"; 74 }); 75 closeAd.innerHTML = "zavÅÃt reklamu"; 76 wrapper.setAttribute("href", ad.clickUrl); 77 perex.setAttribute("class", "perex"); 78 if (ad.adType === "DRTG") { 79 title.innerText = ad.title; 80 } else if (ad.adType === "SHOP") { 81 title.innerText = ad.shopName; 82 perex.innerText = ad.slogan; 83 wrapper.setAttribute("href", ad.shopUrl); 84 } else if (ad.adType === "COMBINED") { 85 title.innerText = ad.shortHeadline; 86 perex.innerText = ad.description; 87 } 88 wrapper.appendChild(inner); 89 inner.appendChild(closeAd); 90 inner.appendChild(title); 91 inner.appendChild(perex); 92 el.appendChild(wrapper); 93 } 94}; 95const renderArticleLikeAd = (el, data) => { 96 data.ads.forEach((ad) => { 97 const wrapper = document.createElement("article"); 98 const inner = document.createElement("div"); 99 const imgWrapper = document.createElement("div"); 100 const img = document.createElement("img"); 101 const contentWrapper = document.createElement("div"); 102 const title = document.createElement("h4"); 103 const titleLink = document.createElement("a"); 104 const titleSpan = document.createElement("span"); 105 const perex = document.createElement("div"); 106 const adBadgeWrapper = document.createElement("div"); 107 const adBadge = document.createElement("span"); 108 wrapper.setAttribute("class", "article-card ad-item"); 109 inner.setAttribute("class", "article-card__holder"); 110 imgWrapper.setAttribute("class", "article-card__img"); 111 img.setAttribute("class", "image-object__img"); 112 img.setAttribute("alt", ""); 113 img.setAttribute("loading", "lazy"); 114 contentWrapper.setAttribute("class", "article-card__content u-last-m0"); 115 title.setAttribute("class", "article-card__title"); 116 titleLink.setAttribute("class", "article-card__title-link link-mask"); 117 titleLink.setAttribute("target", "_blank"); 118 titleSpan.setAttribute("class", "article-card__title-content"); 119 perex.setAttribute("class", "article-card__perex"); 120 adBadgeWrapper.setAttribute("class", "ad-badge-wrapper"); 121 adBadge.setAttribute("class", "ad-status"); 122 adBadge.innerText = "Reklama"; 123 wrapper.appendChild(inner); 124 inner.appendChild(imgWrapper); 125 imgWrapper.appendChild(img); 126 inner.appendChild(contentWrapper); 127 contentWrapper.appendChild(title); 128 title.appendChild(titleLink); 129 titleLink.appendChild(titleSpan); 130 contentWrapper.appendChild(perex); 131 const timelineLabel = document.createElement("p"); 132 if (el.classList.contains("timeline")) { 133 timelineLabel.setAttribute("class", "timeline__label"); 134 timelineLabel.innerText = "Reklama"; 135 el.classList.add("class", "timeline__item"); 136 el.appendChild(timelineLabel); 137 } else { 138 contentWrapper.appendChild(adBadgeWrapper);
139 adBadgeWrapper.appendChild(adBadge); 140 } 141 if (ad.adType === "DRTG") { 142 titleSpan.innerText = ad.title; 143 titleLink.setAttribute("href", ad.clickUrl); 144 img.setAttribute("src", ad.imageUrl); 145 } else if (ad.adType === "SHOP") { 146 titleSpan.innerText = ad.shopName; 147 perex.innerText = ad.slogan ? ad.slogan : ""; 148 titleSpan.setAttribute("href", ad.shopUrl); 149 } else if (ad.adType === "COMBINED") { 150 titleSpan.innerText = ad.shortHeadline; 151 titleLink.setAttribute("href", ad.clickUrl); 152 perex.innerText = ad.description; 153 img.setAttribute("src", ad.adImageUrl); 154 } 155 el.appendChild(wrapper); 156 }); 157}; 158const renderAdInArticle = (el, data) => { 159 if (data.ads.length) { 160 const wrapper = document.createElement("div"); 161 const badge = document.createElement("div"); 162 badge.setAttribute("class", "ad-item-adInArticle-badge"); 163 badge.innerText = "Reklama"; 164 165 data.ads.forEach((ad) => { 166 const inner = document.createElement("a"); 167 const title = document.createElement("span"); 168 const perex = document.createElement("p"); 169 wrapper.setAttribute("class", "ad-item article-card"); 170 inner.setAttribute("class", "ad-item ad-item-adInArticle"); 171 title.setAttribute("class", "ad-item-adInArticle-title"); 172 perex.setAttribute("class", "ad-item-adInArticle-perex"); 173 inner.setAttribute("target", "_blank"); 174 inner.setAttribute("href", ad.clickUrl); 175 if (ad.adType === "DRTG") { 176 title.innerText = ad.title; 177 } else if (ad.adType === "SHOP") { 178 title.innerText = ad.shopName; 179 perex.innerText = ad.slogan; 180 wrapper.setAttribute("href", ad.shopUrl); 181 } else if (ad.adType === "COMBINED") { 182 title.innerText = ad.shortHeadline; 183 perex.innerText = ad.description; 184 } 185 inner.appendChild(perex); 186 inner.appendChild(title); 187 wrapper.appendChild(inner); 188 }); 189 190 wrapper.appendChild(badge); 191 el.appendChild(wrapper); 192 } 193}; 194 195function adLabel() { 196 var div = document.createElement("div"); 197 var a = document.createElement("a"); 198 div.setAttribute("class", "ad-label"); 199 a.setAttribute("href", "http://napoveda.sklik.cz/cz/co-je-reklama-sklik.html"); 200 a.setAttribute("target", "top"); 201 a.innerText = "Reklama"; 202 div.appendChild(a); 203 return div; 204} 205 206function getPopUp(breakPoint, onScrollElementId, zoneId) { 207 // check if exist cookie with name "cname" 208 function getCookie(cname) { 209 var name = cname + "="; 210 var decodedCookie = decodeURIComponent(document.cookie); 211 var ca = decodedCookie.split(";"); 212 213 for (var i = 0; i < ca.length; i++) { 214 var c = ca[i]; 215 while (c.charAt(0) == " ") { 216 c = c.substring(1); 217 } 218 219 if (c.indexOf(name) == 0) return c.substring(name.length, c.length); 220 } 221 222 return ""; 223 } 224 225 // set cookie with 30 min expiration 226 function setCookie(value) { 227 var d = new Date(); 228 d.setTime(d.getTime() + 30 * 60 * 1000); 229 var expires = "expires=" + d.toUTCString(); 230 231 document.cookie = "seznam-pop-up-ad-first-look=" + value + ";" + expires + ";path=/"; 232 } 233 234 // add necessary styles to head of page 235 function appendStyles() { 236 var css = 237 "#seznam-pop-up-ad{ position: fixed; height: auto; width: 100%; background: rgba(0,0,0,.7);bottom: 0; left: 0; right: 0; text-align: center; padding: 2px 0; z-index: 1001; transition: height 0.5s; }" + 238 "#seznam-pop-up-ad-close{background: rgba(0,0,0,.7); margin-top: -31px; position: absolute; top: 0; right: 0; color: #fff; cursor: pointer; text-align: center; padding: 8px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1; width: 140px; }" + 239 ".seznam-pop-up-ad-hide{ height: 0 !important; padding: 0!important; margin: 0!important;}"; 240 var style = document.createElement("style"); 241 style.innerHTML = css; 242 document.head.appendChild(style); 243 } 244 245 // create Ad divs 246 function createAdDivs() { 247 var div = document.createElement("div"); 248 div.setAttribute("id", "seznam-pop-up-ad"); 249 div.innerHTML = 250 '<div id="seznam-pop-up-ad-close">zavÅÃt reklamu</div>' + '<div id="ssp-zone-' + zoneId + '" style="margin: 0 auto;"></div>'; 251 document.body.appendChild(div); 252 } 253 254 // hide Ad 255 function hideAd() { 256 document.getElementById("seznam-pop-up-ad").classList.add("seznam-pop-up-ad-hide"); 257 document.getElementById("seznam-pop-up-ad-close").style.display = "none"; 258 } 259 260 if (window.innerWidth <= breakPoint && sssp.displaySeznamAds() && document.getElementById(onScrollElementId)) { 261 if (!getCookie("seznam-pop-up-ad-first-look")) setCookie(false); 262 appendStyles(); 263 window.addEventListener("scroll", function () { 264 var createdAd = document.getElementById("seznam-pop-up-ad"); 265 var elementTarget = document.getElementById(onScrollElementId); 266 267 if (window.scrollY > elementTarget.offsetTop - window.innerHeight) { 268 if (!createdAd) { 269 createAdDivs(); 270 271 sssp.getAds([ 272 { 273 zoneId: zoneId, 274 id: "ssp-zone-" + zoneId, 275 width: 500, 276 height: 200, 277 options: { 278 infoCallback: (ad) => { 279 if (ad.type === "empty" || ad.type === "error") { 280 document.getElementById("seznam-pop-up-ad").style.display = "none"; 281 } 282 }, 283 reloadCount: 0, 284 }, 285 }, 286 ]); 287 } 288 289 if (document.getElementById("seznam-pop-up-ad-close")) { 290 document.getElementById("seznam-pop-up-ad-close").addEventListener("click", function () { 291 hideAd(); 292 }); 293 } 294 } 295 }); 296 } 297}
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.