您需要先安装一个扩展,例如 篡改猴、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.2 // @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.NaCKVc')) { const type = el.textContent; const setting = type in fileSettings ? fileSettings[type] : fileSettings.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 req = new XMLHttpRequest(); req.onreadystatechange = function () { if (req.readyState === 4 && req.status == 200) { // 取得したSVG文字列を要素に変換 const span = document.createElement('span'); const svg = req.responseXML.querySelector('svg'); svg.querySelector('title').remove(); span.append(svg); // style span.style.marginRight = '0.5em'; svg.style.height = '1em'; svg.style.fill = setting.color; el.prepend(span); } }; req.open('GET', 'https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/' + setting.iconSlug + '.svg', true); req.send(null); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址