Last active
January 15, 2022 20:07
-
-
Save DV8FromTheWorld/b0bfc2bfbeb4b10e581e66154599ccc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
/* Finds the "Viewed" button for each file, selecting only ones marked as already viewed */ | |
const allViewedFiles = Array.from(document.querySelectorAll('[data-ga-click="File viewed, click, value:true"]')); | |
/* Iterates through the viewed files and closes any that are still open. */ | |
const allOpenViewedFiles = allViewedFiles.forEach(viewedButton => { | |
const fileContainer = viewedButton.closest('.js-details-container'); | |
if (fileContainer.classList.contains('open')) { | |
const collapseButton = fileContainer.querySelector('.js-details-target'); | |
collapseButton.click(); | |
} | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make the URL for a bookmark be:
javascript: <code>
Simply click the bookmark to collapse all PR files that have already been viewed.