sindresorhus/refined-github

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Maybe remove `copy-file`? #4802

aheckler posted onGitHub

Description

GitHub has just added a button that does the same thing:

https://github.blog/changelog/2021-09-20-quickly-copy-the-contents-of-a-file-to-the-clipboard/

This would seem to make copy-file unnecessary, but I'm not sure what the usual procedure is when this happens.

Screenshot

Markup on 2021-09-20 at 20:04:06

Example URL

https://github.com/sindresorhus/refined-github/blob/main/readme.md


Neat! Too bad GitHub doesn’t show it on mobile though… where Refined GitHub does 😃

DE6F612D-899F-43DA-B43F-D896ACEC2C73

posted by fregante over 3 years ago

Weird, I'm not seeing this new button… Maybe it's still in A/B testing or something.

posted by cheap-glitch over 3 years ago

@cheap-glitch Which browser are you using? The GitHub post I linked in the OP does say:

This feature is available in most desktop web browsers.

So if you're using an uncommon browser, maybe that's the reason?

posted by aheckler over 3 years ago

I think they're hiding it based on the useragent 😬 because it's not showing on the iPhone or if I set the "iPhone emulator" and then refresh. It's not in the DOM at all in this case.

This is the DOM:

<remote-clipboard-copy
  class="d-inline-block btn-octicon"
  style="height: 26px"
  data-src="/sindresorhus/refined-github/raw/main/source/features/copy-file.tsx"
  data-action="click:remote-clipboard-copy#remoteCopy"
  data-catalyst=""
  data-state-timeout="2000"
>
  <span data-target="remote-clipboard-copy.idle">
    <span
      class="tooltipped tooltipped-nw cursor-pointer"
      data-hydro-click='{"event_type":"repository.click","payload":{"target":"COPY_RAW_CONTENTS_BUTTON","repository_id":51769689,"originating_url":"https://github.com/sindresorhus/refined-github/blob/main/source/features/copy-file.tsx","user_id":1402241}}'
      data-hydro-click-hmac="12da438f6ff44d0d3af85f82a48275627536db86476c3fdc0bb12ee000d15f38"
      aria-label="Copy raw contents"
    >
      {ICON} </span
  ></span>
  <span data-target="remote-clipboard-copy.fetching" hidden="">
    {ICON}
  </span>
  <span data-target="remote-clipboard-copy.success" hidden="">
    <span class="tooltipped tooltipped-nw" aria-label="Copied!">
      {ICON}
    </span>
  </span>
  <span data-target="remote-clipboard-copy.error" hidden="">
    <span
      class="tooltipped tooltipped-nw"
      aria-label="Something went wrong. Try again."
    >
      {ICON}
    </span>
  </span>
</remote-clipboard-copy>
posted by fregante over 3 years ago

I'm using Firefox and not seeing it

posted by gamemaker1 over 3 years ago

This doesn't seem to be on Gists yet.

CSS to hide Refined GitHub's copy button on main site (but not Gists):

.page-blob .rgh-copy-file {
    display: none;
}

.page-blob .rgh-copy-file + .btn {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}
posted by kidonng over 3 years ago

So… GitHub’s feature is slower because it (will) probably work on partial diffs as well, whereas ours only works if the full file is available on the page.

Suggestion:

  • keep the feature, but override GitHub’s button where we can, to make it instantaneous.

copy-file -> quick-file-copy 😃

posted by fregante over 3 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests