sindresorhus/refined-github

`default-branch-button` on forks: add secondary button to see folder on source repo #2985

fregante posted onGitHub

  1. Visit https://github.com/fregante/refined-github/blob/incremental-tag-changelog-link/source/background.ts
  2. There should be a << link to https://github.com/sindresorhus/refined-github/blob/master/source/background.ts

Example: (ignore the arrow)

<img width="507" alt="" src="https://user-images.githubusercontent.com/1402241/36968100-24f8f38c-2094-11e8-8393-6cc1d719950d.png">

How:

  1. Edit the get-default-branch function to accept a user/repo string (and it should only use parseBranchFromDom if the string matches the current page)
  2. Add the button on forks using the CSS code here: https://github.com/sindresorhus/refined-github/pull/1132

More issues semi-related to this one: https://github.com/sindresorhus/refined-github/pull/1115 https://github.com/sindresorhus/refined-github/pull/1168 https://github.com/sindresorhus/refined-github/pull/1557


I just realized that Unrelated Feature 😄 it exactly this!

Can I have a go for it?

Played around:

Version 1 image

Version 2 image

Version 3 image

posted by yakov116 almost 5 years ago
posted by fregante almost 5 years ago

Edit the get-default-branch function to accept a user/repo string (and it should only use parseBranchFromDom if the string matches the current page)

This is still valid and should be read.

posted by fregante almost 5 years ago

Part of default branch or its own feature?

posted by yakov116 almost 5 years ago

fork-source-link-same-view

posted by fregante almost 5 years ago

Edit the get-default-branch function to accept a user/repo string (and it should only use parseBranchFromDom if the string matches the current page)

Perhaps we can skip this and keep it simple by using HEAD as previously suggested.

posted by fregante almost 5 years ago

I think so, it kept it very simple and it follows the way we did it for forked to. However its your call chief

posted by yakov116 almost 5 years ago

Edit the get-default-branch function to accept a user/repo string (and it should only use parseBranchFromDom if the string matches the current page)

This is still valid and should be read.

i lost you with this one, how would this be different that using HEAD?

posted by yakov116 almost 5 years ago

Variant 5:

<img width="363" alt="Bildschirmfoto 2020-06-12 um 15 56 32" src="https://user-images.githubusercontent.com/184316/84510478-759d4f80-acc5-11ea-89f9-f543c4ad770e.png">

or with master branch:

<img width="351" alt="Bildschirmfoto 2020-06-12 um 15 59 37" src="https://user-images.githubusercontent.com/184316/84510970-23a8f980-acc6-11ea-99d1-88ac02412296.png">

then it is more clear that i can jump to a specific file or i can use the breadcrump higher directory to jump to this directory

because i think the link forked from ..../.... gets a blind spot because i tried it many times, but then i see this link is useless for me in this case to jump to the same file...

posted by muescha almost 5 years ago

gets a blind spot because i tried it many times

Happened to me today while trying out the feature.

In other words you dont realize you changed repo's since the page looks the same.

@fregante what if we add it any only <kbd>alt</kbd>?

posted by yakov116 almost 5 years ago

I made a POC https://github.com/yakov116/refined-github/tree/fork-source-link-same-view

Variant 5:

I think that will get too noisy on long paths

posted by yakov116 almost 5 years ago

long path also in a much bigger font above the file, so it is the same "noice" as the file name above the file, but in very small size

posted by muescha almost 5 years ago

I made a POC

This feature is 1 line long. No delegate needed.

const forkSource = select('fork source link')!;
forkSource.pathname = createLink(forkSource.textContent);

... ish, I think you'll need GitHubURL to replace the branch as well

posted by fregante almost 5 years ago
posted by yakov116 almost 5 years ago

If we change the pathname we mess up this line

export function getForkedRepo(): string | undefined {
-     return select<HTMLAnchorElement>('.fork-flag a')?.pathname.slice(1);
+     return select<HTMLAnchorElement>('.fork-flag a')?.pathname.slice(1).split('/', 2).join('/');
}
posted by fregante almost 5 years ago

Fund this Issue

$0.00
Funded

Pull requests