Guest User

Untitled

a guest
Dec 3rd, 2014
973
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name wish.com Tweaks
  3. // @namespace 4wykopk
  4. // @version 1.5
  5. // @description Filtering by max and min price, autoload items. Set price -> check "autoload" -> wait until "All items loaded" appear
  6. // @match https://www.wish.com/*
  7. // @copyright 4wykopk
  8. // ==/UserScript==
  9.  
  10.  
  11. var refresh_time =500;
  12. $(document).ready(function() {
  13.  
  14. $("body").append('<div id="wish_tweaks_config" style="background-color: red; z-index: 999999; padding: 2px; position: fixed; top:0; right:0;><p style="color: black;"> Autolad Products: <input type="checkbox" id="wtc_autoload_items" name="autoload_items" value="value"></p><p style="color: black;">Min Price: <input id="wtc_min_price" type="text" maxlength="4" style="width: 30px;"></p><p style="color: black;">Max Price: <input id="wtc_max_price" type="text" maxlength="4" style="width: 30px;"></p><p>v.1.5</p></div>');
  15.  
  16. $("#wtc_max_price").keydown(function (e) {
  17. if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
  18. (e.keyCode == 65 && e.ctrlKey === true) ||
  19. (e.keyCode >= 35 && e.keyCode <= 39)) {
  20. return;
  21. }
  22. if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
  23. e.preventDefault();
  24. }
  25. });
  26.  
  27. var idInterval = setInterval(function(){
  28. if($("#wtc_max_price").val() == ''){
  29. }else{
  30.  
  31. window.max_price = parseInt($("#wtc_max_price").val());
  32. window.min_price = parseInt($("#wtc_min_price").val());
  33.  
  34.  
  35.  
  36. var items = $(".actual-price");
  37.  
  38. $.each( items, function() {
  39.  
  40. if($(this).text().replace(/\D/g,'') > window.max_price || $(this).text().replace(/\D/g,'') < window.min_price){
  41. $(this).parent().parent().parent().parent().remove();
  42. }
  43.  
  44. });
  45.  
  46. }
  47.  
  48. if($("#wtc_autoload_items").is(':checked')){
  49. window.scrollBy(0, 500);
  50. $("#feed-more-btn").click();
  51. window.scrollBy(0, -100);
  52.  
  53.     if(!$( "#feed-more-end" ).hasClass( "hide" )){
  54.         alert("All items loaded");
  55.         clearInterval(idInterval);
  56.     }
  57. }
  58.  
  59.  
  60.  
  61. }, refresh_time);
  62.  
  63.  
  64. });
Advertisement
Add Comment
Please, Sign In to add comment