github-url-detection 11.1.2 → 11.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -274,6 +274,9 @@ export declare const hasWikiPageEditor: (url?: URL | HTMLAnchorElement | Locatio
274
274
  export declare const isRepo: (url?: URL | HTMLAnchorElement | Location) => boolean;
275
275
  export declare const hasRepoHeader: (url?: URL | HTMLAnchorElement | Location) => boolean;
276
276
  export declare const isEmptyRepoRoot: () => boolean;
277
+ /**
278
+ * @deprecated Doesn't work anymore. Use `isEmptyRepoRoot` or API instead.
279
+ */
277
280
  export declare const isEmptyRepo: () => boolean;
278
281
  export declare const isPublicRepo: () => boolean;
279
282
  export declare const isArchivedRepo: () => boolean;
@@ -29,7 +29,11 @@ var isNewRelease = (url = location) => getRepo(url)?.path === "releases/new";
29
29
  var isNewWikiPage = (url = location) => isRepoWiki(url) && getCleanPathname(url).endsWith("/_new");
30
30
  var isNotifications = (url = location) => getCleanPathname(url) === "notifications";
31
31
  var isOrganizationProfile = () => exists('meta[name="hovercard-subject-tag"][content^="organization"]');
32
- var isOrganizationRepo = () => exists('.AppHeader-context-full [data-hovercard-type="organization"]');
32
+ var isOrganizationRepo = () => exists([
33
+ 'qbsearch-input[data-current-repository][data-current-org]:not([data-current-repository=""], [data-current-org=""])',
34
+ // TODO: Remove after June 2026
35
+ '.AppHeader-context-full [data-hovercard-type="organization"]'
36
+ ].join(","));
33
37
  var isTeamDiscussion = (url = location) => Boolean(getOrg(url)?.path.startsWith("teams"));
34
38
  var isOwnUserProfile = () => getCleanPathname() === getLoggedInUser();
35
39
  var isOwnOrganizationProfile = () => isOrganizationProfile() && !exists('[href*="contact/report-abuse?report="]');
@@ -82,7 +86,12 @@ var isRepo = (url = location) => {
82
86
  return Boolean(user && repo && !reservedNames.includes(user) && !url.hostname.startsWith("gist.") && extra !== "generate");
83
87
  };
84
88
  var hasRepoHeader = (url = location) => isRepo(url) && !isRepoSearch(url);
85
- var isEmptyRepoRoot = () => isRepoHome() && !exists('link[rel="canonical"]');
89
+ var isEmptyRepoRoot = () => isRepoHome() && exists([
90
+ // If you don't have write access
91
+ ".blankslate-icon",
92
+ // If you have write access
93
+ "#empty-setup-clone-url"
94
+ ].join(","));
86
95
  var isEmptyRepo = () => exists('[aria-label="Cannot fork because repository is empty."]');
87
96
  var isPublicRepo = () => exists('meta[name="octolytics-dimension-repository_public"][content="true"]');
88
97
  var isArchivedRepo = () => Boolean(isRepo() && $("main > .flash-warn")?.textContent.includes("archived"));
@@ -163,7 +172,7 @@ var doesLookLikeAProfile = (string) => typeof string === "string" && string.leng
163
172
  var isProfile = (url = location) => !isGist(url) && doesLookLikeAProfile(getCleanPathname(url));
164
173
  var isGistProfile = (url = location) => doesLookLikeAProfile(getCleanGistPathname(url));
165
174
  var isUserProfile = () => isProfile() && !isOrganizationProfile();
166
- var isPrivateUserProfile = () => isUserProfile() && !exists('.UnderlineNav-item[href$="tab=stars"]');
175
+ var isPrivateUserProfile = () => isUserProfile() && exists("#user-private-profile-frame");
167
176
  var isUserProfileMainTab = () => isUserProfile() && !new URLSearchParams(location.search).has("tab");
168
177
  var isUserProfileRepoTab = (url = location) => isProfile(url) && new URLSearchParams(url.search).get("tab") === "repositories";
169
178
  var isUserProfileStarsTab = (url = location) => isProfile(url) && new URLSearchParams(url.search).get("tab") === "stars";
@@ -181,7 +190,14 @@ var isActionRun = (url = location) => /^(actions\/)?runs/.test(getRepo(url)?.pat
181
190
  var isNewAction = (url = location) => getRepo(url)?.path === "actions/new";
182
191
  var isRepositoryActions = (url = location) => /^actions(\/workflows\/.+\.ya?ml)?$/.test(getRepo(url)?.path);
183
192
  var isUserTheOrganizationOwner = () => isOrganizationProfile() && exists('[aria-label="Organization"] [data-tab-item="org-header-settings-tab"]');
184
- var canUserAdminRepo = () => isRepo() && exists('.reponav-item[href$="/settings"], [data-tab-item$="settings-tab"]');
193
+ var canUserAdminRepo = () => {
194
+ const repo = getRepo();
195
+ return Boolean(repo && exists(`:is(${[
196
+ ".GlobalNav",
197
+ // Remove after June 2026
198
+ ".js-repo-nav"
199
+ ].join(",")}) a[href="/${repo.nameWithOwner}/settings"]`));
200
+ };
185
201
  var isNewRepo = (url = location) => !isGist(url) && (url.pathname === "/new" || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
186
202
  var isNewRepoTemplate = (url = location) => Boolean(url.pathname.split("/")[3] === "generate");
187
203
  var getLoggedInUser = () => $('meta[name="user-login"]')?.getAttribute("content") ?? void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-url-detection",
3
- "version": "11.1.2",
3
+ "version": "11.1.3",
4
4
  "description": "Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.",
5
5
  "keywords": [
6
6
  "github",