您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
按价格过滤并排序(价格升序)秒杀商品列表
当前为
// ==UserScript== // @name 京东秒杀价格过滤 // @version 0.1 // @icon https://www.jd.com/favicon.ico // @description 按价格过滤并排序(价格升序)秒杀商品列表 // @author You! // @run-at document-end // @match *://miaosha.jd.com/category.html?cate_id=* // @grant GM_setValue // @grant GM_getValue // @namespace http://tampermonkey.net/ // ==/UserScript== GM_setValue('jd_miaosha_price_min', 0.00); //<-----------------------------------------------------------过滤价格修改这里 GM_setValue('jd_miaosha_price_max', 100.00); //<-----------------------------------------------------------过滤价格修改这里 (function() { var doFilter = function(){ clearInterval(priceFilter); var count = 0; //count += filterGoods($('div.skwrap')); //正在抢购 //count += filterGoods($('div.moregoods')); //更多好货 count += filterGoods($('div.catinfo_seckillnow')); //当天正在秒杀的商品 count += filterGoods($('div.catinfo_startsoon')); //明日秒杀的商品 if (count === 0) priceFilter = setInterval(doFilter, 1000); }; var filterGoods = function(goodsList) { var goods = goodsList.find('li.seckill_mod_goods'); if (goods.length > 0) { //按价格过滤 var niceGoods = []; goods.each(function(idx){ var price = getPrice(this); if (priceMin <= price && price <= priceMax) niceGoods.push(this); }); var count = niceGoods.length; //排序 if (count > 0) niceGoods.sort(function(g1, g2){ return getPrice(g1) - getPrice(g2); //<-------------------------------------------------如果要降序,修改这里 }); else niceGoods = $('<center><h2><br/>该分类下所有商品的价格都不符合过滤条件。<br/></h2></center'); //替换原内容 $(goods[0].closest('ul')).empty().append(niceGoods); } return goods.length; }; if (!location.href.match('miaosha.jd.com')) return; var priceMin = GM_getValue('jd_miaosha_price_min'); var priceMax = GM_getValue('jd_miaosha_price_max'); var priceFilter = setInterval(doFilter, 1000); })(); function getPrice(elm) { return getFloat($(elm).find('i.seckill_mod_goods_price_now').first().text()); } function getFloat(str) { str = str.replace('¥','').replace('¥','').trim(); if (!/^\d+\.?\d*$/.test(str)) return NaN; return parseFloat(str); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址