Auto Dismiss GitLab Auto DevOps Alert

Automatically dismisses the "Auto DevOps" alert on GitLab

  1. // ==UserScript==
  2. // @name Auto Dismiss GitLab Auto DevOps Alert
  3. // @namespace https://gitlab.com
  4. // @version 1.0
  5. // @description Automatically dismisses the "Auto DevOps" alert on GitLab
  6. // @author Sam Artuso <sam@highoctanedev.co.uk>
  7. // @match *://gitlab.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function dismissAlert() {
  16. let button = document.querySelector('[aria-label="Dismiss Auto DevOps box"]');
  17. if (button) {
  18. console.log('Auto DevOps alert found! Dismissing it...');
  19. button.click();
  20. } else {
  21. console.log('No Auto DevOps alert found.');
  22. }
  23. }
  24.  
  25. // Run the function after page load
  26. window.addEventListener('load', () => {
  27. setTimeout(dismissAlert, 2000); // Delay to allow GitLab to render elements
  28. });
  29.  
  30. // Also run periodically in case the alert appears later (SPA handling)
  31. let observer = new MutationObserver(() => dismissAlert());
  32. observer.observe(document.body, { childList: true, subtree: true });
  33. })();

QingJ © 2025

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