Untitled
unknown
plain_text
3 years ago
4.3 kB
6
Indexable
(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.querySelectorAll("#productTileTitle").forEach((e)=>{
e.textContent = "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);
}
})();
#prodSelecDesktop {
display: none !important;
}
.selector-products .products-row .product-tile:nth-child(n+10) {
display: none !important;
}
.pdp-tile .pdp-selector .row .more-products-link{
display: none !important
}
#product-search-results .product-tile a.product-tile-link{
height: auto !important;
}
#prodSelecMob {
display: none;
}
div.yankee-pdp-wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
div.yankee-pdp-wrapper > div {
padding: 0 !important;
max-height: 133px !important;
}
div.yankee-pdp-wrapper > div:focus-visible {
border: none;
}
div.yankee-pdp-wrapper > div > div > div {
border: none !important;
box-shadow: none !important;
border-radius: unset !important;
height: initial !important;
min-height: initial !important;
text-align: center;
}
div.yankee-pdp-wrapper > div > div > div a.product-tile-link:hover {
border-radius: inherit !important;
border-width: 0.1rem !important;
}
div.yankee-pdp-wrapper > div > div > div > div.tile-body.product-tile-addtocart > div:nth-last-child(-n+10) {
display: none;
}
div.yankee-pdp-wrapper > div > div > div > div.tile-body.product-tile-addtocart > div:first-child {
display: none;
}
div.yankee-pdp-wrapper > div > div > div > div.tile-body.product-tile-addtocart {
padding: 0.3rem !important;
}
div.yankee-pdp-wrapper > div > div > div > div.tile-body.product-tile-addtocart > .pdp-link > .link {
font-size: 0.75rem;
font-weight: 800;
text-align: center;
word-break: break-word;
overflow-wrap: break-word;
}
div.yankee-pdp-wrapper > div > div > div > div.tile-body.product-tile-addtocart > .pdp-link {
padding-top: .1rem !important;
min-height: 1.3rem !important;
}
div.yankee-pdp-wrapper > div > div > div > div.image-container > span.badge {
display: none;
}
div.yankee-pdp-wrapper > div > div > div > div.image-container > .tile-image {
padding: 0 !important;
max-width: 130px;
width: 80%;
}
@media(max-width:767px) {
div.yankee-pdp-wrapper > div {
max-height: max-content !important;
max-width: max-content !important;
}
}
@media(max-width:576px) {
div.yankee-pdp-wrapper > div {
max-width: 122px !important;
}
div.yankee-pdp-wrapper > div > div > div > div.image-container > .tile-image {
width: 70%;
}
}Editor is loading...