github-url-detection
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,1 +1,2 @@ | ||
export * as utils from './utils'; | ||
export declare const is404: () => boolean; | ||
@@ -2,0 +3,0 @@ export declare const is500: () => boolean; |
@@ -9,2 +9,4 @@ "use strict"; | ||
const getUsername = () => document.querySelector('meta[name="user-login"]').getAttribute("content"); | ||
const getCleanPathname = () => location.pathname.replace(/^\/|\/$/g, ""); | ||
@@ -16,3 +18,9 @@ | ||
new Map; | ||
var utils = Object.freeze({ | ||
__proto__: null, | ||
getUsername: getUsername, | ||
getDiscussionNumber: () => location.pathname.split(/(?:pull|issues)\/(\d+)/)[1], | ||
getCleanPathname: getCleanPathname, | ||
getRepoPath: getRepoPath | ||
}); | ||
@@ -49,9 +57,3 @@ const exists = selector => Boolean(document.querySelector(selector)); | ||
const isRepo = () => /^[^/]+\/[^/]+/.test(getCleanPathname()) && !reservedNames.includes((() => { | ||
const [, ownerName, repoName] = location.pathname.split("/", 3); | ||
return { | ||
ownerName: ownerName, | ||
repoName: repoName | ||
}; | ||
})().ownerName) && !isDashboard() && !isGist() && !isRepoSearch(); | ||
const isRepo = () => /^[^/]+\/[^/]+/.test(getCleanPathname()) && !reservedNames.includes(location.pathname.split("/", 2)[1]) && !isDashboard() && !isGist() && !isRepoSearch(); | ||
@@ -147,3 +149,3 @@ const isRepoTaxonomyDiscussionList = () => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepoPath()); | ||
exports.isOwnUserProfile = () => getCleanPathname() === document.querySelector('meta[name="user-login"]').getAttribute("content"); | ||
exports.isOwnUserProfile = () => getCleanPathname() === getUsername(); | ||
@@ -203,1 +205,3 @@ exports.isPR = isPR; | ||
exports.isUserProfileRepoTab = () => isUserProfile() && "repositories" === new URLSearchParams(location.search).get("tab"); | ||
exports.utils = utils; |
@@ -0,1 +1,2 @@ | ||
export * as utils from './utils'; | ||
export declare const is404: () => boolean; | ||
@@ -2,0 +3,0 @@ export declare const is500: () => boolean; |
var reservedNames = [ "400", "401", "402", "403", "404", "405", "406", "407", "408", "409", "410", "411", "412", "413", "414", "415", "416", "417", "418", "419", "420", "421", "422", "423", "424", "425", "426", "427", "428", "429", "430", "431", "500", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", "511", "about", "access", "account", "admin", "anonymous", "any", "api", "apps", "attributes", "auth", "billing", "blob", "blog", "bounty", "branches", "business", "businesses", "c", "cache", "case-studies", "categories", "central", "certification", "changelog", "cla", "cloud", "codereview", "collection", "collections", "comments", "commit", "commits", "community", "companies", "compare", "contact", "contributing", "cookbook", "coupons", "customer", "customers", "dashboard", "dashboards", "design", "develop", "developer", "diff", "discover", "discussions", "docs", "downloads", "downtime", "editor", "editors", "edu", "enterprise", "events", "explore", "featured", "features", "files", "fixtures", "forked", "garage", "ghost", "gist", "gists", "graphs", "guide", "guides", "help", "help-wanted", "home", "hooks", "hosting", "hovercards", "identity", "images", "inbox", "individual", "info", "integration", "interfaces", "introduction", "invalid-email-address", "investors", "issues", "jobs", "join", "journal", "journals", "lab", "labs", "languages", "launch", "layouts", "learn", "legal", "library", "linux", "listings", "lists", "login", "logos", "logout", "mac", "maintenance", "malware", "man", "marketplace", "mention", "mentioned", "mentioning", "mentions", "migrating", "milestones", "mine", "mirrors", "mobile", "navigation", "network", "new", "news", "none", "nonprofit", "nonprofits", "notices", "notifications", "oauth", "offer", "open-source", "organisations", "organizations", "orgs", "pages", "partners", "payments", "personal", "plans", "plugins", "popular", "popularity", "posts", "press", "pricing", "professional", "projects", "pulls", "raw", "readme", "recommendations", "redeem", "releases", "render", "reply", "repositories", "resources", "restore", "revert", "save-net-neutrality", "saved", "scraping", "search", "security", "services", "sessions", "settings", "shareholders", "shop", "showcases", "signin", "signup", "site", "spam", "sponsors", "ssh", "staff", "starred", "stars", "static", "status", "statuses", "storage", "store", "stories", "styleguide", "subscriptions", "suggest", "suggestion", "suggestions", "support", "suspended", "talks", "teach", "teacher", "teachers", "teaching", "teams", "ten", "terms", "timeline", "topic", "topics", "tos", "tour", "train", "training", "translations", "tree", "trending", "updates", "username", "users", "visualization", "w", "watching", "wiki", "windows", "works-with", "www0", "www1", "www2", "www3", "www4", "www5", "www6", "www7", "www8", "www9" ]; | ||
const getUsername = () => document.querySelector('meta[name="user-login"]').getAttribute("content"); | ||
const getCleanPathname = () => location.pathname.replace(/^\/|\/$/g, ""); | ||
@@ -9,3 +11,9 @@ | ||
new Map; | ||
var utils = Object.freeze({ | ||
__proto__: null, | ||
getUsername: getUsername, | ||
getDiscussionNumber: () => location.pathname.split(/(?:pull|issues)\/(\d+)/)[1], | ||
getCleanPathname: getCleanPathname, | ||
getRepoPath: getRepoPath | ||
}); | ||
@@ -58,3 +66,3 @@ const exists = selector => Boolean(document.querySelector(selector)); | ||
const isOwnUserProfile = () => getCleanPathname() === document.querySelector('meta[name="user-login"]').getAttribute("content"); | ||
const isOwnUserProfile = () => getCleanPathname() === getUsername(); | ||
@@ -85,9 +93,3 @@ const isOwnOrganizationProfile = () => isOrganizationProfile() && !exists('[href*="contact/report-abuse?report="]'); | ||
const isRepo = () => /^[^/]+\/[^/]+/.test(getCleanPathname()) && !reservedNames.includes((() => { | ||
const [, ownerName, repoName] = location.pathname.split("/", 3); | ||
return { | ||
ownerName: ownerName, | ||
repoName: repoName | ||
}; | ||
})().ownerName) && !isDashboard() && !isGist() && !isRepoSearch(); | ||
const isRepo = () => /^[^/]+\/[^/]+/.test(getCleanPathname()) && !reservedNames.includes(location.pathname.split("/", 2)[1]) && !isDashboard() && !isGist() && !isRepoSearch(); | ||
@@ -145,2 +147,2 @@ const isRepoTaxonomyDiscussionList = () => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepoPath()); | ||
export { hasCode, hasComments, hasRichTextEditor, is404, is500, isActionJobRun, isActionPage, isBlame, isBranches, isCommit, isCommitList, isCompare, isConflict, isDashboard, isDiscussionList, isEditingFile, isEnterprise, isFileFinder, isForkedRepo, isGist, isGlobalDiscussionList, isGlobalSearchResults, isIssue, isLabelList, isMilestone, isMilestoneList, isNewIssue, isNewRelease, isNotifications, isOrganizationDiscussion, isOrganizationProfile, isOwnOrganizationProfile, isOwnUserProfile, isPR, isPRCommit, isPRCommitList, isPRConversation, isPRFiles, isPRList, isProject, isQuickPR, isReleasesOrTags, isRepo, isRepoCommitList, isRepoDiscussionList, isRepoIssueList, isRepoPRList, isRepoRoot, isRepoSearch, isRepoSettings, isRepoTaxonomyDiscussionList, isRepoTree, isRepoWithAccess, isSingleCommit, isSingleFile, isSingleGist, isSingleTagPage, isTrending, isUserProfile, isUserProfileRepoTab }; | ||
export { hasCode, hasComments, hasRichTextEditor, is404, is500, isActionJobRun, isActionPage, isBlame, isBranches, isCommit, isCommitList, isCompare, isConflict, isDashboard, isDiscussionList, isEditingFile, isEnterprise, isFileFinder, isForkedRepo, isGist, isGlobalDiscussionList, isGlobalSearchResults, isIssue, isLabelList, isMilestone, isMilestoneList, isNewIssue, isNewRelease, isNotifications, isOrganizationDiscussion, isOrganizationProfile, isOwnOrganizationProfile, isOwnUserProfile, isPR, isPRCommit, isPRCommitList, isPRConversation, isPRFiles, isPRList, isProject, isQuickPR, isReleasesOrTags, isRepo, isRepoCommitList, isRepoDiscussionList, isRepoIssueList, isRepoPRList, isRepoRoot, isRepoSearch, isRepoSettings, isRepoTaxonomyDiscussionList, isRepoTree, isRepoWithAccess, isSingleCommit, isSingleFile, isSingleGist, isSingleTagPage, isTrending, isUserProfile, isUserProfileRepoTab, utils }; |
{ | ||
"name": "github-url-detection", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29621
337
0