Add linkify-user-edit-history-popup feature#3412
Add linkify-user-edit-history-popup feature#3412fregante merged 9 commits intorefined-github:masterfrom
linkify-user-edit-history-popup feature#3412Conversation
dc271d3 to
9751c74
Compare
| observe('details-dialog .Box-header .mr-3 img', { | ||
| add(element) { | ||
| const userName = (element as HTMLImageElement).alt.slice(1); | ||
| if (userName.includes('[bot]')) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
| observe('details-dialog .Box-header .mr-3 img', { | |
| add(element) { | |
| const userName = (element as HTMLImageElement).alt.slice(1); | |
| if (userName.includes('[bot]')) { | |
| return; | |
| } | |
| observe<HTMLImageElement>('details-dialog .Box-header .mr-3 img:not([alt*="[bot]"])', { | |
| add(element) { | |
| const userName = element.alt.slice(1); |
There was a problem hiding this comment.
The image generic type doesn't seem to work due to https://github.com/josh/selector-observer/issues/29
Co-authored-by: Federico <opensource@bfred.it>
fregante
left a comment
There was a problem hiding this comment.
This also needs a way to avoid being applied twice... unless you can verify that that never happens (e.g. open/close the popup many times, switch comment, etc)
|
The box is regenerated each time you open it. |
| pageDetect.isIssue, | ||
| pageDetect.isPRConversation | ||
| ], | ||
| repeatOnAjax: false |
There was a problem hiding this comment.
I realized that this can be improved (separately). The logic shouldn't be "repeat on ajax", but just "don't run more than once"
| repeatOnAjax: false | |
| once: true |
This would solve the issues we had elsewhere because repeatOnAjax: false also prevents the include filters to run
|
I tested it. Github regenerates the box each time so it needs to be replaced no need to add a class. |
| add(avatar) { | ||
| const userName = (avatar as HTMLImageElement).alt.slice(1); |
There was a problem hiding this comment.
| add(avatar) { | |
| const userName = (avatar as HTMLImageElement).alt.slice(1); | |
| constructor: HTMLImageElement, | |
| add(avatar) { | |
| const userName = avatar.alt.slice(1); |

LINKED ISSUES:
Closes Linkify users in edit history popup #2161
TEST URLS:
[Request] Update fork button Mottie/GitHub-userscripts#88 (comment) (with bot and should not be linkified)
Fix empty API query error in
pr-branches#1766 (comment)This pull request
SCREENSHOT:
