Skip to content

Commit f345e47

Browse files
authored
Add isNewWikiPage and isEditingWikiPage (#81)
1 parent 7347684 commit f345e47

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ collect.set('isNewRelease', [
151151
'https://github.com/sindresorhus/refined-github/releases/new',
152152
]);
153153

154+
export const isNewWikiPage = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoWiki(url) && getCleanPathname(url).endsWith('/_new');
155+
collect.set('isNewWikiPage', [
156+
'https://github.com/tooomm/wikitest/wiki/_new',
157+
]);
158+
154159
export const isNotifications = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'notifications';
155160
collect.set('isNotifications', [
156161
'https://github.com/notifications',
@@ -267,6 +272,11 @@ collect.set('isEditingRelease', [
267272
'https://github.com/sindresorhus/refined-github/releases/edit/v1.2.3',
268273
]);
269274

275+
export const isEditingWikiPage = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoWiki(url) && getCleanPathname(url).endsWith('/_edit');
276+
collect.set('isEditingWikiPage', [
277+
'https://github.com/tooomm/wikitest/wiki/Getting-Started/_edit',
278+
]);
279+
270280
export const isRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => /^[^/]+\/[^/]+/.test(getCleanPathname(url)) &&
271281
!reservedNames.includes(url.pathname.split('/', 2)[1]!) &&
272282
!isDashboard(url) &&
@@ -413,6 +423,8 @@ collect.set('isRepoTree', [
413423
export const isRepoWiki = (url: URL | HTMLAnchorElement | Location = location): boolean => Boolean(getRepo(url)?.path.startsWith('wiki'));
414424
collect.set('isRepoWiki', [
415425
'https://github.com/lukesampson/scoop/wiki',
426+
'https://github.com/tooomm/wikitest/wiki/_new',
427+
'https://github.com/tooomm/wikitest/wiki/Getting-Started/_edit',
416428
]);
417429

418430
export const isSingleCommit = (url: URL | HTMLAnchorElement | Location = location): boolean => /^commit\/[\da-f]{5,40}/.test(getRepo(url)?.path!);

0 commit comments

Comments
 (0)