Skip to content

Commit a48f62f

Browse files
committed
Initial commit of github-trailing-whitespace
0 parents  commit a48f62f

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

gh-trailing-ws.user.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
lines = document.getElementsByClassName('blob-code-inner')
2+
for(var i=0; i<lines.length; i++) {
3+
var line = lines[i];
4+
var lastChild = line.childNodes[line.childNodes.length-1];
5+
if(lastChild.nodeType == lastChild.TEXT_NODE && /^\s+$/.test(lastChild.textContent)) {
6+
var span = document.createElement('span');
7+
span.className = 'x';
8+
span.innerText = lastChild.textContent;
9+
line.insertBefore(span, lastChild);
10+
line.removeChild(lastChild);
11+
}
12+
}

manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "GitHub Trailing Whitespace",
3+
"description": "This extension highlights trailing whitespace on GitHub diffs",
4+
"version": "1.0",
5+
"manifest_version": 2,
6+
"content_scripts": [{
7+
"js": ["gh-trailing-ws.user.js"],
8+
"matches": ["https://github.com/*"]
9+
}]
10+
}

0 commit comments

Comments
 (0)