Skip to content

Instantly share code, notes, and snippets.

@LiquidSebbey
Created June 2, 2017 13:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save LiquidSebbey/852deb0db490b4053a1c8763ade66397 to your computer and use it in GitHub Desktop.
Save LiquidSebbey/852deb0db490b4053a1c8763ade66397 to your computer and use it in GitHub Desktop.
Sort Wish.com results by price
$("<style>.overlay { position:absolute; background-color: white; top:0; left:0; width:100%; height:100%; z-index:1000; } .loader { position: fixed; top: 1em; padding: 15px; maring: 15px; border: 1px solid #000000; border-radius: 10px; background-color: #CC0000; color: #FFFFFF; right: 1em; z-index: 999999999999; }</style>").appendTo("head");
$("body").append("<div id='overlay' class='overlay'></div><div id='loader' class='loader'><b>Bezig met inladen en sorteren ...</b></div>");
maxProducts = prompt("Hoeveel producten wil je inladen? (max. 500)");
var app = setInterval(function(){
if ($(".feed-product-item").length < maxProducts){
if($("#loading-img.hide").length == 0){
$("html, body").animate({ scrollTop: $(document).height() }, 0);
$('#overlay').css({ height: $(document).height() });
}
}else{ clearInterval(app);
$('.currency-subscript').remove();
$( ".feed-product-item" ).each(function(){
price = $(this).find(".feed-actual-price").html();
price = price.replace(" € ","").replace("€","").replace(" ","").replace("Free",0);
$(this).attr('price', $.trim(price));
if (price == 0 || price > 20){ $(this).remove(); }
})
var products = $(".feed-product-item");
products.sort(function (a, b) {
// convert to integers from strings
a = parseInt($(a).attr("price"), 10);
b = parseInt($(b).attr("price"), 10);
if(a > b) { return 1;} else if(a < b) { return -1; } else { return 0; }
});
// put sorted results back on page
$("#feed-grid").html('');
$("#feed-grid").append(products);
$("#overlay").remove();
$("#loader").remove();
$("html, body").animate({ scrollTop: 0 }, 0);
}
},50);
@kuangzhang
Copy link

how do you use this script?

@pushasha
Copy link

@kuangzhang I was able to just paste it into my chrome inspector javascript console, but you could probably make use something like Greasemonkey to run the script on page load.

@Shuunen
Copy link

Shuunen commented Apr 20, 2018

Hi @LiquidSebbey @kuangzhang & @pushasha,

You might like this https://greasyfork.org/fr/scripts/38097-wish-com-price-filter-more

I made this for my personal use, hope you'll enjoy 😀

@mradwan94
Copy link

WishOrganiser

If the above code doesn't work you can try this:

Sorting Wish products by price

Usage:

1-Just open any Wish page.

2-Right click on the mouse.

3-Inspect.

4-Console.

5-Paste the code in the console.

Ready !!

https://github.com/mradwan94/WishOrganiser/blob/master/WishOrganiser

@LiquidSebbey
Copy link
Author

LiquidSebbey commented Jun 16, 2020

As of June 2020 the code is not working anymore since Wish removes items from the DOM when you scroll through. The code is not maintained, maybe I'll write a newer one in the future. Thanks for supporting and using this script, I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment