Skip to content

Instantly share code, notes, and snippets.

@ekho
Last active August 8, 2022 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekho/a380a076d2f8b14383b0d32b8aed0f51 to your computer and use it in GitHub Desktop.
Save ekho/a380a076d2f8b14383b0d32b8aed0f51 to your computer and use it in GitHub Desktop.
Youtrack long urls fix using tampermonkey
// ==UserScript==
// @name Fix youtrack long urls
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Youtrack long urls fix using tampermonkey
// @author Boris Gorbylev <ekho@ekho.name>
// @match https://youtrack.*
// @match https://youtrack.admit.ad/*
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/YouTrack_Icon.svg/240px-YouTrack_Icon.svg.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
const hre = new RegExp(`^(${document.location.protocol}//${document.location.hostname.replace('.', '\\.')}/issue/\\w+-\\d+)/.+`, 'i');
window.setInterval(() => {
[...document.getElementsByTagName('a')].filter((a) => a.href.match(hre)).forEach((a) => {
a.href = a.href.match(hre)[1];
});
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment