Skip to content

Instantly share code, notes, and snippets.

@mbakgun
Created September 21, 2022 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbakgun/1376ef78aea571fdbe7dee88e6c9c385 to your computer and use it in GitHub Desktop.
Save mbakgun/1376ef78aea571fdbe7dee88e6c9c385 to your computer and use it in GitHub Desktop.
for (var i = 100; i >= 0; i--) {
const changes = document.querySelector("#diffs > div.files.d-flex.gl-mt-2 > div.diff-tree-list.js-diff-tree-list.gl-px-5 > div.tree-list-holder.d-flex.flex-column > div.tree-list-scroll.pt-0.tree-list-blobs")
for (const child of changes.children) {
for (const baby of child.children) {
if (baby.getAttribute("viewed-files") != null) {
var greenCount = (baby.querySelector("div > div > span.file-row-stats.mr-1 > span.cgreen").textContent.trim()).replace('+', '');
var redCount = (baby.querySelector("div > div > span.file-row-stats.mr-1 > span.cred").textContent.trim()).replace('-', '');
if (greenCount == '0' && redCount == '0') {
baby.parentNode.removeChild(baby);
if (child.childElementCount == 1) {
child.parentNode.removeChild(child);
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment