diff options
author | 2022-03-03 17:03:00 +0100 | |
---|---|---|
committer | 2022-03-04 00:03:00 +0800 | |
commit | e8c4d91fb4147eaa66a9e9b2e18dba76044ff188 (patch) | |
tree | e3c23f5e883024d68eb264aedf402d4b802bf3d4 | |
parent | e075a07164a293b902b78706b8d504a396b2407b (diff) | |
download | refined-github-e8c4d91fb4147eaa66a9e9b2e18dba76044ff188.tar.gz refined-github-e8c4d91fb4147eaa66a9e9b2e18dba76044ff188.tar.zst refined-github-e8c4d91fb4147eaa66a9e9b2e18dba76044ff188.zip |
Toggle `details` in issues/PRs with `toggle-everything-with-alt` (#5451)22.3.3
-rw-r--r-- | source/features/toggle-everything-with-alt.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/features/toggle-everything-with-alt.tsx b/source/features/toggle-everything-with-alt.tsx index 731cc445..b4d35c16 100644 --- a/source/features/toggle-everything-with-alt.tsx +++ b/source/features/toggle-everything-with-alt.tsx @@ -21,6 +21,11 @@ const collapseSelector = '.js-file .js-collapse-diff'; const commitMessageSelector = '.TimelineItem .ellipsis-expander'; +function markdownCommentSelector(clickedItem: HTMLElement): string { + const {id} = clickedItem.closest('.TimelineItem-body[id]')!; + return `#${id} .markdown-body details > summary`; +} + function init(): void { // Collapsed comments in PR conversations and files delegate(document, '.minimized-comment details summary', 'click', clickAll(minimizedCommentsSelector)); @@ -37,6 +42,9 @@ function init(): void { // Commit message buttons in commit lists and PR conversations delegate(document, commitMessageSelector, 'click', clickAll(commitMessageSelector)); + + // <details> elements in issue/PR comment Markdown content + delegate(document, '.TimelineItem-body[id] .markdown-body details > summary', 'click', clickAll(markdownCommentSelector)); } void features.add(import.meta.url, { |