Last active
August 8, 2022 16:30
-
-
Save ekho/a380a076d2f8b14383b0d32b8aed0f51 to your computer and use it in GitHub Desktop.
Youtrack long urls fix using tampermonkey
This file contains 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 characters
// ==UserScript== | |
// @name Fix youtrack long urls | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description Youtrack long urls fix using tampermonkey | |
// @author Boris Gorbylev <[email protected]> | |
// @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