@@ -28,40 +28,40 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
28
28
$linesEls . closest ( 'tr' ) . removeClass ( 'active' ) ;
29
29
30
30
// add hashchange to permalink
31
- const $ refInNewIssue = $ ( 'a.ref-in-new-issue' ) ;
32
- const $ copyPermalink = $ ( 'a.copy-line-permalink' ) ;
33
- const $ viewGitBlame = $ ( 'a.view_git_blame' ) ;
31
+ const refInNewIssue = document . querySelector ( 'a.ref-in-new-issue' ) ;
32
+ const copyPermalink = document . querySelector ( 'a.copy-line-permalink' ) ;
33
+ const viewGitBlame = document . querySelector ( 'a.view_git_blame' ) ;
34
34
35
35
const updateIssueHref = function ( anchor ) {
36
- if ( ! $ refInNewIssue. length ) {
36
+ if ( ! refInNewIssue ) {
37
37
return ;
38
38
}
39
- const urlIssueNew = $ refInNewIssue. attr ( 'data-url-issue-new' ) ;
40
- const urlParamBodyLink = $ refInNewIssue. attr ( 'data-url-param-body-link' ) ;
39
+ const urlIssueNew = refInNewIssue . getAttribute ( 'data-url-issue-new' ) ;
40
+ const urlParamBodyLink = refInNewIssue . getAttribute ( 'data-url-param-body-link' ) ;
41
41
const issueContent = `${ toAbsoluteUrl ( urlParamBodyLink ) } #${ anchor } ` ; // the default content for issue body
42
- $ refInNewIssue. attr ( 'href' , `${ urlIssueNew } ?body=${ encodeURIComponent ( issueContent ) } ` ) ;
42
+ refInNewIssue . setAttribute ( 'href' , `${ urlIssueNew } ?body=${ encodeURIComponent ( issueContent ) } ` ) ;
43
43
} ;
44
44
45
45
const updateViewGitBlameFragment = function ( anchor ) {
46
- if ( ! $ viewGitBlame. length ) return ;
47
- let href = $ viewGitBlame. attr ( 'href' ) ;
46
+ if ( ! viewGitBlame ) return ;
47
+ let href = viewGitBlame . getAttribute ( 'href' ) ;
48
48
href = `${ href . replace ( / # L \d + $ | # L \d + - L \d + $ / , '' ) } ` ;
49
49
if ( anchor . length !== 0 ) {
50
50
href = `${ href } #${ anchor } ` ;
51
51
}
52
- $ viewGitBlame. attr ( 'href' , href ) ;
52
+ viewGitBlame . setAttribute ( 'href' , href ) ;
53
53
} ;
54
54
55
- const updateCopyPermalinkUrl = function ( anchor ) {
56
- if ( ! $ copyPermalink. length ) return ;
57
- let link = $ copyPermalink. attr ( 'data-url' ) ;
55
+ const updateCopyPermalinkUrl = function ( anchor ) {
56
+ if ( ! copyPermalink ) return ;
57
+ let link = copyPermalink . getAttribute ( 'data-url' ) ;
58
58
link = `${ link . replace ( / # L \d + $ | # L \d + - L \d + $ / , '' ) } #${ anchor } ` ;
59
- $ copyPermalink. attr ( 'data-url' , link ) ;
59
+ copyPermalink . setAttribute ( 'data-url' , link ) ;
60
60
} ;
61
61
62
62
if ( $selectionStartEls ) {
63
- let a = parseInt ( $selectionEndEl . attr ( 'rel' ) . slice ( 1 ) ) ;
64
- let b = parseInt ( $selectionStartEls . attr ( 'rel' ) . slice ( 1 ) ) ;
63
+ let a = parseInt ( $selectionEndEl [ 0 ] . getAttribute ( 'rel' ) . slice ( 1 ) ) ;
64
+ let b = parseInt ( $selectionStartEls [ 0 ] . getAttribute ( 'rel' ) . slice ( 1 ) ) ;
65
65
let c ;
66
66
if ( a !== b ) {
67
67
if ( a > b ) {
@@ -85,11 +85,11 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
85
85
}
86
86
}
87
87
$selectionEndEl . closest ( 'tr' ) . addClass ( 'active' ) ;
88
- changeHash ( `#${ $selectionEndEl . attr ( 'rel' ) } ` ) ;
88
+ changeHash ( `#${ $selectionEndEl [ 0 ] . getAttribute ( 'rel' ) } ` ) ;
89
89
90
- updateIssueHref ( $selectionEndEl . attr ( 'rel' ) ) ;
91
- updateViewGitBlameFragment ( $selectionEndEl . attr ( 'rel' ) ) ;
92
- updateCopyPermalinkUrl ( $selectionEndEl . attr ( 'rel' ) ) ;
90
+ updateIssueHref ( $selectionEndEl [ 0 ] . getAttribute ( 'rel' ) ) ;
91
+ updateViewGitBlameFragment ( $selectionEndEl [ 0 ] . getAttribute ( 'rel' ) ) ;
92
+ updateCopyPermalinkUrl ( $selectionEndEl [ 0 ] . getAttribute ( 'rel' ) ) ;
93
93
}
94
94
95
95
function showLineButton ( ) {
0 commit comments