<script>
$(document).ready(function () {
$('.js-store').on('tStoreRendered', '.js-store-grid-cont', function(){
$('.js-product.t-store__card a').each(function () {
$(this).attr('href', '#popup:course');
$(this).off('click')
});
});
let promocodeBlk = `
<div class="prcode-wrapper t-text">
<div class="prcode-text"></div>
<div class="prcode-btn"></div>
</div>
`;
$('.uc-popup-blk .t390__descr').after(promocodeBlk);
let promocodeFooter = `
<div class="prcode-footer-wrapper t-text">
<div class="prcode-footer-label third-label">Реклама ООО «Скиллстар»</div>
</div>
`;
$('.uc-popup-blk .t390__btn-wrapper').after(promocodeFooter);
let closeIcon = `<div class="close-popup">`;
$('.uc-popup-blk .t390__uptitle').before(closeIcon);
$(document).on('click','a[href="#popup:course"]',function(event){
let btn = $(this);
let card = btn.closest('.js-product');
let prName = card.find('.js-store-prod-name').text();
let prSku = card.find('.js-store-prod-sku').text();
let link = card.attr('data-product-url');
let percent = card.find('.t-store__card__mark').text();
if(percent==''){
percent=10;
}else{
percent = percent.replace(/[^0-9]/g, '');
};
$('.uc-popup-blk .t-heading').text(prName);
$('.uc-popup-blk .t390__btn_first').attr('href', link);
$('.uc-popup-blk .prcode-text').text(prSku);
$('.uc-popup-blk .t390__descr span').text('Скопируйте промокод на -'+percent+'% и введите на сайте');
});
$(document).on('click','div.close-popup',function(event){
$('.uc-popup-blk .t-popup__block-close-button')[0].click()
});
$(document).on('click','.prcode-btn',function(event){
$('.uc-popup-blk .prcode-text').addClass('invert');
setTimeout(function(){
$('.uc-popup-blk .prcode-text').removeClass('invert');
}, 750);
let copyquote = $('.uc-popup-blk .prcode-text').text();
if ( copyquote.trim().length > 0) {copyFunction(copyquote)};
});
function copyFunction(copy) {
var textArea = document.createElement("textarea");
textArea.value = copy;
textArea.style.position = "fixed";
document.body.appendChild(textArea);
textArea.focus();textArea.select();document.execCommand('copy');
document.body.removeChild(textArea);
};
});
</script>
<style>
.t-store__card__mark-wrapper {
display: none;
}
.prcode-footer-wrapper {
display: flex;
flex-wrap: wrap;
margin-top: 5px;
}
.uc-popup-blk .t390__uptitle.t-uptitle span {
background-image: url(https://static.tildacdn.com/tild3537-3736-4839-a639-316161383064/Skillstar.svg);
background-size: contain;
background-repeat: no-repeat;
background-position: center;
color: transparent !important;
}
.prcode-footer-label.first-label, .prcode-footer-label.second-label {
font-size: 10px;
margin-right: 10px;
background-color: #B1B6C0;
border-radius: 3px;
padding: 5px 10px;
color: #5d56ab;
font-weight: 400;
display: flex;
align-items: center;
}
.uc-popup-blk a.t390__btn {
width: 100%;
}
.uc-popup-blk .t390__descr {
margin-top: 7px;
}
.prcode-footer-label.third-label {
font-weight: 400;
margin-top: 6px;
font-size: 10px;
color: #B1B6C0;
text-align: center;
width: 100%;
}
.uc-popup-blk .t-popup__container {
border-radius: 10px;
}
.uc-popup-blk .t390__btn.t390__btn_first {
margin-left: 0;
}
.prcode-footer-label.second-label:before {
content: "";
background-image: url(https://static.tildacdn.com/tild6430-6633-4336-b238-393837323261/Star_1_1.svg);
width: 12px;
height: 12px;
display: inline-block;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
margin-right: 3px;
}
.prcode-btn {
width: 50px;
height: 50px;
border-radius: 10px;
background-color: #F0F1F3;
background-image: url(https://static.tildacdn.com/tild3436-6561-4638-b133-383061636134/Layer_2.svg);
background-size: 32%;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
.uc-popup-blk .t390__btn-wrapper {
margin-top: 6px;
}
.prcode-text {
height: 48px;
border-radius: 10px;
border: 1px solid #DBDEE5;
margin-right: 5px;
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
font-weight: 600;
font-size: 17px;
background-color: #fff;
}
.prcode-text.invert {
/*filter: invert(1);*/
background-color: #F0F1F3;
}
.prcode-wrapper {
margin-top: 14px;
display: flex;
}
.prcode-btn:hover {
background-color: #BFFB50;
}
.uc-popup-blk .close-popup {
width: 40px;
height: 40px;
background-image: url(https://static.tildacdn.com/tild6635-3764-4539-b962-653066643136/close_111152.svg);
position: absolute;
right: 10px;
top: 10px;
background-size: contain;
background-position: center;
cursor: pointer;
}
.uc-popup-blk .t-popup__close.t-popup__block-close {
opacity: 0;
}
@media screen and (max-width:640px){
.uc-popup-blk .close-popup{
width:30px;
height:30px;
}
.prcode-footer-label.first-label, .prcode-footer-label.second-label {
font-size: 10px;
margin-right: 5px;
padding: 3px 7px;
}
.prcode-footer-wrapper {
margin-top: 10px;
}
.prcode-footer-label.third-label {
font-size: 12px;
}
.uc-popup-blk .t390__title{
font-size: 17px !important;
margin-top:20px;
}
.uc-popup-blk .t390__uptitle div{
font-size: 24px !important;
}
.uc-popup-blk .t390__descr div{
font-size: 12px !important;
margin-bottom:30px;
}
}
</style>