Skip to content

Instantly share code, notes, and snippets.

@pyronaur
Created December 10, 2020 16:42
Show Gist options
  • Select an option

  • Save pyronaur/5649c6167904324f792b0c31d7ffa3b0 to your computer and use it in GitHub Desktop.

Select an option

Save pyronaur/5649c6167904324f792b0c31d7ffa3b0 to your computer and use it in GitHub Desktop.

Revisions

  1. pyronaur created this gist Dec 10, 2020.
    25 changes: 25 additions & 0 deletions userscript.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    // ==UserScript==
    // @name Clear CI Activity Notification
    // @version 1.0.0
    // @grant none
    // @match https://github.com/notifications
    // ==/UserScript==

    const notifications = document.querySelectorAll('.notifications-list-item')
    const ciNotifications = Array.from(notifications).filter( (el) => {
    return el.querySelector('div > div > span').innerText === "ci activity"
    }, [])

    if( ciNotifications.length === 0 ) {
    return;
    }


    ciNotifications.forEach( (el) => {
    el.querySelector('input[type=checkbox]').click()
    })


    setTimeout( () => {
    document.querySelector('button[title="Done"]').click()
    }, 200)