blob: b7095c26c6ead84afb962b1c2f246d2036a864ab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import React from 'dom-chef';
import select from 'select-dom';
import onetime from 'onetime';
import {observe} from 'selector-observer';
import * as pageDetect from 'github-url-detection';
import features from '.';
import {wrapAll} from '../helpers/dom-utils';
function init(): void {
for (const link of select.all<HTMLAnchorElement>('.js-issue-row a[aria-label*="comment"], .js-pinned-issue-list-item a[aria-label*="comment"]')) {
link.hash = '#partial-timeline';
}
}
function initDashboard(): void {
observe('.js-recent-activity-container :not(a) > div > .octicon-comment', {
add(icon) {
const url = icon.closest('li')!.querySelector('a')!.pathname + '#partial-timeline';
icon.parentElement!.classList.remove('col-1'); // Also fix extra space added by GitHub #3174
wrapAll([icon, icon.nextSibling!], <a className="muted-link" href={url}/>);
}
});
}
void features.add(__filebasename, {
include: [
pageDetect.isConversationList
],
init
}, {
include: [
pageDetect.isDashboard
],
init: onetime(initDashboard)
});
|