eBay sponsored listings remover

Remove sponsored listings on ebay.*

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         eBay sponsored listings remover
// @namespace    B123
// @version      1.0
// @description  Remove sponsored listings on ebay.*
// @author       Bjorn Nilsson
// @match        https://www.ebay.*/*
// @run-at       document-start
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// ==/UserScript==
"use strict";

var removeSponsored = true;
const getSponsoredListings = function(inScope){
  return inScope.filter(function( index ) {
    var li = $(this)
    var sp_span = li.find("span[role='text'] > span");
    //console.log(sp_span);
    var res = sp_span.filter(function( index ) { 
      return $(this).is(':visible') && !!this.innerText.match(/[sponsored]/i) 
    } ).clone()
    //console.log($(res).text())
    return $(res).text().toLowerCase().includes("sponsored")                                           
  })
}

// $("section.b-listing > ul").find("li:has(div:contains('SPONSORED'))").css("border", "1px solid #F00")
$("section.b-listing > ul").find("li:has(div:contains('SPONSORED'))").remove();
var f_res = getSponsoredListings($("ul > li.s-item"))

if(removeSponsored){
  f_res.remove();
} else {
  f_res.css("border", "1px solid #F00");
}