DeepWiki

Add a button to open the corresponding wiki page on DeepWiki

目前為 2025-04-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name         DeepWiki
// @namespace    https://github.com/AmintaCCCP/
// @version      1.0
// @description  Add a button to open the corresponding wiki page on DeepWiki
// @author       tamina
// @match        https://github.com/*
// @icon         data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22133.34%22%20height%3D%22128%22%20viewBox%3D%220%200%2025%2024%22%3E%3Cpath%20fill%3D%22currentColor%22%20d%3D%22M12.301%200h.093c2.242%200%204.34.613%206.137%201.68l-.055-.031a12.35%2012.35%200%200%201%204.449%204.422l.031.058a12.2%2012.2%200%200%201%201.654%206.166c0%205.406-3.483%2010-8.327%2011.658l-.087.026a.72.72%200%200%201-.642-.113l.002.001a.62.62%200%200%201-.208-.466v-.014v.001l.008-1.226q.008-1.178.008-2.154a2.84%202.84%200%200%200-.833-2.274a11%2011%200%200%200%201.718-.305l-.076.017a6.5%206.5%200%200%200%201.537-.642l-.031.017a4.5%204.5%200%200%200%201.292-1.058l.006-.007a4.9%204.9%200%200%200%20.84-1.645l.009-.035a7.9%207.9%200%200%200%20.329-2.281l-.001-.136v.007l.001-.072a4.73%204.73%200%200%200-1.269-3.23l.003.003c.168-.44.265-.948.265-1.479a4.25%204.25%200%200%200-.404-1.814l.011.026a2.1%202.1%200%200%200-1.31.181l.012-.005a8.6%208.6%200%200%200-1.512.726l.038-.022l-.609.384c-.922-.264-1.981-.416-3.075-.416s-2.153.152-3.157.436l.081-.02q-.256-.176-.681-.433a9%209%200%200%200-1.272-.595l-.066-.022A2.17%202.17%200%200%200%205.837%205.1l.013-.002a4.2%204.2%200%200%200-.393%201.788c0%20.531.097%201.04.275%201.509l-.01-.029a4.72%204.72%200%200%200-1.265%203.303v-.004l-.001.13c0%20.809.12%201.591.344%202.327l-.015-.057c.189.643.476%201.202.85%201.693l-.009-.013a4.4%204.4%200%200%200%201.267%201.062l.022.011c.432.252.933.465%201.46.614l.046.011c.466.125%201.024.227%201.595.284l.046.004c-.431.428-.718%201-.784%201.638l-.001.012a3%203%200%200%201-.699.236l-.021.004c-.256.051-.549.08-.85.08h-.066h.003a1.9%201.9%200%200%201-1.055-.348l.006.004a2.84%202.84%200%200%201-.881-.986l-.007-.015a2.6%202.6%200%200%200-.768-.827l-.009-.006a2.3%202.3%200%200%200-.776-.38l-.016-.004l-.32-.048a1.05%201.05%200%200%200-.471.074l.007-.003q-.128.072-.08.184q.058.128.145.225l-.001-.001q.092.108.205.19l.003.002l.112.08c.283.148.516.354.693.603l.004.006c.191.237.359.505.494.792l.01.024l.16.368c.135.402.38.738.7.981l.005.004c.3.234.662.402%201.057.478l.016.002c.33.064.714.104%201.106.112h.007q.069.002.15.002q.392%200%20.767-.062l-.027.004l.368-.064q0%20.609.008%201.418t.008.873v.014c0%20.185-.08.351-.208.466h-.001a.72.72%200%200%201-.645.111l.005.001C3.486%2022.286.006%2017.692.006%2012.285c0-2.268.612-4.393%201.681-6.219l-.032.058a12.35%2012.35%200%200%201%204.422-4.449l.058-.031a11.9%2011.9%200%200%201%206.073-1.645h.098h-.005zm-7.64%2017.666q.048-.112-.112-.192q-.16-.048-.208.032q-.048.112.112.192q.144.096.208-.032m.497.545q.112-.08-.032-.256q-.16-.144-.256-.048q-.112.08.032.256q.159.157.256.047zm.48.72q.144-.112%200-.304q-.128-.208-.272-.096q-.144.08%200%20.288t.272.112m.672.673q.128-.128-.064-.304q-.192-.192-.32-.048q-.144.128.064.304q.192.192.32.044zm.913.4q.048-.176-.208-.256q-.24-.064-.304.112t.208.24q.24.097.304-.096m1.009.08q0-.208-.272-.176q-.256%200-.256.176q0%20.208.272.176q.256.001.256-.175zm.929-.16q-.032-.176-.288-.144q-.256.048-.224.24t.288.128t.225-.224z%22%2F%3E%3C%2Fsvg%3E

// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function addWikiButton() {
        // Check if we're on a repository page
        const repoPath = window.location.pathname.match(/^\/([^/]+)\/([^/]+)(?:\/|$)/);
        if (repoPath) {
            // Get the username and repository name from the URL
            const username = repoPath[1];
            const repo = repoPath[2];

            // Create the wiki button
            const wikiButton = document.createElement('a');
            wikiButton.classList.add('btn', 'btn-sm', 'btn-outline', 'ml-2');
            wikiButton.style.position = 'fixed';
            wikiButton.style.bottom = '20px';
            wikiButton.style.right = '20px';
            wikiButton.style.zIndex = '9999';
            wikiButton.href = `https://deepwiki.com/${username}/${repo}`;
            wikiButton.target = '_blank';
            wikiButton.title = 'Open Wiki on DeepWiki';

            // Add the Emoji light bulb icon
            wikiButton.textContent = '💡';

            // Append the button to the page
            const repoHeader = document.querySelector('.BorderGrid-cell');
            if (repoHeader) {
                repoHeader.appendChild(wikiButton);
            } else {
                document.body.appendChild(wikiButton);
            }
        }
    }

    // Add the wiki button when the page loads
    window.addEventListener('load', addWikiButton);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址