Inspired by https://en.wikipedia.org/wiki/User:NQ/WatchlistResetConfirm.js which adds a confirmation button, and then updates the watchlist using ajax instead of requiring a page reload.
So we should add a OO.ui.confirm dialog when the button is pressed, then submit an ajax request to the MW API, and finally update the CSS classes to mark all the pages as visited. This will all be done in JavaScript.