您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动在 GitHub 仓库页面添加"一键 DeepWiki"按钮,方便您在代码和知识库之间快速切换。
// ==UserScript== // @name 一键DeepWiki // @namespace http://ilxdh.com/ // @version 1.0.1 // @author longxuan // @description 自动在 GitHub 仓库页面添加"一键 DeepWiki"按钮,方便您在代码和知识库之间快速切换。 // @license MIT // @icon https://deepwiki.com/favicon.ico // @match *://*.github.com/* // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js // @grant GM_addStyle // ==/UserScript== (e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const t=document.createElement("style");t.textContent=e,document.head.append(t)})(' .deepwiki-btn{margin-left:10px;background-color:#dc3545;color:#fff;border:1px solid #dc3545;border-radius:6px;padding:5px 16px;font-size:14px;font-weight:500;cursor:pointer;text-decoration:none;display:inline-block;transition:all .2s ease;position:relative;overflow:hidden;box-shadow:0 2px 4px #dc354533}.deepwiki-btn:hover{background-color:#c82333;color:#fff;text-decoration:none;transform:translateY(-1px);box-shadow:0 4px 8px #dc35454d}.deepwiki-btn:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);transition:left .5s ease}.deepwiki-btn:hover:before{left:100%}.deepwiki-btn:active{transform:translateY(0);box-shadow:0 2px 4px #dc354533} '); (function ($) { 'use strict'; let retryCount = 0; const MAX_RETRY = 8; function createDeepWikiButton() { const $repoTitle = $("#repo-title-component"); if ($repoTitle.length > 0) { if ($repoTitle.find(".deepwiki-btn").length > 0) { return; } try { const curUrl = window.location.href; const newUrl = curUrl.replace("github.com", "deepwiki.com"); const $link = $("<a></a>").text("一键 DeepWiki").attr("href", newUrl).attr("target", "_blank").addClass("deepwiki-btn"); $repoTitle.append($link); retryCount = 0; } catch (error) { console.error("创建DeepWiki按钮时出错:", error); } } else if (retryCount < MAX_RETRY) { retryCount++; setTimeout(createDeepWikiButton, 2e3); } else { console.warn(`超过最大重试次数(${MAX_RETRY}),停止尝试创建DeepWiki按钮`); } } function observePageChanges() { const observer = new MutationObserver((mutations) => { let shouldCheck = false; mutations.forEach((mutation) => { if (mutation.type === "childList" && mutation.addedNodes.length > 0) { for (const node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE) { if (node.querySelector && node.querySelector("#repo-title-component")) { shouldCheck = true; break; } } } } }); if (shouldCheck) { setTimeout(() => { retryCount = 0; createDeepWikiButton(); }, 200); } }); observer.observe(document.body, { childList: true, subtree: true }); } $(document).ready(() => { createDeepWikiButton(); observePageChanges(); }); })(jQuery);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址