Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.