Untitled
unknown
plain_text
3 years ago
2.8 kB
11
Indexable
.yankee-pdp-wrapper {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
span.bv_stars_svg_no_wrap > svg,
div.row.add-to-cart-wrapper > div.attribute.quantity > div{
display: none !important;
}
.product .tile-body.product-tile-addtocart {
padding-bottom: 0;
display: -webkit-inline-box;
}
#maincontent div.tile-body.product-tile-addtocart > div.pdp-link > div.link {
font-size: 12px;
font-family: 'Roboto-Bold';
text-align: center;
padding-top: 0px;
margin-top: -15px;
}
.row.tile-body-footer {
display: none !important;
}
#maincontent div.tile-body.product-tile-addtocart > div.product-primary-category {
display: none !important;
}
.color-swatches {
display: none !important;
}
.price.non-sale-value {
display: none !important;
}
.row.add-to-cart-wrapper {
display: none !important;
}
(function () {
var debug = false;
try {
function waitForElement(selector, callback) {
var maxCheck = 200;
var interval = window.setInterval(function () {
if (document.querySelectorAll(selector).length > 0) {
callback();
window.clearInterval(interval);
} else if (--maxCheck < 0) {
window.clearInterval(interval);
}
}, 50);
}
function addProductsToPDP(products) {
for (var i = 0; i < products.length; i++) {
if (products[i].getAttribute('data-tile-position') < 10) {
document.querySelectorAll('.yankee-pdp-wrapper').forEach(function (item, index) {
console.log(item);
item.insertAdjacentElement('beforeend', products[i].cloneNode(true));
});
}
}
}
function init() {
document.querySelectorAll('.pdp-tile > .attributes .pdp-selector').forEach(function (item, index) {
item.insertAdjacentHTML('beforeend', '<div class="yankee-pdp-wrapper"></div>');
});
document.querySelector("#productTileTitle").innerText = "Style (1 of 9)"
var xhr = new XMLHttpRequest();
var url = document.querySelector('.breadcrumb > .breadcrumb-item:nth-child(3) a').getAttribute('href');
xhr.open('GET', url, true);
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var customEl = document.createElement('div');
customEl.innerHTML = this.responseText;
var products = customEl.querySelectorAll('.product-grid .product-tile-wrap');
addProductsToPDP(products);
}
};
xhr.send();
}
waitForElement('.breadcrumb > .breadcrumb-item:nth-child(3) a', init);
} catch (e) {
if (debug) console.log(e, 'error in ' + variation_name);
}
})();Editor is loading...