Auto Dismiss GitLab Auto DevOps Alert

Automatically dismisses the "Auto DevOps" alert on GitLab

// ==UserScript==
// @name         Auto Dismiss GitLab Auto DevOps Alert
// @namespace    https://gitlab.com
// @version      1.0
// @description  Automatically dismisses the "Auto DevOps" alert on GitLab
// @author       Sam Artuso <[email protected]>
// @match        *://gitlab.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function dismissAlert() {
        let button = document.querySelector('[aria-label="Dismiss Auto DevOps box"]');
        if (button) {
            console.log('Auto DevOps alert found! Dismissing it...');
            button.click();
        } else {
            console.log('No Auto DevOps alert found.');
        }
    }

    // Run the function after page load
    window.addEventListener('load', () => {
        setTimeout(dismissAlert, 2000); // Delay to allow GitLab to render elements
    });

    // Also run periodically in case the alert appears later (SPA handling)
    let observer = new MutationObserver(() => dismissAlert());
    observer.observe(document.body, { childList: true, subtree: true });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址