Skip to content

Commit 0d3afb9

Browse files
authored
Add isProfile (#95)
1 parent 12dd455 commit 0d3afb9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,26 @@ collect.set('isBranches', [
474474
'https://github.com/sindresorhus/refined-github/branches',
475475
]);
476476

477+
export const isProfile = (url: URL | HTMLAnchorElement | Location = location): boolean => {
478+
const pathname = getCleanPathname(url);
479+
return pathname.length > 0 && !pathname.includes('/') && !reservedNames.includes(pathname);
480+
};
481+
482+
collect.set('isProfile', [
483+
'https://github.com/fregante',
484+
'https://github.com/github',
485+
'https://github.com/babel',
486+
'https://github.com/fregante?tab=repositories',
487+
'https://github.com/fregante?tab=repositories&type=source',
488+
'https://github.com/fregante?tab=repositories&q=&type=source&language=css&sort=',
489+
'https://github.com/fregante?tab=stars',
490+
'https://github.com/fregante?direction=desc&sort=updated&tab=stars',
491+
'https://github.com/fregante?tab=followers',
492+
'https://github.com/sindresorhus?tab=followers',
493+
'https://github.com/fregante?tab=following',
494+
'https://github.com/sindresorhus?tab=following',
495+
]);
496+
477497
export const isUserProfile = (): boolean => exists('.user-profile-nav');
478498

479499
export const isUserProfileMainTab = (): boolean => exists('[aria-label="User profile"] > .selected:first-child');

0 commit comments

Comments
 (0)