Skip to content
Snippets Groups Projects

[Tampermonkey] Collapse GitLab Maintenance Banner

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Marius Politze

    Instructions:

    License: CC0-1.0

    Edited
    removeBanner.js 1.49 KiB
    // ==UserScript==
    // @name         Collapse GitLab Maintenance Banner
    // @namespace    http://git.rwth-aachen.de/mpolitze
    // @version      0.3
    // @author       mpolitze
    // @match        https://git.rwth-aachen.de/*
    // @grant        none
    // @updateUrl    https://git.rwth-aachen.de/-/snippets/954/raw/master/removeBanner.js?inline=false
    // @downloadUrl  https://git.rwth-aachen.de/-/snippets/954/raw/master/removeBanner.js?inline=false
    // ==/UserScript==
    
    'use strict';
    (function() {
        let css = `
        .broadcast-message{
            position: absolute;
            width: 23px;
            height: 23px;
            top: 52px;
            z-index: 1000;
            padding: 1px;
            overflow: hidden;
            border-radius: 50%;
            right: 15px;
            transition: width 0.15s, height 0.15s, border-radius 0.15s!important;
        }
        .broadcast-message:hover{
            width: 200px;
            height: 200px;
            border-radius: 2%;
        }`;
        function addGlobalStyle(css) {
            let head = document.getElementsByTagName('head')[0];
            if (!head) { return; }
            let style = document.createElement('style');
            style.type = 'text/css';
            style.innerHTML = css;
            head.appendChild(style);
        }
    
        addGlobalStyle(css);
    
        setTimeout(() => {
            console.log('xxx');
            let banners = document.getElementsByClassName('broadcast-message');
            let n=0;
            for(let b of banners){
                b.style.right = `${15+(n++)*25}px`;
                b.style.zIndex = 1000-n;
            }
        },1000);
    })();
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment