()
| 10 | && location.pathname.includes('..'); |
| 11 | |
| 12 | function 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 | |
| 42 | void features.add(import.meta.url, { |
| 43 | include: [ |
nothing calls this directly
no test coverage detected