Skip to content

Instantly share code, notes, and snippets.

@lhns
Created February 16, 2022 15:15
Show Gist options
  • Save lhns/49f6cd1dcc086d8d1d0df49dcc1ad758 to your computer and use it in GitHub Desktop.
Save lhns/49f6cd1dcc086d8d1d0df49dcc1ad758 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GitLab: Open with GitHub Desktop
// @namespace http://tampermonkey.net/
// @version 0.1
// @description
// @match https://gitlab.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const label='GitHub Desktop'
const html = `<a class="dropdown-item open-with-link"><div class="gl-new-dropdown-item-text-wrapper">${label}</div></a>`
const elem = new DOMParser().parseFromString(html, 'text/html').body.children[0];
elem.href = "x-github-client://openRepo/" + document.getElementsByName('http_project_clone')[0].value;
document.evaluate("//label[contains(text(),'Open in your IDE')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.parentNode.appendChild(elem);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment