JavaScript
/* 300x250 & 336x280 (4) */
/* Переменная 'info' необходима для указания юридической информации о компании */
var info = "<strong>[[ORD_LEGAL_NAME]]<br>ИНН: [[ORD_CLIENT_INN]]</strong>";
var trimLength = 28;
var showOldPrice = true;
/* Ниже этой строчки код редактировать не рекомендуется */
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 custom_script=document.createElement("SCRIPT");custom_script.onload=function(){$(document).ready((function(){function enlarge(item){var that=$(item);$(".item").addClass("item--hidden"),$(that).removeClass("item--hidden"),$(".logo").removeClass("logo--aninone"),$(".logo").addClass("logo--centered"),$(that).addClass("item--upper"),$(that).addClass("item--fullsize"),$(that).find(".price").addClass("price--visible")}function squeeze(item){var that=$(item);$(".item").removeClass("item--hidden"),$(".logo").removeClass("logo--centered"),$(that).removeClass("item--fullsize"),$(that).find(".price").removeClass("price--visible"),setTimeout((function(){$(that).removeClass("item--upper")}),500)}if("ontouchstart"in document.documentElement)$(".item").click((function(){if($(this).hasClass("item--fullsize"))squeeze(this);else enlarge(this)}));else $(".item").on("mouseenter",(function(){var that=$(this),timer=setTimeout((function(){enlarge(that)}),600);$(that).on("mouseleave",(function(){if(clearTimeout(timer),$(that).hasClass("item--fullsize"))squeeze(that)}))}));$(".footer__disclaimer").hover((function(){$(".footer").addClass("footer--shorten"),$(".footer__about").hide()}),(function(){$(".footer").removeClass("footer--shorten"),$(".footer__about").show()}))}))},custom_script.type="text/javascript",custom_script.src="https://cdn.adhigh.net/jquery-3.6.0.min.js",custom_script.defer="defer",document.getElementById(elementId).appendChild(custom_script);var creative=function(){var container=document.createElement("div");return container.innerHTML='<div class="wrapper"><a class="logo logo--aninone" href="' + urlWithRedirect + '" target="_blank"><img src="https://[[SITE_LOGO]]"></a><div class="content">'+goods(0,4)+'</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></div>",container.firstChild};function numberWithSpaces(x){return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")}function priceDiv(price,oldprice){return'<div class="oldprice"><em>SALE</em><span>'+numberWithSpaces(oldprice)+"</span></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="",itemClass="item";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)itemClass="item item--sale",price=priceDiv(products[i+c].price,products[i+c].oldprice);else itemClass="item";goods+='<a class="'+itemClass+'" 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><div class="fixed"><div class="price">'+numberWithSpaces(products[i+c].price)+'</div><div class="buttonf">'+shortenName+'</div><div class="buttonf buttonf--blue">Посмотреть</div></div></a>'}return goods}document.getElementById(elementId).appendChild(creative());
CSS