3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHubのDownload ZIPボタンを書き換えてtar.gzをダウンロードする

Last updated at Posted at 2016-02-05

はじめに

GitHubには、tar.gzでダウンロードできるurlが存在します。

が、しかし。ブラウザでの閲覧時にはそのボタンはありません。

よし、[DOWNLOAD ZIP] を書き換えてしまえ

bookmarklet
javascript: $('a[data-ga-click="Repository, download zip, location:repo overview"]').each((i,a) => { a.innerHTML = "Download TARBALL"; a.href=a.href.replace(/.zip$/, '.tar.gz'); a.setAttribute('data-ga-click', a.getAttribute('data-ga-click').replace(/zip/, 'tar.gz'))})
生コード
$('a[data-ga-click="Repository, download zip, location:repo overview"]').each(
  (i,a) => {
    a.innerHTML = "Download TARBALL";
    a.href = a.href.replace(/.zip$/, '.tar.gz');
    a.setAttribute('data-ga-click',
      a.getAttribute('data-ga-click').replace(/zip/, 'tar.gz'))})

押すと[DOWNLOAD ZIP][DOWNLOAD TARBALL]になります。

以上です。

ツッコミどころ

  • わざわざボタンを書き換えずにそのままダウンロードさせればいいのでは
  • どうせやるなら HTTPS/SSH みたいな切り替えボタンにできないか?
  • そもそもブラウザから見てるときにtar.gzで欲しくなる事ってあるの?
3
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?