Skip to content

Commit 821502a

Browse files
authored
Add isCompareWikiPage (#118)
1 parent 4bd3c83 commit 821502a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ collect.set('isCompare', [
5454
'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1',
5555
]);
5656

57+
export const isCompareWikiPage = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoWiki(url) && getCleanPathname(url).split('/').slice(3, 5).includes('_compare');
58+
collect.set('isCompareWikiPage', [
59+
'https://github.com/brookhong/Surfingkeys/wiki/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d',
60+
'https://github.com/brookhong/Surfingkeys/wiki/Color-Themes/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d',
61+
]);
62+
5763
export const isDashboard = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && /^$|^(orgs\/[^/]+\/)?dashboard(\/|$)/.test(getCleanPathname(url));
5864
collect.set('isDashboard', [
5965
'https://github.com///',
@@ -469,6 +475,8 @@ collect.set('isRepoWiki', [
469475
'https://github.com/lukesampson/scoop/wiki',
470476
'https://github.com/tooomm/wikitest/wiki/_new',
471477
'https://github.com/tooomm/wikitest/wiki/Getting-Started/_edit',
478+
'https://github.com/brookhong/Surfingkeys/wiki/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d',
479+
'https://github.com/brookhong/Surfingkeys/wiki/Color-Themes/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d',
472480
]);
473481

474482
export const isSingleCommit = (url: URL | HTMLAnchorElement | Location = location): boolean => /^commit\/[\da-f]{5,40}$/.test(getRepo(url)?.path!);
@@ -609,6 +617,7 @@ export const hasCode = (url: URL | HTMLAnchorElement | Location = location): boo
609617
|| isSingleFile(url)
610618
|| isGist(url)
611619
|| isCompare(url)
620+
|| isCompareWikiPage(url)
612621
|| isBlame(url);
613622

614623
collect.set('hasFiles', combinedTestOnly);

0 commit comments

Comments
 (0)