Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name wish.com Tweaks
- // @namespace 4wykopk
- // @version 1.5
- // @description Filtering by max and min price, autoload items. Set price -> check "autoload" -> wait until "All items loaded" appear
- // @match https://www.wish.com/*
- // @copyright 4wykopk
- // ==/UserScript==
- var refresh_time =500;
- $(document).ready(function() {
- $("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>');
- $("#wtc_max_price").keydown(function (e) {
- if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
- (e.keyCode == 65 && e.ctrlKey === true) ||
- (e.keyCode >= 35 && e.keyCode <= 39)) {
- return;
- }
- if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
- e.preventDefault();
- }
- });
- var idInterval = setInterval(function(){
- if($("#wtc_max_price").val() == ''){
- }else{
- window.max_price = parseInt($("#wtc_max_price").val());
- window.min_price = parseInt($("#wtc_min_price").val());
- var items = $(".actual-price");
- $.each( items, function() {
- if($(this).text().replace(/\D/g,'') > window.max_price || $(this).text().replace(/\D/g,'') < window.min_price){
- $(this).parent().parent().parent().parent().remove();
- }
- });
- }
- if($("#wtc_autoload_items").is(':checked')){
- window.scrollBy(0, 500);
- $("#feed-more-btn").click();
- window.scrollBy(0, -100);
- if(!$( "#feed-more-end" ).hasClass( "hide" )){
- alert("All items loaded");
- clearInterval(idInterval);
- }
- }
- }, refresh_time);
- });
Advertisement
Add Comment
Please, Sign In to add comment