Greasy Fork 还支持 简体中文。

github助手

github助手 | 按alt + x 快捷复制克隆地址 |

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         github助手
// @namespace    https://github.com/Twtcer
// @version      0.0.1
// @match        https://github.com/*
// @description  github助手 | 按alt + x 快捷复制克隆地址 |
// @author       Twtcer
// @grant        GM_setClipboard
// @license     MIT
// ==/UserScript==

(function() {
    'use strict';
      document.onkeydown = function(e) {
              if (e.keyCode == 88 && e.altKey) {
                  //console.log(`url: ${window.location.href}`);
                  let url = window.location.href;
                  let github = 'https://github.com/';
                  let arr = url.replace(github,'').split('/');

                  if(arr.length > 0) {
                      let userName = arr[0];
                      let repo = arr[1];
                      let projectUrl = `${github}${userName}/${repo}`;
                      let cloneUrl = `git clone ${projectUrl}`;
                      GM_setClipboard(cloneUrl,'{ type: ‘text’, mimetype: ‘text/plain’}'); 
                  }
              }
      }


})();