zoukankan      html  css  js  c++  java
  • 油猴脚本-Tampermonkey-淘宝dsr过滤器(过滤非3红商品)

    作为一个经常买东西的人,上淘宝选商品也是一件麻烦事

    曾经做过淘宝,知道里面一些门路,那就是说dsr3红的商品,一般来说都会比三绿靠谱很多

    dsr是质量,服务,快递3个方向的评分,红色代表行业持平或者超过行业平均,都是买家打评分统计出来的

     所以过滤掉有绿色的商品,只要3红,能节省不少时间,也不容易买到差的商品

    首先就是分析红和绿是怎么个情况

    打开开发者模式,可以看到绿色的class是dsr lessthan,就是dsr低于行业平均,所以判断这个class就行

     商品列表也可以通过class来获取

     所以只要先获取这些item,然后一个个循环判断dsr是不是lessthan就行

    最后给绿色的item加上一个style,item.setAttribute('style', 'display: none !important');

    之前发现单独设置display:none无法过滤广告,要加一个import才能屏蔽

    效果如下,开启前

     开启后,需要等3秒钟(等待页面加载完成,会有弹窗提示)

    代码如下

    // ==UserScript==
    // @name         淘宝dsr过滤
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  try to take over the world!
    // @author       You
    // @include      *://s.taobao.com/*
    // @grant        none
    // ==/UserScript==
    
    
    
    (function() {
        'use strict';
        function Toast(msg,duration){
          duration=isNaN(duration)?3000:duration;
          var m = document.createElement('div');
          m.innerHTML = msg;
          m.style.cssText="max-60%;min- 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 10%;left: 90%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
          document.body.appendChild(m);
          setTimeout(function() {
            var d = 0.5;
            m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
            m.style.opacity = '0';
            setTimeout(function() { document.body.removeChild(m) }, d * 1000);
          }, duration);
        }
        setTimeout(function () {
            var items = document.getElementsByClassName('item J_MouserOnverReq');
            if(items.length > 0){
                for (let index = 0; index < items.length; index++) {
                    var item = items[index];
                    var dsrs = item.getElementsByClassName('dsr');
                    if(dsrs[0].getAttribute('class') == 'dsr lessthan'){
                        item.setAttribute('style', 'display: none !important');
                        continue
                    }
                    if(dsrs[1].getAttribute('class') == 'dsr lessthan'){
                        item.setAttribute('style', 'display: none !important');
                        continue
                    }
                    if(dsrs[2].getAttribute('class') == 'dsr lessthan'){
                        item.setAttribute('style', 'display: none !important');
                        continue
                    }
                }
            }
            Toast('过滤完成',2000);
        }, 3000);
    })();

    新建一个脚本,复制进去就行

  • 相关阅读:
    UVA.10325 The Lottery (组合数学 容斥原理 二进制枚举)
    UVA.11806 Cheerleaders (组合数学 容斥原理 二进制枚举)
    容斥原理、鸽巢原理快速入门
    HDU.1847 Good Luck in CET-4 Everybody! ( 博弈论 SG分析)
    HDU.1850 being a good boy in spring festival (博弈论 尼姆博弈)
    POJ.1067 取石子游戏 (博弈论 威佐夫博弈)
    HDU.2516 取石子游戏 (博弈论 斐波那契博弈)
    HDU.2147 kiki's game (博弈论 PN分析)
    Front Page
    2018-2019 9th BSUIR Open Programming Championship. Semifinal
  • 原文地址:https://www.cnblogs.com/darkspr/p/12874172.html
Copyright © 2011-2022 走看看