summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json16
-rw-r--r--package.json2
-rw-r--r--source/features/reactions-avatars.tsx30
3 files changed, 22 insertions, 26 deletions
diff --git a/package-lock.json b/package-lock.json
index 057c51d9..153cf75c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,7 +19,7 @@
"filter-altered-clicks": "^2.0.0",
"fit-textarea": "^2.0.0",
"flat-zip": "^1.0.1",
- "github-url-detection": "^6.1.0",
+ "github-url-detection": "^7.0.1-0",
"image-promise": "^7.0.1",
"indent-textarea": "^2.1.1",
"js-abbreviation-number": "^1.4.0",
@@ -4796,11 +4796,11 @@
"integrity": "sha512-T2azXbRJTJGQc28G6x89LpzQmuVjzl0hzJXPRD2t9yMh7URYUW8Opqr5ptHvjAVDJ+hwhBtoYmVx3VyFawRoFg=="
},
"node_modules/github-url-detection": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/github-url-detection/-/github-url-detection-6.1.0.tgz",
- "integrity": "sha512-Z2z3WmR38cbHegKHN3jiyo2wDBEPRlEn/8HHK05iidiHtNF8KltmjKiaNzB3QdGU+OxF2QhgwT1q4rLT15Z08w==",
+ "version": "7.0.1-0",
+ "resolved": "https://registry.npmjs.org/github-url-detection/-/github-url-detection-7.0.1-0.tgz",
+ "integrity": "sha512-umFshV+FkdsRjR6TKo0senmCep5h9JGqV6TmajRgUI+adF+SWSIledRMkKy9zO7n2Y+GwnNIixrXi3tPm2xGpw==",
"engines": {
- "node": ">=14"
+ "node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/fregante"
@@ -14494,9 +14494,9 @@
"integrity": "sha512-T2azXbRJTJGQc28G6x89LpzQmuVjzl0hzJXPRD2t9yMh7URYUW8Opqr5ptHvjAVDJ+hwhBtoYmVx3VyFawRoFg=="
},
"github-url-detection": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/github-url-detection/-/github-url-detection-6.1.0.tgz",
- "integrity": "sha512-Z2z3WmR38cbHegKHN3jiyo2wDBEPRlEn/8HHK05iidiHtNF8KltmjKiaNzB3QdGU+OxF2QhgwT1q4rLT15Z08w=="
+ "version": "7.0.1-0",
+ "resolved": "https://registry.npmjs.org/github-url-detection/-/github-url-detection-7.0.1-0.tgz",
+ "integrity": "sha512-umFshV+FkdsRjR6TKo0senmCep5h9JGqV6TmajRgUI+adF+SWSIledRMkKy9zO7n2Y+GwnNIixrXi3tPm2xGpw=="
},
"glob": {
"version": "7.2.0",
diff --git a/package.json b/package.json
index f568c6e7..a1b9e403 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
"filter-altered-clicks": "^2.0.0",
"fit-textarea": "^2.0.0",
"flat-zip": "^1.0.1",
- "github-url-detection": "^6.1.0",
+ "github-url-detection": "^7.0.1-0",
"image-promise": "^7.0.1",
"indent-textarea": "^2.1.1",
"js-abbreviation-number": "^1.4.0",
diff --git a/source/features/reactions-avatars.tsx b/source/features/reactions-avatars.tsx
index 8fe61cef..f03997cb 100644
--- a/source/features/reactions-avatars.tsx
+++ b/source/features/reactions-avatars.tsx
@@ -58,7 +58,8 @@ const viewportObserver = new IntersectionObserver(changes => {
});
function showAvatarsOn(commentReactions: Element): void {
- const avatarLimit = arbitraryAvatarLimit - (commentReactions.children.length * approximateHeaderLength);
+ const reactionTypes = select.all('.social-reaction-summary-item', commentReactions).length;
+ const avatarLimit = arbitraryAvatarLimit - (reactionTypes * approximateHeaderLength);
const participantByReaction = select
.all(':scope > button.social-reaction-summary-item', commentReactions)
@@ -74,21 +75,12 @@ function showAvatarsOn(commentReactions: Element): void {
}
}
-// TODO [2022-12-18]: Drop `.comment-reactions-options` (GHE)
-const reactionsSelector = '.has-reactions :is(.js-comment-reactions-options, .comment-reactions-options):not(.rgh-reactions)';
-
function observeCommentReactions(commentReactions: Element): void {
- commentReactions.classList.add('rgh-reactions');
viewportObserver.observe(commentReactions);
}
function init(signal: AbortSignal): void {
- observe(reactionsSelector, observeCommentReactions, {signal});
- onAbort(signal, viewportObserver);
-}
-
-function discussionInit(signal: AbortSignal): void {
- observe(reactionsSelector, observeCommentReactions, {signal});
+ observe('.has-reactions .js-comment-reactions-options', observeCommentReactions, {signal});
onAbort(signal, viewportObserver);
}
@@ -96,13 +88,17 @@ void features.add(import.meta.url, {
include: [
pageDetect.hasComments,
pageDetect.isReleasesOrTags,
- ],
- awaitDomReady: false,
- init,
-}, {
- include: [
pageDetect.isDiscussion,
],
awaitDomReady: false,
- init: discussionInit,
+ init,
});
+
+/*
+Test URLs
+
+https://github.com/refined-github/refined-github/pull/4119
+https://github.com/parcel-bundler/parcel/discussions/6490
+https://github.com/orgs/community/discussions/11202
+
+*/