Skip to content

Instantly share code, notes, and snippets.

@rdkr
Last active June 13, 2022 15:12
Show Gist options
  • Save rdkr/e3201334128310b194e345ee9278b7c6 to your computer and use it in GitHub Desktop.
Save rdkr/e3201334128310b194e345ee9278b7c6 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name clean-gitlab-sidebar
// @namespace http://tampermonkey.net/
// @version 0.1
// @description only show some things in gitlab sidebar, and expand the rest
// @author [email protected]
// @match https://<GITLAB_URL>/*
// ==/UserScript==
(function() {
'use strict';
var activate = ['repository_menu', 'ci_cd_menu', 'deployments_menu', 'packages_registries_menu']
var hide = ['project_information_menu',
'contributors',
'graphs',
'file_locks',
'feature_flags',
'security_compliance_menu',
'releases',
'monitor_menu',
'infrastructure_menu',
'analytics_menu',
'snippets_menu',
'packages_registry',
'infrastructure_registry'
]
$('.sidebar-top-level-items > li').each(function() {
if (activate.includes($(this).attr('data-track-label'))) {
$(this).addClass("active");
}
});
$('.sidebar-top-level-items').find('li').each(function() {
if (hide.includes($(this).attr('data-track-label'))) {
$(this).hide();
}
});
})();
@rdkr
Copy link
Author

rdkr commented Jun 13, 2022

This script need to change its name to tampermonkey-clean-gitlab-sidebar.user.js to get noticed as a user script by Tampermonkey. Just add a .user suffix in the name of the js script is OK.

i didn't know about that - i'll update it. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment