Created
October 23, 2017 07:19
-
-
Save feimosi/bb015d4d1f131ac07141bd2913745ee1 to your computer and use it in GitHub Desktop.
[Tampermonkey] GitHub reveal all comments button
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
// ==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); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks ;) Helped me with a totally different situation