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

Function replace

source/features/extensible-nav.tsx:70–87  ·  view source on GitHub ↗
(nativeNav: HTMLElement)

Source from the content-addressed store, hash-verified

68}
69
70function replace(nativeNav: HTMLElement): void {
71 // Final check to avoid duplicates in any scenario.
72 if (elementExists('.rgh-extensible-nav')) {
73 return;
74 }
75
76 const items = $$('a', nativeNav);
77 nativeNav.before(
78 <nav className="UnderlineNav rgh-extensible-nav px-4">
79 <ul className="UnderlineNav-body">
80 {items.map(item => generateTab(item))}
81 </ul>
82 </nav>,
83 );
84
85 nativeNav.classList.add('rgh-extensible-nav-removed');
86 isReady = true;
87}
88
89async function initOnce(): Promise<void> {
90 // Use `element-ready` to ensure that the native navigation is fully loaded before replacing it for the first time.

Callers

nothing calls this directly

Calls 1

generateTabFunction · 0.85

Tested by

no test coverage detected