wish.com Tweaks

Filtering by max price, autoload items

当前为 2014-09-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name wish.com Tweaks
  3. // @namespace obscenelysad@gmail.com
  4. // @version 1.2
  5. // @description Filtering by max price, autoload items
  6. // @match https://www.wish.com/*
  7. // @copyright obscenelysad@gmail.com
  8. // ==/UserScript==
  9.  
  10.  
  11.  
  12.  
  13. $(document).ready(function() {
  14. if ($("#nav-search").length > 0){
  15. $("#header-left").after('<div id="wish_tweaks_config" style="float: left; margin-top: 18px;"><p style="color: black;float: left;"> Autolad Products:</p><input type="checkbox" id="wtc_autoload_items" name="autoload_items" value="value" style="float: left;"><p style="color: black;float: left;">Max Price: </p><input id="wtc_max_price" type="text" maxlength="4" style="width: 30px;width: 2;margin-left: 5px;margin-top: 0px;"></div>');
  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. setInterval(function(){
  27. if($("#wtc_max_price").val() == ''){
  28. window.max_price = 33;
  29. }else{
  30. window.max_price = parseInt($("#wtc_max_price").val());
  31. }
  32. var items = $(".actual-price");
  33. $.each( items, function() {
  34. if($(this).text().replace(/\D/g,'') > window.max_price){
  35. $(this).parent().parent().parent().parent().remove();
  36. }
  37. });
  38. if($("#wtc_autoload_items").is(':checked')){
  39. $("#feed-more-btn").click();
  40. }
  41. }, 500);
  42. }
  43. });