您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Use KanjiVG images instead of jpdb.io ones
当前为
// ==UserScript== // @name jpdb.io with KanjiVG // @description Use KanjiVG images instead of jpdb.io ones // @match https://jpdb.io/* // @license MIT // @grant GM_xmlhttpRequest // @version 0.0.1.20240529210550 // @namespace https://gf.qytechs.cn/users/1309172 // ==/UserScript== function getKanjiUnicodeHex(kanjiElement) { const hrefValue = kanjiElement.getAttribute('href'); const kanjiChar = hrefValue.split("/")[2][0]; return kanjiChar.charCodeAt(0).toString(16).toLowerCase().padStart(5, '0'); } function replaceKanji() { "use strict" const kanjiElement = document.querySelector('a.kanji.plain'); if (!kanjiElement) { return; } const kanjiUnicodeHex = getKanjiUnicodeHex(kanjiElement); const url = `https://raw.githubusercontent.com/KanjiVG/kanjivg/master/kanji/${kanjiUnicodeHex}.svg`; GM_xmlhttpRequest({ method: "GET", url: url, onload: function (response) { if (response.status != 200) { console.log(`KanjiVG: ${xhr.status}: ${xhr.statusText}`); return; } const newSVG = response.responseXML.getElementsByTagName("svg")[0]; newSVG.style.width = "300px"; newSVG.style.height = "300px"; const strokeNumbers = newSVG.getElementById(`kvg:StrokeNumbers_${kanjiUnicodeHex}`); strokeNumbers.style.fontSize = "6px"; // if dark theme if (document.firstElementChild.classList.contains("dark-mode")) { newSVG.getElementById(`kvg:StrokePaths_${kanjiUnicodeHex}`).style.stroke = "#aaaaaa"; strokeNumbers.style.fill = "#666666"; } kanjiElement.firstChild.replaceWith(newSVG); } }); } function main() { replaceKanji() // let observer = new MutationObserver(replaceKanji) // observer.observe(document.body, { // childList: true, // subtree: true, // }) } main();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址