您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides sponsored "you may also like" links from autotrader
// ==UserScript== // @name Autotrader UK No Sponsored Listings // @namespace https://autotrader.co.uk // @version 2024-06-02 // @description Hides sponsored "you may also like" links from autotrader // @author rbutera // @license MIT // @match https://www.autotrader.co.uk/* // @icon https://www.google.com/s2/favicons?sz=64&domain=autotrader.co.uk // @grant none // ==/UserScript== (function() { 'use strict'; // Function to hide the targeted <li> elements function hideYouMayAlsoLikeElements() { // Select all <li> elements const listItems = document.querySelectorAll('li'); // Iterate through the list items listItems.forEach((li) => { // Check if the first child of <li> is a <section> if (li.firstElementChild && li.firstElementChild.tagName === 'SECTION') { // Check if the <section> contains a <span> with the text 'You may also like' const section = li.firstElementChild; const span = section.querySelector('span'); if (span && span.textContent.trim() === 'You may also like') { // Hide the <li> element li.style.display = 'none'; } } }); } // Run the function on page load window.addEventListener('load', hideYouMayAlsoLikeElements); // Optionally, run the function periodically to handle dynamically loaded content setInterval(hideYouMayAlsoLikeElements, 1000); })();