Created
April 1, 2021 06:33
-
-
Save Fog3211/11d7d654d1531fce4a63ea0ee57c8e3c to your computer and use it in GitHub Desktop.
Revisions
-
Fog3211 created this gist
Apr 1, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ // ==UserScript== // @name gitlab download // @namespace http://tampermonkey.net/ // @version 0.1 // @description 在gitlab中使用github desktop下载代码 // @author Fog3211 // @match *://gitlab.com/* // @icon https://about.gitlab.com/ico/favicon.ico // @grant none // ==/UserScript== (function () { 'use strict'; const gitCloneContainer = document.querySelectorAll('.git-clone-holder')[0] if (gitCloneContainer) { const GitLinkLists = [...gitCloneContainer.querySelectorAll('.input-group-btn .dropdown-menu li a')] if (GitLinkLists.length >= 2) { const targetLink = `x-github-client://openRepo/${GitLinkLists[1].href.replace('.git','')}` gitCloneContainer.innerHTML += ` <div class="input-group-btn" style="margin-left:10px;"> <button class="btn btn-clipboard" data-clipboard-target="#project_clone" type="button"> <a href="${targetLink}">使用GitHub Desktop下载</a> </button> </div> ` } } })();