Forked from Gabrielcarvfer/gitlab_disable_issue_drawer_link_hijacking.js
Last active
July 30, 2026 20:05
-
-
Save chugcup/2c5b5a90c1c35b2bee479ae372effdfa to your computer and use it in GitHub Desktop.
Disable new GitLab issue drawer link hijacking
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 characters
| // ==UserScript== | |
| // @name Disable GitLab issues drawer | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.2 | |
| // @description Disable GitLab issues drawer | |
| // @author Gabriel Ferreira | |
| // @match https://gitlab.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| // Nuke every event listener that hijacks links in the new issues board... | |
| const observer = new MutationObserver((mutations, obs) => { | |
| const links = document.getElementsByClassName('gl-link'); | |
| if (links.length > 0) { | |
| obs.disconnect(); | |
| document.body.addEventListener('click', (e) => { | |
| const classes = [...e.srcElement.classList, ...e.srcElement.parentElement.classList, ...e.srcElement.parentElement.parentElement.classList, ...e.srcElement.parentElement.parentElement.parentElement.classList]; | |
| if(classes.some(test_class => test_class.includes("issue-clickable"))) | |
| { | |
| e.stopPropagation(); // prevents bubbling up | |
| e.stopImmediatePropagation(); // blocks other handlers on same element | |
| } | |
| }, true); | |
| obs.observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| }); | |
| } | |
| }); | |
| const url = window.location.pathname; | |
| if (/\/issues(?:\/|-\/|\/?$)(?!\d)/.test(url)) { | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| }); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment