您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
In search result listing, detect which items are sponsored and mark them with a red outline and opacity
当前为
// ==UserScript== // @name ebay - Mark sponsored item // @namespace https://github.com/Procyon-b // @version 0.1 // @description In search result listing, detect which items are sponsored and mark them with a red outline and opacity // @author Achernar // @match https://www.ebay.com/* // @run-at document-start // @grant none // ==/UserScript== (function() { "use strict"; var cfg={childList:true, subtree:true}, obs=new MutationObserver(function(mutL){ //console.info({mutL}); for(let mut of mutL) { if (mut.target && (mut.target.id == 'srp-river-main') ) { fix(mut.target); return; } } }); obs.observe(document, cfg); function isIn(e) { var p=e.closest('li'); var re = e.getBoundingClientRect(); var rp = p.getBoundingClientRect(); //console.info( re.top >= rp.top , re.left >= rp.left , re.bottom <= rp.bottom , re.right <= rp.right ); return (re.top >= rp.top) && (re.left >= rp.left) && (re.bottom <= rp.bottom) && (re.right <= rp.right); } function fix(r=document) { r.querySelectorAll('li .s-item__details-section--primary > .s-item__detail--primary:last-child span[role="text"] div[aria-hidden="true"]').forEach( function(x){ var R=isIn(x); //console.info(R); if (R) { x.closest('li').style='outline: 2px solid red; opacity: .4;'; } }); } })();