Skip to content

Commit

Permalink
Initial commit of github-trailing-whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsca committed May 20, 2016
0 parents commit a48f62f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gh-trailing-ws.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
lines = document.getElementsByClassName('blob-code-inner')
for(var i=0; i<lines.length; i++) {
var line = lines[i];
var lastChild = line.childNodes[line.childNodes.length-1];
if(lastChild.nodeType == lastChild.TEXT_NODE && /^\s+$/.test(lastChild.textContent)) {
var span = document.createElement('span');
span.className = 'x';
span.innerText = lastChild.textContent;
line.insertBefore(span, lastChild);
line.removeChild(lastChild);
}
}
10 changes: 10 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "GitHub Trailing Whitespace",
"description": "This extension highlights trailing whitespace on GitHub diffs",
"version": "1.0",
"manifest_version": 2,
"content_scripts": [{
"js": ["gh-trailing-ws.user.js"],
"matches": ["https://github.com/*"]
}]
}

0 comments on commit a48f62f

Please sign in to comment.