/* slider 336x280 */
/* Переменная 'info' необходима для указания юридической информации о компании */
var info = "<strong>[[ORD_LEGAL_NAME]]<br>ИНН: [[ORD_CLIENT_INN]]</strong>";
var trimLength = 38;
var showOldPrice = true;
var swiperAutoplay = { delay: 3000 };
/* Ниже этой строчки код редактировать не рекомендуется */
var linkFont=document.createElement("LINK");linkFont.rel="stylesheet",linkFont.href="https://fonts.googleapis.com/css2?family=PT+Sans&display=swap",document.getElementById(elementId).appendChild(linkFont);var linkSwiper=document.createElement("LINK");linkSwiper.rel="stylesheet",linkSwiper.href="https://cdn.adhigh.net/banners/dynamic-template/swiper8/swiper-bundle.min.css",document.getElementById(elementId).appendChild(linkSwiper);var scriptSwiper=document.createElement("SCRIPT");scriptSwiper.onload=function(){var swiperTimer=!1;if("undefined"!=typeof swiperAutoplay)swiperTimer=swiperAutoplay;new Swiper(".swiper",{loop:!0,effect:"fade",autoplay:swiperTimer,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})},scriptSwiper.type="text/javascript",scriptSwiper.src="https://cdn.adhigh.net/banners/dynamic-template/swiper8/swiper-bundle.min.js",document.getElementById(elementId).appendChild(scriptSwiper);var scriptJquery=document.createElement("SCRIPT");scriptJquery.onload=function(){$(document).ready((function(){$(".footer__disclaimer").hover((function(){$(".footer").addClass("footer--shorten"),$(".footer__about").hide()}),(function(){$(".footer").removeClass("footer--shorten"),$(".footer__about").show()}))}))},scriptJquery.type="text/javascript",scriptJquery.src="https://cdn.adhigh.net/jquery-3.6.0.min.js",document.getElementById(elementId).appendChild(scriptJquery);var creative=function(){var container=document.createElement("div");return container.innerHTML='<div class="wrapper"><a class="logo" href="' + urlWithRedirect + '" target="_blank"><img src="https://[[SITE_LOGO]]"></a><div class="content"><div class="swiper"><div class="swiper-wrapper">'+goods(0,products.length)+'<div class="swiper-button-prev"></div><div class="swiper-button-next"></div></div></div></div><div class="footer"><a class="footer__logo" href="https://getintent.com/" target="_blank"><span>Реклама</span><img class="pic" src="https://cdn.adhigh.net/banners/dynamic-template/logo-getintent.svg"></a><div class="footer__about"><span>Рекламодатель</span></div><div class="footer__disclaimer">'+info+"</div></div>",container.firstChild};function numberWithSpaces(x){return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")}function priceDiv(price,oldprice){return'<div class="oldprice"><span>'+numberWithSpaces(oldprice)+'</span></div><div class="price">'+numberWithSpaces(price)+"</div>"}function goods(i,count){for(var goods="",c=0;c<count;c++){var itemName="no name model g:title";if(products[i+c].hasOwnProperty("name"))if(products[i+c].name)itemName=products[i+c].name;if(products[i+c].hasOwnProperty("model"))if(products[i+c].model)itemName=products[i+c].model;if(products[i+c].hasOwnProperty("g:title"))if(products[i+c]["g:title"])itemName=products[i+c]["g:title"];var shortenName=itemName;if(itemName.length>=trimLength)shortenName=itemName.substring(0,trimLength).trim()+"...";var price="";if(void 0!==products[i+c].price&&"0"!=products[i+c].price)if(null!=products[i+c].oldprice&&showOldPrice&&products[i+c].oldprice!==products[i+c].price)price=priceDiv(products[i+c].price,products[i+c].oldprice);else price='<div class="price">'+numberWithSpaces(products[i+c].price)+"</div>";goods+='<a class="swiper-slide item" href="'+products[i+c].url+'" target="_blank"><div class="top"><div class="pic"><img src="'+products[i+c].picture+'"/></div>'+price+'</div><div class="bottom"><span>'+shortenName+'</span><div class="button">Посмотреть</div></div></a>'}return goods}document.getElementById(elementId).appendChild(creative()); |
/* Переменные для настройки внешнего вида креатива */
:root {
--itemBackgroundColor: #373737;
--itemAccentColor: #56ccf2;
--salePriceBackgroundColor: #eb5757;
--itemTextSize: 12px;
--buttonTextSize: 15px;
--salePriceTextSize: 12px;
--priceTextSize: 12px;
}
/* Ниже этой строчки код редактировать не рекомендуется */
:root{--itemTextColor:#fff;--buttonTextColor:#fff;--salePriceTextColor:#fff;--footerDuration:0.2s}*,:after,:before{box-sizing:border-box}body,html{margin:0;padding:0}.wrapper{text-wrap:balance;border:1px solid var(--itemBackgroundColor);font-family:PT Sans,Arial,sans-serif;height:100%;left:50%;overflow:hidden;top:50%;transform:translate(-50%,-50%);width:100%;z-index:0}.logo,.wrapper{background-color:#fff;position:absolute}.logo{display:block;font-size:0;height:150px;right:10px;top:10px;width:130px;z-index:3}.logo.logo--centered{width:92%}.logo img{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.content{height:240px;margin:10px 10px 0;width:316px}.item{display:flex;flex-direction:column;height:calc(50% - 5px);justify-content:space-between;position:absolute;transition:all .5s ease;width:calc(50% - 5px)}.item,.item *{text-decoration:none}.item.item--upper{z-index:1}.item.item--fullsize{height:100%;width:100%}.item.item--fullsize .top{border-color:#fff}.item.item--fullsize .top:before{opacity:0}.item:first-child{left:0;top:0}.item:nth-child(2){right:0;top:0}.item:nth-child(3){bottom:0;left:0}.item:nth-child(4){bottom:0;right:0}.top{background-color:#fff;height:240px;overflow:hidden;transition:height .5s ease,border .5s ease;width:176px}.top,.top>*{position:relative}.top>*{z-index:2}.top .pic{background-color:#fff;border-top-left-radius:5px;border-top-right-radius:5px;height:100%}.top img{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.oldprice{background-color:var(--salePriceBackgroundColor);border-bottom-left-radius:50px;border-top-left-radius:50px;bottom:calc(var(--priceTextSize)*1.5 + .5em);color:var(--salePriceTextColor);padding:0 4px 0 8px;position:absolute;right:0;text-align:right;transition:all .2s ease}.oldprice span{font-size:var(--salePriceTextSize);line-height:1.5}.oldprice span:before{background-color:var(--salePriceTextColor);content:" ";height:1px;left:5px;position:absolute;top:50%;width:calc(100% - 8px)}.oldprice span:after{content:"₽";height:100%;margin-left:2px}.price{align-items:center;background-color:var(--itemBackgroundColor);border-bottom-left-radius:50px;border-top-left-radius:50px;bottom:0;color:var(--itemTextColor);display:flex;font-size:var(--priceTextSize);line-height:1.5;padding:0 4px 0 16px;position:absolute;right:0;text-align:right}.price:before{background-color:var(--itemAccentColor);border-radius:8px;content:" ";height:8px;left:4px;position:absolute;top:50%;transform:translateY(-50%);width:8px;z-index:2}.price:after{content:"₽";height:100%;margin-left:2px}.price--visible{right:0}.bottom{background-color:var(--itemBackgroundColor);bottom:0;color:var(--itemTextColor);flex-grow:1;height:80px;position:absolute;right:0;text-align:center;width:130px}.bottom span{align-items:center;color:inherit;display:flex;flex-grow:1;font-size:var(--itemTextSize);font-weight:400;height:50px;justify-content:center;line-height:1.1;padding:0 6px}.button{background-color:var(--itemAccentColor);color:var(--buttonTextColor);font-size:var(--buttonTextSize);height:30px;line-height:30px;text-transform:uppercase}.button,.footer{text-align:center;width:100%}.footer{align-items:flex-end;bottom:0;color:var(--itemTextColor);display:flex;font-size:9px;justify-content:space-between;left:0;line-height:16px;position:absolute;z-index:3}.footer.footer--shorten:before{width:calc(100% - 185px)}.footer:before{bottom:0;content:" ";height:10px;left:0;position:absolute;transition:width var(--footerDuration) ease;width:100%;z-index:-1}.footer:before,.footer__logo{background-color:var(--itemBackgroundColor)}.footer__logo{border-top-right-radius:8px;color:inherit;height:16px;overflow:hidden;padding:0 6px;position:relative;text-decoration:none;transition:all var(--footerDuration) ease;width:50px}.footer__logo:focus,.footer__logo:hover{height:28px;width:110px}.footer__logo:focus span,.footer__logo:hover span{height:28px;opacity:0}.footer__logo:focus .pic,.footer__logo:hover .pic{opacity:1}.footer__logo span{line-height:16px;transition:all var(--footerDuration) ease}.footer__logo .pic{left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);transition:opacity var(--footerDuration) ease;width:66%}.footer__about{background-color:var(--itemBackgroundColor);border-top-left-radius:8px;height:16px;line-height:16px;padding:0 6px;text-align:center;width:80px}.footer__about:focus,.footer__about:hover{opacity:0}.footer__about:focus+.footer__disclaimer,.footer__about:hover+.footer__disclaimer{opacity:1;transform:translate(0,0)}.footer__disclaimer{bottom:0;color:transparent;font-size:7px;line-height:10px;opacity:0;padding:12px 12px 16px;position:absolute;right:0;transform:translate(calc(100% - 80px),calc(100% - 16px));transition:all var(--footerDuration) ease,opacity .1s ease;width:185px;z-index:1}.footer__disclaimer:before{background-color:var(--itemBackgroundColor);border-top-left-radius:8px;content:" ";height:100%;left:0;opacity:.85;position:absolute;top:0;width:100%;z-index:-1}.footer__disclaimer:focus,.footer__disclaimer:hover{color:var(--itemTextColor);opacity:1;transform:translate(0,0)}.footer__disclaimer strong{font-size:9px;font-weight:400}.footer__disclaimer a{-webkit-font-smoothing:antialiased;color:#56ccf2}.swiper-button-next,.swiper-button-prev{height:32px!important;top:115px!important;width:32px!important}.swiper-button-next:after,.swiper-button-prev:after{content:""!important}.swiper-button-next{background-image:url("https://cdn.adhigh.net/banners/dynamic-template/icons/icon-next.svg");right:140px!important}.swiper-button-prev{background-image:url("https://cdn.adhigh.net/banners/dynamic-template/icons/icon-prev.svg");left:0!important} |