Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Percentage
- x = []
- $(".plp-product-list__fragment").each(function() { prices = this.getElementsByClassName("pip-price__integer"); x.push(
- [ prices[1].outerText.replace(",","") / prices[0].outerText.replace(",",""), this ]
- )})
- y = x.sort(function(a,b){return b[0]-a[0]}).reverse()
- y.forEach(function(x) { x[1].parentElement.parentElement.appendChild(x[1].parentElement); })
- // Absolute
- x = []
- $(".plp-product-list__fragment").each(function() { prices = this.getElementsByClassName("pip-price__integer"); x.push(
- [ prices[0].outerText.replace(",","")-prices[1].outerText.replace(",",""), this ]
- )})
- y = x.sort(function(a,b){return b[0]-a[0]})
- y.forEach(function(x) { x[1].parentElement.parentElement.appendChild(x[1].parentElement); })
Advertisement
Add Comment
Please, Sign In to add comment