From 7756c02c2312ed4cfd36fa71412a59c2279e3a53 Mon Sep 17 00:00:00 2001 From: Yakov <16872793+yakov116@users.noreply.github.com> Date: Thu, 10 Sep 2020 08:58:33 -0400 Subject: [PATCH 1/2] Add overview tab to `isUserProfileMainTab` --- index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 1e2f7b26..8c77f672 100644 --- a/index.ts +++ b/index.ts @@ -61,6 +61,7 @@ collect.set('isDashboard', [ 'https://github.com/?tab=stars', // Gotcha for `isUserProfileStarsTab` 'https://github.com/?tab=followers', // Gotcha for `isUserProfileFollowersTab` 'https://github.com/?tab=following', // Gotcha for `isUserProfileFollowingTab` + 'https://github.com/?tab=overview', // Gotcha for `isUserProfileMainTab` ]); export const isEnterprise = (url: URL | Location = location): boolean => url.hostname !== 'github.com' && url.hostname !== 'gist.github.com'; @@ -389,7 +390,8 @@ collect.set('isBranches', [ export const isUserProfile = (): boolean => exists('.user-profile-nav'); export const isUserProfileMainTab = (): boolean => - isUserProfile() && !new URLSearchParams(location.search).get('tab'); + isUserProfile() && + (!new URLSearchParams(location.search).get('tab') || new URLSearchParams(location.search).get('tab') === 'overview'); export const isUserProfileRepoTab = (): boolean => isUserProfile() && From 74ecb2ed336963d5def334ea331e530b585ba4e1 Mon Sep 17 00:00:00 2001 From: Federico Date: Thu, 10 Sep 2020 18:48:15 +0100 Subject: [PATCH 2/2] Use single `exists` --- index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 8c77f672..cb1491db 100644 --- a/index.ts +++ b/index.ts @@ -389,9 +389,7 @@ collect.set('isBranches', [ export const isUserProfile = (): boolean => exists('.user-profile-nav'); -export const isUserProfileMainTab = (): boolean => - isUserProfile() && - (!new URLSearchParams(location.search).get('tab') || new URLSearchParams(location.search).get('tab') === 'overview'); +export const isUserProfileMainTab = (): boolean => exists('[aria-label="User profile"] > .selected:first-child'); export const isUserProfileRepoTab = (): boolean => isUserProfile() &&