Skip to content

Commit 8ee776c

Browse files
committed
fix copy lines from GitHub
1 parent 4772cbb commit 8ee776c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sites/github.com.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var copyMarkdownSnippetFromGithub = (function(){ // ES6 modules are not supporte
1919
}
2020

2121
function convertLineElToText(lineEl){
22-
let lines = Array.from(lineEl.querySelector('.react-file-line').childNodes);
22+
let lines = Array.from(lineEl.childNodes);
2323
let textFragments = Array.prototype.map.call(lines, line => line.textContent)
2424
return textFragments.join('')
2525
}
@@ -28,7 +28,7 @@ var copyMarkdownSnippetFromGithub = (function(){ // ES6 modules are not supporte
2828
// Read code lines highlighted on GitHub page, return multiline string
2929
let lines = Array.from(document.querySelectorAll('.highlighted-line'));
3030
const numbers = lines.map(line => line.getAttribute('data-line-number'));
31-
let texts = numbers.map(number => document.querySelector(`[data-key="${number - 1}"]`))
31+
let texts = numbers.map(number => document.querySelector(`[id="LC${number}"]`))
3232
if (texts.length === 0) {
3333
texts = document.querySelectorAll('div[aria-current]');
3434
}

0 commit comments

Comments
 (0)