MCPcopy
hub / github.com/refined-github/refined-github / add

Function add

source/features/repo-avatars.tsx:11–36  ·  view source on GitHub ↗
(ownerLabel: HTMLElement)

Source from the content-addressed store, hash-verified

9import observe from '../helpers/selector-observer.js';
10
11async function add(ownerLabel: HTMLElement): Promise<void> {
12 // TODO [2026-07-01]: Drop
13 const isOldNavbar = ownerLabel.classList.contains('AppHeader-context-item-label');
14
15 const username = getRepo()!.owner;
16 const size = 16;
17 const source = getUserAvatar(username, size)!;
18
19 const avatar = (
20 <img
21 className={cx('d-none d-md-block avatar mr-2 tmp-mr-2', isOldNavbar && 'ml-1 tmp-ml-1')}
22 src={source}
23 width={size}
24 height={size}
25 alt={`@${username}`}
26 />
27 );
28
29 (isOldNavbar ? ownerLabel : ownerLabel.parentElement!).classList.add('d-flex', 'flex-items-center');
30
31 ownerLabel.prepend(avatar);
32
33 if (!pageDetect.isOrganizationRepo()) {
34 avatar.classList.add('avatar-user');
35 }
36}
37
38function init(signal: AbortSignal): void {
39 observe(

Callers

nothing calls this directly

Calls 2

getUserAvatarFunction · 0.85
prependMethod · 0.80

Tested by

no test coverage detected