您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Filtering by max price
当前为
// ==UserScript== // @name Wish.com - Price filter // @namespace http://tampermonkey.net/ // @version 1.4 // @description Filtering by max price // @author [email protected], Shuunen // @match https://www.wish.com/* // @grant none // ==/UserScript== $(document).ready(function() { console.log('wish price filter : init'); // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. function debounce(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; } function showHideProducts() { console.log('wish price filter : showHideProducts'); max_price = parseInt($("#wtc_max_price").val()) || 1000; var items = $(".feed-actual-price"); $.each( items, function() { var priceOk = ($(this).text().replace(/\D/g,'') <= max_price); $(this).parent().parent().parent().parent().toggle(priceOk); }); } if ($("#nav-search").length > 0){ $("#header-left").after('<div id="wish_tweaks_config" style="float: left; margin-top: 18px;">Max Price: <input id="wtc_max_price" type="text" maxlength="4" style="width: 30px;width: 2;margin-left: 5px;margin-top: 0px;"></div>'); } var showHideProductsDebounced = debounce(showHideProducts, 500); // when dom content change document.getElementById('contest-feed').addEventListener('DOMSubtreeModified', showHideProductsDebounced); // when input value change $("#wtc_max_price").keydown(showHideProductsDebounced); });