Skip to content

Instantly share code, notes, and snippets.

@thomasmb
Created June 16, 2021 13:50
Show Gist options
  • Save thomasmb/f6f8c089f534058c10e3145737f50b7b to your computer and use it in GitHub Desktop.
Save thomasmb/f6f8c089f534058c10e3145737f50b7b to your computer and use it in GitHub Desktop.
A JS snippet you can run on the Digital Ocean notification page to read all notifications. Start it off by running the start_processing() function
var interval;
function start_processing(){
interval = setInterval( open_notifications, 1000 );
}
function open_notifications(){
let notifications = document.querySelectorAll('.notification-listing .notification-row:not(.acknowledged) .action');
if( !notifications.length ) {
clearInterval( interval );
console.log('Done with this page');
go_to_next_page();
return;
}
console.log('click');
notifications[0].click();
}
function go_to_next_page(){
let pagination = document.querySelector('.notification-listing + .Pagination');
let next_page = pagination.querySelector('.is-active + .page');
if( !next_page ) {
console.log( 'All done!' );
}
console.log( 'Going to the next page' );
next_page.click();
setTimeout( start_processing, 2000 )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment