File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ var copyMarkdownSnippetFromGithub = (function(){ // ES6 modules are not supporte
99 }
1010
1111 async function highlightGitHubSeletedLines ( ) {
12- let lines = document . querySelectorAll ( '.js-file-line.highlighted' ) ;
12+ let lines = findSelectedLines ( ) ;
1313 if ( lines . length === 0 ) {
1414 lines = document . querySelectorAll ( 'div[aria-current]' ) ;
1515 }
@@ -24,11 +24,15 @@ var copyMarkdownSnippetFromGithub = (function(){ // ES6 modules are not supporte
2424 return textFragments . join ( '' )
2525 }
2626
27- function readHighlightedLines ( ) {
28- // Read code lines highlighted on GitHub page, return multiline string
27+ function findSelectedLines ( ) {
2928 let lines = Array . from ( document . querySelectorAll ( '.highlighted-line' ) ) ;
3029 const numbers = lines . map ( line => line . getAttribute ( 'data-line-number' ) ) ;
31- let texts = numbers . map ( number => document . querySelector ( `[id="LC${ number } "]` ) )
30+ return numbers . map ( number => document . querySelector ( `[id="LC${ number } "]` ) ) ;
31+ }
32+
33+ function readHighlightedLines ( ) {
34+ // Read code lines highlighted on GitHub page, return multiline string
35+ let texts = findSelectedLines ( ) ;
3236 if ( texts . length === 0 ) {
3337 texts = document . querySelectorAll ( 'div[aria-current]' ) ;
3438 }
You can’t perform that action at this time.
0 commit comments