您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Displays the favicon of scripts.
当前为
// ==UserScript== // @name Greasyfork/Sleazyfork Script Icon Display // @description Displays the favicon of scripts. // @icon https://greasyfork.runtimutd.eu.org/vite/assets/blacklogo96-CxYTSM_T.png // @version 1.0 // @author afkarxyz // @namespace https://github.com/afkarxyz/misc-scripts/ // @supportURL https://github.com/afkarxyz/misc-scripts/issues // @license MIT // @match https://greasyfork.runtimutd.eu.org/*/scripts/* // @match https://sleazyfork.org/*/scripts/* // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; function addIconToHeader() { const firstListItem = document.querySelector('.script-show-applies-to .block-list li:first-child'); const h2Element = document.querySelector('header h2'); if (!firstListItem || !h2Element || h2Element.querySelector('img')) return false; const domain = (firstListItem.querySelector('a')?.textContent || firstListItem.textContent).trim(); if (!domain) return false; h2Element.style.cssText = 'display:flex;align-items:center;margin:0'; const iconImg = document.createElement('img'); iconImg.src = `https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://${domain}&size=64`; iconImg.style.cssText = 'width:32px;height:32px;margin-right:10px;flex-shrink:0'; h2Element.replaceChildren(iconImg, document.createElement('span').appendChild(document.createTextNode(h2Element.textContent)).parentNode); return true; } function init(attempts = 10) { if (addIconToHeader() || attempts < 1) return; setTimeout(() => init(attempts - 1), 50); } document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', () => init()) : init(); new MutationObserver(() => init(5)).observe(document.documentElement, { childList: true, subtree: true }); })();