github-url-detection 9.0.2 → 9.0.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.
@@ -48,24 +48,33 @@ var isPRConversation = (url = location) => /^pull\/\d+$/.test(getRepo(url)?.path
48
48
  var isPRCommitList = (url = location) => /^pull\/\d+\/commits$/.test(getRepo(url)?.path);
49
49
  var isPRFiles = (url = location) => /^pull\/\d+\/files/.test(getRepo(url)?.path) || isPRCommit(url);
50
50
  var isQuickPR = (url = location) => isCompare(url) && /[?&]quick_pull=1(&|$)/.test(url.search);
51
- var prStateSelector = [
51
+ var stateSelector = [
52
52
  ".State",
53
- '[class^="StateLabel"]'
53
+ '[data-testid="header-state"]'
54
54
  ].join(",");
55
- var isDraftPR = () => $(prStateSelector).textContent.trim() === "Draft";
55
+ var isDraftPR = () => $(stateSelector)?.textContent.trim() === "Draft";
56
56
  var isOpenPR = () => {
57
- const status = $(prStateSelector).textContent.trim();
57
+ if (!isPR()) {
58
+ return false;
59
+ }
60
+ const status = $(stateSelector).textContent.trim();
58
61
  return status === "Open" || status === "Draft";
59
62
  };
60
- var isMergedPR = () => {
61
- const status = $(prStateSelector).textContent.trim();
62
- return status === "Merged";
63
- };
63
+ var isMergedPR = () => $(stateSelector)?.textContent.trim() === "Merged";
64
64
  var isClosedPR = () => {
65
- const status = $(prStateSelector).textContent.trim();
65
+ if (!isPR()) {
66
+ return false;
67
+ }
68
+ const status = $(stateSelector).textContent.trim();
66
69
  return status === "Closed" || status === "Merged";
67
70
  };
68
- var isClosedIssue = () => exists("#partial-discussion-header :is(.octicon-issue-closed, .octicon-skip)");
71
+ var isClosedIssue = () => {
72
+ if (!isIssue()) {
73
+ return false;
74
+ }
75
+ const status = $(stateSelector).textContent.trim();
76
+ return status === "Closed" || status === "Closed as not planned";
77
+ };
69
78
  var isReleases = (url = location) => getRepo(url)?.path === "releases";
70
79
  var isTags = (url = location) => getRepo(url)?.path === "tags";
71
80
  var isSingleReleaseOrTag = (url = location) => Boolean(getRepo(url)?.path.startsWith("releases/tag"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-url-detection",
3
- "version": "9.0.2",
3
+ "version": "9.0.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",