您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a button to XKCD comics next to the "Random" button which links to the explainxkcd for the current comic
// ==UserScript== // @name XKCD Explain Button // @namespace Violentmonkey Scripts // @match *://*.xkcd.com/* // @grant none // @version 1.0.1 // @author Jonah Lawrence - youtube.com/DevProTips // @description Add a button to XKCD comics next to the "Random" button which links to the explainxkcd for the current comic // ==/UserScript== // locate all of the "Random" buttons on the page Array.from(document.querySelectorAll(".comicNav a[href*='random']")).forEach(x => { // get the meta tag containing the fully qualified comic url and replace xkcd with explainxkcd let explainUrl = document.querySelector(".comicNav ~ a[href^='https://xkcd.com/']").href.replace("xkcd","explainxkcd") // insert a new item before the random button linking to the explainxkcd url x.parentElement.insertAdjacentHTML("beforeBegin",`<li><a href='${explainUrl}'>Explain</a></li>`) })
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址