Greasy Fork

Greasy Fork is available in English.

ebay sponsored listings remover

Remove sponsored listings on ebay

当前为 2022-04-16 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         ebay sponsored listings remover
// @namespace    errantmind
// @version      0.51
// @author       errant
// @description  Remove sponsored listings on ebay
// @include      *://www.ebay.*/*
// @run-at       document-end
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @grant        none
// @license      MIT
// ==/UserScript==
"use strict";

$('.s-item').each(function(i, obj) {
  var findResult = $(this).find(".s-item__sep * span");
  if (findResult.length > 0) {
    //console.log("Child elements matched: " + findResult.length);
    //console.log(findResult);
    for (var i = 0; i < findResult.length; i++) {      
      if (findResult[i].style.display !== 'none'  ) {
        var inner_text = findResult[i].innerText;
        //inner_text = inner_text.replace(/[\u0000-\u001F\u007F-\u009F]/g, "");
        inner_text = inner_text.replace(/[^\x00-\x7F]/g, "");
        inner_text = inner_text.toLowerCase().trim();
          
        if(inner_text.length == 1) {
          var display = window.getComputedStyle(findResult[i], null).getPropertyValue("display");
          //console.log("display: " + display);
          //console.log(inner_text + " len " + inner_text.length);
          if(display !== 'none') {
            (this).remove();
            return;
          }
        }
      }
    }        
  } else {
      //console.log("Object " + i + " DOES NOT CONTAIN sponsored");
  }
});