您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replaces Anonymous view with duckduckgo.com icons
// ==UserScript== // @name Faviconize Startpage.com // @namespace http://tampermonkey.net/ // @version 2024-03-13 // @license MIT // @description Replaces Anonymous view with duckduckgo.com icons // @author Retro // @match *://*.startpage.com/* // @icon https://icons.duckduckgo.com/ip3/startpage.com.ico // @grant GM_xmlhttpRequest // @connect icons.duckduckgo.com // ==/UserScript== /* jshint esversion: 8 */ async function asyncRequest(options) { return new Promise((res, rej) => { options.onload = res options.onabort = rej options.onerror = rej options.ontimeout = rej GM_xmlhttpRequest(options) }) } async function asyncReadAsDataURL(blob) { return new Promise((res, rej) => { const reader = new FileReader() reader.onload = () => res(reader.result) reader.onerror = rej reader.readAsDataURL(blob) }) } function getElementsFromList(root, list) { return list.reduce((r, v) => r.concat(Array.from(root.getElementsByClassName(v))), []) } // Replace anonymous view with favicons async function injectFavicon(container, favicon_url) { let res = await asyncRequest({ method: "GET", url: favicon_url, anonymous: true, responseType: "blob", }) let favicon = document.createElement("img") favicon.src = await asyncReadAsDataURL(res.response) favicon.loading = "lazy" favicon.width = 16 favicon.height = 16 favicon.style.marginRight = "0.5em" let upper = getElementsFromList(container, ["upper", "w-gl__result-url-container"])[0] upper.children[0].remove() // remove anonymous view button upper.prepend(favicon) // prepend our favicon :) } const FAVICON_URL = "https://icons.duckduckgo.com/ip3/?.ico" let urls = getElementsFromList(document, ["result", "w-gl__result__main"]) for (const container of urls) { let link = container.getElementsByClassName("result-link")[0].href let host = new URL(link).host injectFavicon(container, FAVICON_URL.replace("?", host)) }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址