Greasy Fork is available in English.

Clone in VSCode

Clone Github respository in VSCode

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Clone in VSCode
// @namespace    https://github.com/spacemeowx2
// @version      0.2
// @description  Clone Github respository in VSCode
// @author       space
// @match        https://github.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function createButton(actions, uri) {
        const li = document.createElement('li');
        const button = document.createElement('button');
        button.className = 'btn btn-sm'; // js-toggler-target
        button.innerText = 'Clone in VSCode';
        button.addEventListener('click', () => {
            location.href = `vscode://vscode.git/clone?url=${encodeURIComponent(uri)}`
        })
        li.append(button);
        actions.append(li);
    }
    function getGitUri() {
        const [emptyUri] = [...document.querySelectorAll('button.js-git-protocol-clone-url')].map(i => i.getAttribute('data-url')).filter(i => i.startsWith('git'))
        const [normalUri] = [...document.querySelectorAll('input[data-autoselect]')].map(i => i.value).filter(i => i.startsWith('git'))
        return emptyUri || normalUri
    }
    const actions = document.querySelector('.pagehead-actions')
    if (actions) {
        const uri = getGitUri();
        if (uri) {
            createButton(actions, uri);
        }
    }
})();