GitHub to DeepWiki Button

Adds a button to GitHub pages to open the corresponding page on DeepWiki.

2025-04-27 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         GitHub to DeepWiki Button
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Adds a button to GitHub pages to open the corresponding page on DeepWiki.
// @author       You
// @match        https://github.com/*/*
// @icon         https://www.google.com/as2/favicons?sz=64&domain=github.com
// @grant        none
// @license MIT
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';
    function addButton() {
        const actionsList = document.querySelector('.AppHeader-actions');

        if (!actionsList) {
            return false;
        }

        if (document.getElementById('deepwiki-button')) {
            return true;
        }

        const button = document.createElement('button');
        button.textContent = 'Open in DeepWiki';
        button.id = 'deepwiki-button';
        button.type = 'button';

        button.classList.add('btn', 'btn-sm');
        button.addEventListener('click', function() {
            const deepwikiUrl = window.location.href.replace('github.com', 'deepwiki.com');
            window.open(deepwikiUrl, '_blank');
        });
        actionsList.appendChild(button);
        console.log('Tampermonkey - GitHub to DeepWiki: Button added successfully.');
        return true;
    }

    if (!addButton()) {

        const retryInterval = setInterval(() => {
            if (addButton()) {
                clearInterval(retryInterval);
            }
        }, 500);
        setTimeout(() => {
            clearInterval(retryInterval);

            if (!document.getElementById('deepwiki-button')) {
                console.warn('Tampermonkey - GitHub to DeepWiki: Failed to add button after multiple retries.');
            }
        }, 5000);
    }
})();