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

Function init

source/features/swap-branches-on-compare.tsx:12–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 && location.pathname.includes('..');
11
12function init(): void {
13 const {path} = getRepo()!;
14
15 // `main...main` comparison
16 if (path === 'compare') {
17 return;
18 }
19
20 const references = path
21 .replace('compare/', '')
22 .split('...')
23 .toReversed();
24
25 // Compares against the "base" branch if the URL only has one reference
26 if (references.length === 1) {
27 references.unshift($('.branch span').textContent);
28 }
29
30 if (references[0] === references[1]) {
31 return;
32 }
33
34 const referencePicker = $('.range-editor .d-inline-block + .range-cross-repo-pair');
35 referencePicker.after(
36 <a className="btn btn-sm mx-2 tmp-mx-2" href={buildRepoUrl('compare/' + references.join('...'))}>
37 Swap
38 </a>,
39 );
40}
41
42void features.add(import.meta.url, {
43 include: [

Callers

nothing calls this directly

Calls 2

buildRepoUrlFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected