File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 27
27
style . innerHTML = css
28
28
document . head . appendChild ( style )
29
29
30
+ function updateButtonHref ( button ) {
31
+ button . href = location . href . replace ( 'https://github.com/' , 'https://pr.new/' )
32
+ }
33
+
30
34
function createButton ( ) {
31
35
const a = document . createElement ( 'a' )
32
- a . href = location . href . replace ( 'https://github.com/' , 'https://pr.new/' )
36
+ updateButtonHref ( a )
33
37
a . target = '_blank'
34
38
a . classList . add ( 'btn' )
35
39
a . classList . add ( 'btn-sm' )
49
53
}
50
54
51
55
function run ( ) {
52
- if ( document . querySelector ( `#${ id } ` ) )
56
+ const button = document . querySelector ( `#${ id } ` )
57
+ if ( button ) {
58
+ // Always update the link to support GitHub SPA navigations
59
+ updateButtonHref ( button )
53
60
return
61
+ }
54
62
55
63
const repoActions = document . querySelector ( '#repository-details-container ul' )
56
64
if ( repoActions ) {
You can’t perform that action at this time.
0 commit comments