Skip to content

Instantly share code, notes, and snippets.

@luelista
Created February 5, 2024 09:49
Show Gist options
  • Save luelista/a7d86c3a03404beab7611b4dc04072ac to your computer and use it in GitHub Desktop.
Save luelista/a7d86c3a03404beab7611b4dc04072ac to your computer and use it in GitHub Desktop.
github/gitlab jetbrains nav (click on the "Raw" button to install)
// ==UserScript==
// @name github/gitlab jetbrains nav
// @author Mira
// @version 1
// @grant GM.xmlHttpRequest
// @match https://github.com/*
// @match https://gitlab.com/*
// ==/UserScript==
/***********************************************************************
*
* tested with the greasemonkey extension on firefox
* https://addons.mozilla.org/de/firefox/addon/greasemonkey/
*
* this needs the "IDE Remote Control" plugin in your jetbrains IDE
* https://plugins.jetbrains.com/plugin/19991-ide-remote-control
*
* optionally add additional "// @match" lines with your own
* gitlab instance
*
***********************************************************************/
document.body.addEventListener("click",function(e) {
var linum = e.target.closest("[data-line-number]");
if (linum && e.altKey) {
e.stopPropagation();
e.preventDefault();
var lineNumber = linum.getAttribute("data-line-number");
var file = linum.closest(".file, details");
var fileName = file.querySelector(".Link--primary").innerText;
GM.xmlHttpRequest({
method: 'GET',
url: "http://localhost:63342/api/file/" + fileName + ":" + lineNumber,
headers: {
Origin: 'https://github.com'
}
});
}
var linum = e.target.closest("[data-linenumber]");
if (linum && e.altKey) {
e.stopPropagation();
e.preventDefault();
var lineNumber = linum.getAttribute("data-linenumber");
var file = linum.closest(".file-holder");
var fileName = file.querySelector(".file-title-name").innerText;
GM.xmlHttpRequest({
method: 'GET',
url: "http://localhost:63342/api/file/" + fileName + ":" + lineNumber,
headers: {
Origin: 'https://github.com'
}
});
}
},true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment