Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove Minus and Plus Signs from Github PR Files Tab
// Open up a chrome console while viewing the files of a Github PR and paste this:
var deleted_nodes = document.querySelectorAll(".blob-code.blob-code-deletion .blob-code-inner");
var added_nodes = document.querySelectorAll(".blob-code.blob-code-addition .blob-code-inner");
var neutral_nodes = document.querySelectorAll(".blob-code.blob-code-context .blob-code-inner");
var removeNodes = function(nodes) {
for(var i=0; i < nodes.length; i++) {
nodes[i].removeChild(nodes[i].childNodes[0]);
}
}
removeNodes(deleted_nodes);
removeNodes(added_nodes);
removeNodes(neutral_nodes);
@lmj0011

This comment has been minimized.

Copy link

commented Jul 3, 2016

this deletes the curly braces for functions. Useful snippet though.
modified version here: https://gist.github.com/lmj0011/cb37eba76f2eef9cd54ae3c4f7bbb3cf

@vinay30

This comment has been minimized.

Copy link

commented Mar 21, 2018

Could you just do:

var added_nodes = document.querySelectorAll(".blob-code.blob-code-addition .blob-code-inner");
var deleted_nodes = document.querySelectorAll(".blob-code.blob-code-deletion .blob-code-inner");

function removeNodes(nodes) {
  for(var i = 0; i < nodes.length; i++) {
    nodes[i].innerHTML = nodes[i].innerHTML.replace(/[\+\-]/, ' ');
  }
}

removeNodes(added_nodes);
removeNodes(deleted_nodes);

Since without the /g flag, replace will just swap out the first instance of + or -.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.