Skip to content

Instantly share code, notes, and snippets.

@feimosi
Created October 23, 2017 07:19
Show Gist options
  • Save feimosi/bb015d4d1f131ac07141bd2913745ee1 to your computer and use it in GitHub Desktop.
Save feimosi/bb015d4d1f131ac07141bd2913745ee1 to your computer and use it in GitHub Desktop.
[Tampermonkey] GitHub reveal all comments button
// ==UserScript==
// @name GitHub reveal all comments button
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description Useful on the PR page after review
// @author feimosi
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addRevealCommentsButton() {
const header = document.querySelector('.gh-header-actions');
const revealButton = document.querySelector('.show-reveal-comments-button');
if (!header || revealButton) {
return;
}
const button = document.createElement('button');
button.type = 'button';
button.className = 'btn btn-sm show-reveal-comments-button';
button.innerText = 'Reveal comments';
button.onclick = function(e) {
e.preventDefault();
document.querySelectorAll('.show-outdated-button').forEach(b => b.click());
};
header.appendChild(button);
}
setInterval(addRevealCommentsButton, 2000);
})();
@feimosi
Copy link
Author

feimosi commented Jun 15, 2020

You're welcome! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment