File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2727 style . innerHTML = css
2828 document . head . appendChild ( style )
2929
30+ function updateButtonHref ( button ) {
31+ button . href = location . href . replace ( 'https://github.com/' , 'https://pr.new/' )
32+ }
33+
3034 function createButton ( ) {
3135 const a = document . createElement ( 'a' )
32- a . href = location . href . replace ( 'https://github.com/' , 'https://pr.new/' )
36+ updateButtonHref ( a )
3337 a . target = '_blank'
3438 a . classList . add ( 'btn' )
3539 a . classList . add ( 'btn-sm' )
4953 }
5054
5155 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 )
5360 return
61+ }
5462
5563 const repoActions = document . querySelector ( '#repository-details-container ul' )
5664 if ( repoActions ) {
You can’t perform that action at this time.
0 commit comments