Skip to content

Instantly share code, notes, and snippets.

@himedlooff
Created October 10, 2019 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himedlooff/78512978a324ae6c40c701016e958f9b to your computer and use it in GitHub Desktop.
Save himedlooff/78512978a324ae6c40c701016e958f9b to your computer and use it in GitHub Desktop.
When you have a lot of files to mark as viewed and you don't want to click them all...
function clickFileViewedViaRegex(regex, markAsViewed = true) {
document.querySelectorAll('.file').forEach((item) => {
if (item.querySelector('.file-header a[title]').getAttribute('title').match(regex)) {
var checkbox = item.querySelector('.js-reviewed-checkbox');
if (markAsViewed && !checkbox.checked) checkbox.click();
if (!markAsViewed && checkbox.checked) checkbox.click();
}
});
}
// example
// clickFileViewedViaRegex(/my-folder\/[a-z-]+\.css/, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment