Skip to content

Commit 92367f1

Browse files
committed
Fix injected buttons on GitHub repo page and GitHub commit page
1 parent 83c8303 commit 92367f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/hosts/github.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export function injectionScope(url: string, gkDotDevUrl: string) {
7676
const [, , , type] = this.uri.pathname.split('/');
7777
switch (type) {
7878
case 'commit':
79-
insertions.set('.commit > * #browse-at-time-link', {
79+
// Insert button right before the "Browser files" button
80+
insertions.set('[aria-label="Browse the repository at this point in the history"]', {
8081
// This is inside a flexbox, so ml-auto adds a ballooning margin that pushes the element to the right
8182
html: /*html*/ `<a data-gk class="btn px-2 ml-auto flex-self-start" style="padding-top:2px !important; padding-bottom:1px !important;" href="${openUrl}" target="_blank" title="${label}" aria-label="${label}">${this.getGitKrakenSvg(
8283
22,
@@ -168,7 +169,8 @@ export function injectionScope(url: string, gkDotDevUrl: string) {
168169
position: 'afterend',
169170
});
170171

171-
insertions.set('#__primerPortalRoot__ > div > div > div > ul > div > ul > li:first-child', {
172+
// Insert button inside the "Code" modal
173+
insertions.set('#__primerPortalRoot__ > div > div > ul > div > ul > li:first-child', {
172174
html: /*html*/ `<li data-gk class="Box-row Box-row--hover-gray p-3 mt-0 rounded-0">
173175
<a class="d-flex flex-items-center color-fg-default text-bold no-underline" href="${openUrl}" target="_blank" title="${label}" aria-label="${label}">
174176
${this.getGitKrakenSvg(16, 'mr-2')}

0 commit comments

Comments
 (0)