@@ -45,7 +45,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
4545 pathname,
4646 search,
4747 searchParams,
48- hash
48+ hash,
4949 } = url ;
5050
5151 const pathnameParts = pathname . slice ( 1 ) . split ( '/' ) ; // ['user', 'repo', 'pull', '342']
@@ -54,7 +54,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
5454 const isRaw = [
5555 'https://raw.githubusercontent.com' ,
5656 'https://cdn.rawgit.com' ,
57- 'https://rawgit.com'
57+ 'https://rawgit.com' ,
5858 ] . includes ( origin ) ;
5959
6060 let [
@@ -96,7 +96,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
9696 'tree' ,
9797 'blob' ,
9898 'blame' ,
99- 'commits'
99+ 'commits' ,
100100 ] . includes ( type ) ;
101101
102102 const repoUrl = isThisRepo ? '' : `${ user } /${ repo } ` ;
@@ -117,7 +117,10 @@ function shortenURL(href, currentUrl = 'https://github.com') {
117117 }
118118
119119 if ( isFileOrDir ) {
120- const revisioned = joinValues ( [ joinValues ( [ repoUrl , revision ] , '@' ) , filePath ] , '/' ) ;
120+ const revisioned = joinValues (
121+ [ joinValues ( [ repoUrl , revision ] , '@' ) , filePath ] ,
122+ '/' ,
123+ ) ;
121124 const partial = `${ revisioned } ${ search } ${ hash } ` ;
122125 if ( type !== 'blob' && type !== 'tree' ) {
123126 return `${ partial } (${ type } )` ;
@@ -147,7 +150,10 @@ function shortenURL(href, currentUrl = 'https://github.com') {
147150 }
148151
149152 if ( label ) {
150- return joinValues ( [ repoUrl , decodeURIComponent ( label ) ] ) + `${ search } ${ hash } (label)` ;
153+ return (
154+ joinValues ( [ repoUrl , decodeURIComponent ( label ) ] )
155+ + `${ search } ${ hash } (label)`
156+ ) ;
151157 }
152158
153159 if ( isDependents ) {
@@ -187,7 +193,10 @@ function applyToLink(a, currentUrl) {
187193 // Shorten only if the link name hasn't been customized.
188194 // .href automatically adds a / to naked origins so that needs to be tested too
189195 // `trim` makes it compatible with this feature: https://github.com/sindresorhus/refined-github/pull/3085
190- if ( ( a . href === a . textContent . trim ( ) || a . href === `${ a . textContent } /` ) && ! a . firstElementChild ) {
196+ if (
197+ ( a . href === a . textContent . trim ( ) || a . href === `${ a . textContent } /` )
198+ && ! a . firstElementChild
199+ ) {
191200 const shortened = shortenURL ( a . href , currentUrl ) ;
192201 a . innerHTML = shortened ;
193202 return true ;
0 commit comments