Skip to content

Instantly share code, notes, and snippets.

@RyanFleck
Last active August 5, 2020 18:29
Show Gist options
  • Save RyanFleck/601f73a96a9f78193ccbd61db33d510c to your computer and use it in GitHub Desktop.
Save RyanFleck/601f73a96a9f78193ccbd61db33d510c to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name PR ExpandR
// @namespace http://ryanfleck.ca/
// @version 1.0
// @description Expand all GitHub PR conversations.
// @author Ryan Fleck
// @match https://github.com/*/pull/*
// ==/UserScript==
var interval = 3000;
function expand_convos(){
var buttons = document.getElementsByTagName('button');
for(let i=0; i<buttons.length; i++){
if(buttons[i].textContent.trim().includes("hidden")){
window.setTimeout(function(){
console.log("Clicking button to expand: [ "+buttons[i].textContent.trim()+" ].");
buttons[i].click();
}, 400);
}
}
window.setTimeout(expand_convos, interval);
}
(function() {
'use strict';
console.log("PR Detected, searching for hidden items every "+(interval/1000)+" seconds.");
expand_convos();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment