Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
5.5 kB
0
Indexable
Never
(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);
  }
})();









.selector-products .products-row .product-tile:nth-child(n+10) {
	display: none !important;
}

.yankee-pdp-wrapper .product-tile-wrap{
    height: 135px;
}

#product-search-results .product-tile a.product-tile-link{
    height: auto !important;
}

.product-tile a.product-tile-link {
    height: 140px;
}

#prodSelecDesktop {
	display: none !important;
}

#maincontent div.row.tile > div.pdp-tile > div.attributes > div > div > div.row > div.more-products-link {
	display: none !important;
}

.promotion-msg.promotion-primary {
	display: none !important;
}

#prodSelecMob {
	display: none;
}

div.yankee-pdp-wrapper {
	display: flex;
	flex-wrap: wrap;
	margin-top: -4%;
}

div.yankee-pdp-wrapper > div {
	padding: none !important;
}

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;
}

div.yankee-pdp-wrapper > div > div > div a.product-tile-link:hover {
	border-radius: inherit !important;
	border-width: 0.1rem !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;
}

div.yankee-pdp-wrapper .product-tile-addtocart  div.row.tile-body-footer{
    display: none !important;
}

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: 0 !important;
}

.product .product-tile .image-container .badge {
	display: none !important;
}

@media (min-width:768px) and (max-width:991px) {
	.product-tile {
		min-height: 10em;
	}

    .product .product-tile .product-tile-link:hover {
        border: none !important;
        }

    .yankee-pdp-wrapper .product-tile-wrap{
        height: 140px;
    }
    
    .product-tile a.product-tile-link {
        height: 140px;
    }

	.image-container  img {
		margin: auto;
		margin-top: 20px;
	}

    div.yankee-pdp-wrapper  div.image-container  {
		margin-block: -5px !important;
	}

	.product .tile-body.product-tile-addtocart {
		padding-bottom: 0;
		margin-bottom: -30px;
	}

	.yankee-pdp-wrapper .product-tile-wrap {
		height: initial;
	}

    div.yankee-pdp-wrapper .product-tile-addtocart  div.row.tile-body-footer{
        display: none !important;
    }

}

@media screen and (max-width: 767px){
	
	  div#prodSelecMob {
        display: none;
    }
	
    #maincontent div.tile-body.product-tile-addtocart > div.pdp-link > div.link {
        font-size: 13px;
        text-align: center;
    }


 div.yankee-pdp-wrapper  div.image-container {
    margin-block: -8px !important;
}

div.yankee-pdp-wrapper .product-tile-addtocart  div.row.tile-body-footer{
    display: none !important;
}

.yankee-pdp-wrapper .product-tile-wrap {
	height: 170px;
}
.product .product-tile .product-tile-link:hover {
border: none !important;
}
div.yankee-pdp-wrapper div.image-container > img{
    width: 90% !important;
}
}