@@ -25,9 +25,9 @@ export class GitHubInjector extends InjectorBase {
2525 new PullInjector ( ) ,
2626 new IssueInjector ( ) ,
2727 new FileInjector ( ) ,
28- new EditFileButtonInjector ( ) ,
2928 new NavigationInjector ( ) ,
3029 new EmptyRepositoryInjector ( ) ,
30+ new NewRepositoryOverviewInjector ( ) ,
3131 ] ) ;
3232 }
3333
@@ -146,7 +146,7 @@ abstract class ButtonInjectorBase implements ButtonInjector {
146146 if ( openAsPopup ) {
147147 makeOpenInPopup ( a ) ;
148148 }
149- a . className = "btn btn-sm btn-primary " ;
149+ a . className = "btn btn-sm" ;
150150
151151 this . adjustButton ( a ) ;
152152
@@ -174,7 +174,11 @@ abstract class ButtonInjectorBase implements ButtonInjector {
174174
175175class PullInjector extends ButtonInjectorBase {
176176 constructor ( ) {
177- super ( ".gh-header-actions" , "" ) ;
177+ super ( ".gh-header-actions" , "flex-md-order-2" ) ;
178+ }
179+
180+ protected adjustButton ( a : HTMLAnchorElement ) : void {
181+ a . className = "btn btn-sm btn-primary" ;
178182 }
179183
180184 isApplicableToCurrentPage ( ) : boolean {
@@ -192,41 +196,53 @@ class IssueInjector extends ButtonInjectorBase {
192196 }
193197}
194198
195- class EditFileButtonInjector extends ButtonInjectorBase {
199+ class FileInjector extends ButtonInjectorBase {
196200 constructor ( ) {
197- super ( "" , "gitpod-file-edit-btn" ) ;
201+ super ( "#StickyHeader > div > div > div:nth-child(2)" , "gitpod-file-btn" ) ;
202+ }
203+
204+ protected adjustButton ( a : HTMLAnchorElement ) : void {
205+ a . style . marginLeft = "8px" ;
206+ a . className = "btn btn-primary" ;
198207 }
199208
200209 isApplicableToCurrentPage ( ) : boolean {
201210 return window . location . pathname . includes ( "/blob/" ) ;
202211 }
203212}
204213
205- class FileInjector extends ButtonInjectorBase {
214+ class NavigationInjector extends ButtonInjectorBase {
206215 constructor ( ) {
207- super ( ".repository-content > div > div > div " , "gitpod-file-btn " ) ;
216+ super ( ".file-navigation " , "empty-icon position-relative " ) ;
208217 }
209218
210219 protected adjustButton ( a : HTMLAnchorElement ) : void {
211220 a . className = "btn btn-primary" ;
212221 }
213222
214223 isApplicableToCurrentPage ( ) : boolean {
215- return window . location . pathname . includes ( "/blob/ ") ;
224+ return ! ! select . exists ( ".file-navigation ") ;
216225 }
217226}
218227
219- class NavigationInjector extends ButtonInjectorBase {
228+ class NewRepositoryOverviewInjector extends ButtonInjectorBase {
220229 constructor ( ) {
221- super ( ".file-navigation " , "empty-icon position-relative" ) ;
230+ super ( ".pagehead-actions " , "empty-icon position-relative" ) ;
222231 }
223232
224233 protected adjustButton ( a : HTMLAnchorElement ) : void {
225- a . className = "btn btn-primary" ;
234+ a . className = "btn btn-sm btn- primary" ;
226235 }
227236
228237 isApplicableToCurrentPage ( ) : boolean {
229- return ! ! select . exists ( ".file-navigation" ) ;
238+ return ! ! select . exists ( ".pagehead-actions" ) ;
239+ }
240+
241+ protected renderButton ( url : string , openAsPopup : boolean ) : HTMLElement {
242+ const button = super . renderButton ( url , openAsPopup ) ;
243+ const container = document . createElement ( 'li' ) ;
244+ container . appendChild ( button ) ;
245+ return container ;
230246 }
231247}
232248
0 commit comments