@@ -494,25 +494,45 @@ collect.set('isProfile', [
494
494
'https://github.com/sindresorhus?tab=following' ,
495
495
] ) ;
496
496
497
- export const isUserProfile = ( ) : boolean => exists ( '.user-profile-nav' ) ;
497
+ export const isUserProfile = ( ) : boolean => isProfile ( ) && ! isOrganizationProfile ( ) ;
498
498
499
- export const isUserProfileMainTab = ( ) : boolean => exists ( '[aria-label="User profile"] > .selected:first-child' ) ;
500
-
501
- export const isUserProfileRepoTab = ( ) : boolean =>
499
+ export const isUserProfileMainTab = ( ) : boolean =>
502
500
isUserProfile ( )
503
- && new URLSearchParams ( location . search ) . get ( 'tab' ) === 'repositories' ;
501
+ && ! new URLSearchParams ( location . search ) . has ( 'tab' ) ;
504
502
505
- export const isUserProfileStarsTab = ( ) : boolean =>
506
- isUserProfile ( )
507
- && new URLSearchParams ( location . search ) . get ( 'tab' ) === 'stars' ;
503
+ // The following can be URL-based because they have a `tab` parameter, unlike the organizations
504
+ export const isUserProfileRepoTab = ( url : URL | HTMLAnchorElement | Location = location ) : boolean =>
505
+ isProfile ( url )
506
+ && new URLSearchParams ( url . search ) . get ( 'tab' ) === 'repositories' ;
507
+ collect . set ( 'isUserProfileRepoTab' , [
508
+ 'https://github.com/fregante?tab=repositories' ,
509
+ 'https://github.com/fregante?tab=repositories&type=source' ,
510
+ 'https://github.com/fregante?tab=repositories&q=&type=source&language=css&sort=' ,
511
+ ] ) ;
508
512
509
- export const isUserProfileFollowersTab = ( ) : boolean =>
510
- isUserProfile ( )
511
- && new URLSearchParams ( location . search ) . get ( 'tab' ) === 'followers' ;
513
+ export const isUserProfileStarsTab = ( url : URL | HTMLAnchorElement | Location = location ) : boolean =>
514
+ isProfile ( url )
515
+ && new URLSearchParams ( url . search ) . get ( 'tab' ) === 'stars' ;
516
+ collect . set ( 'isUserProfileStarsTab' , [
517
+ 'https://github.com/fregante?tab=stars' ,
518
+ 'https://github.com/fregante?direction=desc&sort=updated&tab=stars' ,
519
+ ] ) ;
512
520
513
- export const isUserProfileFollowingTab = ( ) : boolean =>
514
- isUserProfile ( )
515
- && new URLSearchParams ( location . search ) . get ( 'tab' ) === 'following' ;
521
+ export const isUserProfileFollowersTab = ( url : URL | HTMLAnchorElement | Location = location ) : boolean =>
522
+ isProfile ( url )
523
+ && new URLSearchParams ( url . search ) . get ( 'tab' ) === 'followers' ;
524
+ collect . set ( 'isUserProfileFollowersTab' , [
525
+ 'https://github.com/fregante?tab=followers' ,
526
+ 'https://github.com/sindresorhus?tab=followers' ,
527
+ ] ) ;
528
+
529
+ export const isUserProfileFollowingTab = ( url : URL | HTMLAnchorElement | Location = location ) : boolean =>
530
+ isProfile ( url )
531
+ && new URLSearchParams ( url . search ) . get ( 'tab' ) === 'following' ;
532
+ collect . set ( 'isUserProfileFollowingTab' , [
533
+ 'https://github.com/fregante?tab=following' ,
534
+ 'https://github.com/sindresorhus?tab=following' ,
535
+ ] ) ;
516
536
517
537
export const isSingleTag = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => / ^ ( r e l e a s e s \/ t a g ) / . test ( getRepo ( url ) ?. path ! ) ;
518
538
collect . set ( 'isSingleTag' , [
0 commit comments