您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Highlight file type labels in Google search results
当前为
// ==UserScript== // @name Highlight file types // @name:ja ファイルの種類を強調表示 // @namespace https://gf.qytechs.cn/users/783910 // @version 0.3.1 // @description Highlight file type labels in Google search results // @description:ja Google検索結果でファイルの種類ラベルを強調表示する // @author ysnr777 // @match https://www.google.com/search?* // @grant none // @license MIT // ==/UserScript== const fileSettings = { PDF: { title: 'Adobe Portable Document Format (.pdf)', background: '#FDE3E4', color: '#EC1C24', iconSlug: 'adobeacrobatreader', }, XLS: { title: 'Microsoft Excel (.xls, .xlsx)', background: '#E9F9F0', color: '#217346', iconSlug: 'microsoftexcel', }, DOC: { title: 'Microsoft Word (.doc, .docx)', background: '#E1EAF7', color: '#2B579A', iconSlug: 'microsoftword', }, PPT: { title: 'Microsoft PowerPoint (.ppt, .pptx)', background: '#F9EAE7', color: '#B7472A', iconSlug: 'microsoftpowerpoint', }, KML: { title: 'Google Earth (.kml, .kmz)', background: '#E9F1FE', color: '#4285F4', iconSlug: 'googleearth', }, default: { background: '#FFFF99', color: '#4D5156', }, }; (function () { 'use strict'; for (const el of document.querySelectorAll('span.ZGwO7.C0kchf.NaCKVc.VDgVie')) { const setting = fileSettings[el.textContent in fileSettings ? el.textContent : 'default']; // style el.style.fontWeight = 'bold'; el.style.backgroundColor = setting.background; el.style.borderColor = setting.color; el.style.color = setting.color; // title if ('title' in setting) { el.title = setting.title; } // icon if ('iconSlug' in setting) { // CDNからSVGを文字列で取得 const xhr = new XMLHttpRequest(); xhr.open('GET', `https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/${setting.iconSlug}.svg`, true); xhr.onload = function () { // 取得したSVG文字列を要素に変換して追加 const span = document.createElement('span'); const svg = span.appendChild(xhr.responseXML.querySelector('svg')); // 不要なtitle要素を削除 svg.querySelector('title').remove(); // style span.style.marginRight = '0.5em'; svg.style.height = '1em'; svg.style.fill = setting.color; el.prepend(span); }; xhr.send(); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址