LoginSignup
6
2

More than 5 years have passed since last update.

Githubの芝を短いコードでAAにする

Posted at

コード

for(r=w='';w--+7;r+='\n')$$('.day').map((v,i)=>i%7-~w?0:r+='口圏国因囚'[-~v.attributes[5].value[5]>>1]);r

実行

  • Chromeで任意のGithubアカウントのページを開き、Consoleで上記コードを実行するとAAが得られます
    • サンプルに使用したのは、芝で絵を描くツール(skazhy/github-decorator)のテストアカウント

スクリーンショット 2019-04-17 2.48.26.png

解説

最初はdata-count属性(contribute数)で判別していましたが、場合によって閾値が変わるようだったので没に。
fill属性(色)の5桁目が都合良くバラけていたのでそれを利用しています。

色(v.attributes[5].value) -~v.attributes[5].value[5]>>1
#ebedf0 0
#c6e48b 4
#7bc96f 3
#239a3b 2
#196127 1

終わりに

JSゴルフは不慣れなので、短縮できたら教えて頂けると嬉しいです。

6
2
2

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
6
2