Skip to content

Commit 0470cf4

Browse files
committed
Add github support to readme
1 parent 556e86c commit 0470cf4

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This repo is experimental and was created out of the need to have a better exper
2525

2626
### Supported Pages
2727

28-
- [ ] github
28+
- [x] github (reads special `data-code-text` attributes)
2929
- [x] gitlab
3030
- [x] bitbucket server
3131

chrome/content/scripts/content.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,12 @@ function runGuidReplacer() {
151151
elements[i].parentNode.removeChild(elements[i]);
152152
}
153153

154-
// Traverse all text nodes in the document body
154+
// Traverse all potential nodes in the document body
155155
traverseTextNodes(document.body);
156-
traverseDataCodeTextElements(document.body);
156+
if (window.location.hostname === "github.com") {
157+
// Additionally traverse all special github elements with data-code-text attribute
158+
traverseDataCodeTextElements(document.body);
159+
}
157160

158161
console.log("Found " + matchCount + " matches" + " in " + nodeCount + " nodes (duration: " + (performance.now() - startTime) + " ms)");
159162
}

docs/preview.png

-54.4 KB
Loading

0 commit comments

Comments
 (0)