for debian cgit package version 1.1+git2.10.2-3.1

形式
Diff
投稿日時
2018-10-05 04:09
公開期間
無期限
  1. --- a/ui-commit.c
  2. +++ b/ui-commit.c
  3. @@ -55,8 +55,7 @@
  4. }
  5. cgit_close_filter(ctx.repo->email_filter);
  6. html("</td><td class='right'>");
  7. - html_txt(show_date(info->author_date, info->author_tz,
  8. - cgit_date_mode(DATE_ISO8601)));
  9. + cgit_print_date_pretty(info->author_date, info->author_tz);
  10. html("</td></tr>\n");
  11. html("<tr><th>committer</th><td>");
  12. cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit");
  13. @@ -67,8 +66,7 @@
  14. }
  15. cgit_close_filter(ctx.repo->email_filter);
  16. html("</td><td class='right'>");
  17. - html_txt(show_date(info->committer_date, info->committer_tz,
  18. - cgit_date_mode(DATE_ISO8601)));
  19. + cgit_print_date_pretty(info->committer_date, info->committer_tz);
  20. html("</td></tr>\n");
  21. html("<tr><th>commit</th><td colspan='2' class='sha1'>");
  22. tmp = oid_to_hex(&commit->object.oid);
  23. --- a/ui-shared.c
  24. +++ b/ui-shared.c
  25. @@ -615,6 +615,26 @@
  26. return &mode;
  27. }
  28. +void cgit_print_date_pretty(unsigned long date, int tz){
  29. + char buf[64] = {0};
  30. + int tzoffset;
  31. + tzoffset = tz < 0 ? -tz : tz;
  32. + tzoffset = (tzoffset / 100) * 60 + tzoffset % 100;
  33. + tzoffset = tz < 0 ? -tzoffset : tzoffset;
  34. + tzoffset *= 60;
  35. + html_txt(show_date(date, tz, cgit_date_mode(DATE_ISO8601)));
  36. + date += tzoffset;
  37. + if(date / 3600 % 24 < 6){
  38. + snprintf(buf, sizeof(buf),
  39. + " (<span class=\"atnight\">%02d:%02d</span> %+05d)",
  40. + (int)(date / 3600 % 24), (int)(date / 60 % 60), tz);
  41. + }else{
  42. + snprintf(buf, sizeof(buf), " (%02d:%02d %+05d)",
  43. + (int)(date / 3600 % 24), (int)(date / 60 % 60), tz);
  44. + }
  45. + html(buf);
  46. +}
  47. +
  48. static void print_rel_date(time_t t, int tz, double value,
  49. const char *class, const char *suffix)
  50. {
  51. --- a/ui-shared.h
  52. +++ b/ui-shared.h
  53. @@ -62,6 +62,7 @@
  54. __attribute__((format (printf,1,0)))
  55. extern void cgit_vprint_error(const char *fmt, va_list ap);
  56. extern const struct date_mode *cgit_date_mode(enum date_mode_type type);
  57. +extern void cgit_print_date_pretty(unsigned long date, int tz);
  58. extern void cgit_print_age(time_t t, int tz, time_t max_relative);
  59. extern void cgit_print_http_headers(void);
  60. extern void cgit_redirect(const char *url, bool permanent);
  61. --- a/ui-tag.c
  62. +++ b/ui-tag.c
  63. @@ -77,8 +77,7 @@
  64. htmlf(" (%s)</td></tr>\n", oid_to_hex(&oid));
  65. if (info->tagger_date > 0) {
  66. html("<tr><td>tag date</td><td>");
  67. - html_txt(show_date(info->tagger_date, info->tagger_tz,
  68. - cgit_date_mode(DATE_ISO8601)));
  69. + cgit_print_date_pretty(info->tagger_date, info->tagger_tz);
  70. html("</td></tr>\n");
  71. }
  72. if (info->tagger) {
  73. --- a/cgit.css
  74. +++ b/cgit.css
  75. @@ -867,3 +867,7 @@
  76. div#cgit table.blob .kwb { color:#0057ae; }
  77. div#cgit table.blob .kwc { color:#000000; font-weight:bold; }
  78. div#cgit table.blob .kwd { color:#010181; }
  79. +
  80. +div#cgit span.atnight {
  81. + color: #c00;
  82. +}
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト