Skip to content

Commit

Permalink
Add isArchivedRepo (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 11, 2022
1 parent f236016 commit cf7ea99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import reservedNames from 'github-reserved-names/reserved-names.json';
import collect from './collector.js';

const exists = (selector: string) => Boolean(document.querySelector(selector));
const $ = (selector: string) => document.querySelector(selector);
const exists = (selector: string) => Boolean($(selector));

const combinedTestOnly = 'combinedTestOnly'; // To be used only to skip tests of combined functions, i.e. isPageA() || isPageB()

Expand Down Expand Up @@ -349,6 +350,8 @@ export const isEmptyRepoRoot = (): boolean => isRepoHome() && !exists('link[rel=

export const isEmptyRepo = (): boolean => exists('[aria-label="Cannot fork because repository is empty."]');

export const isArchivedRepo = (): boolean => Boolean(isRepo() && $('#repository-container-header .Label')!.textContent!.endsWith('archive'));

export const isBlank = (): boolean => exists('main .blankslate');

export const isRepoTaxonomyConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepo(url)?.path!);
Expand Down

0 comments on commit cf7ea99

Please sign in to comment.