LoginSignup
18
16

More than 5 years have passed since last update.

GitHub の「... days ago」みたいな所を日時表示に展開するブックマークレット

Last updated at Posted at 2015-07-02

概要

GitHub 内の至る所で表示される日時が「~ days ago」ってなってるのが正直しっくり来ない。これをぜんぶ年月日時分秒に差し替えるブックマークレットを作った。

1.png
 ↓↓
2.png

ブックマークレット

github-date-expand-bookmarklet
javascript:(function(){$('time').each(function(){var t = new Date($(this).attr('datetime'));var full = '';full += t.getFullYear() + '/';full += ('0' + (t.getMonth() + 1)).slice(-2) + '/';full += ('0' + t.getDate()).slice(-2) + ' ';full += ('0' + t.getHours()).slice(-2) + ':';full += ('0' + t.getMinutes()).slice(-2) + ':';full += ('0' + t.getSeconds()).slice(-2);$(this).text(full);});})();

生コード

github-date-expand.js
$('time').each(function(){
    var t = new Date($(this).attr('datetime'));
    var full = '';
    full += t.getFullYear() + '/';
    full += ('0' + (t.getMonth() + 1)).slice(-2) + '/';
    full += ('0' + t.getDate()).slice(-2) + ' ';
    full += ('0' + t.getHours()).slice(-2) + ':';
    full += ('0' + t.getMinutes()).slice(-2) + ':';
    full += ('0' + t.getSeconds()).slice(-2);
    $(this).text(full);
});

参考

18
16
0

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
18
16