Skip to content

Commit 8849f9d

Browse files
committed
Improve kerning of duration display
1 parent 82f1e43 commit 8849f9d

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/junethack/helper.rb

+7-5
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,19 @@ def helper_get_score(key, variant)
100100
return repository.adapter.select "select (select login from users where user_id = id) as user, user_id, value, value_display from scoreentries where trophy = ? and variant = ? order by user;", key, variant
101101
end
102102

103-
def parse_seconds(duration=nil)
103+
def parse_seconds(duration = nil, separator: ' ')
104104
return "" if not duration
105+
105106
s = duration;
106107
m = s / 60;
107108
h = m / 60;
108109
d = h / 24;
109110
str = []
110-
str << "#{d} d" if d>0
111-
str << "#{h % 24} h" if h>0
112-
str << "#{m % 60} m" if m>0
113-
str << "#{s % 60} s" if s>0
111+
str << "<span class='duration'>#{d}#{separator}d</span>" if d > 0
112+
str << "<span class='duration'>#{h % 24}#{separator}h</span>" if h > 0
113+
str << "<span class='duration'>#{m % 60}#{separator}m</span>" if m > 0
114+
str << "<span class='duration'>#{s % 60}#{separator}s</span>" if s > 0
115+
114116
return str.join " "
115117
end
116118

views/player_scoreboard.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
%td{colspan: 2}
3737
%a{:href => "/user/" + CGI::escape(user)}=h user
3838
- if $competition_trophy_order[i] == :fastest_ascension_realtime
39-
%td.table_number= h parse_seconds(c[j].value)
39+
%td.table_number= parse_seconds(c[j].value)
4040
- else
4141
%td.table_number= c[j].value.html_formatted
4242
%td.table_number= h c[j].rank

views/splash.haml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
- if now < $tournament_starttime
88
-# show a (static) countdown to tournament start
99
.title_text
10-
%p= "Only #{parse_seconds $tournament_starttime - now} until the tournament starts!"
10+
%p= "Only #{parse_seconds($tournament_starttime - now, separator: '&hairsp;')} until the tournament starts!"
1111
- elsif now+86400*7 > $tournament_endtime and now < $tournament_endtime
1212
-# show informational text if there is only one week left in the tournament
1313
.title_text
14-
%p= "Only #{parse_seconds $tournament_endtime - now} until the tournament ends!"
14+
%p= "Only #{parse_seconds($tournament_endtime - now, separator: '&hairsp;')} until the tournament ends!"
1515
- if @logged_in
1616
- if $tournament_signupstarttime
1717
- if now > $tournament_signupstarttime && now < $tournament_endtime

0 commit comments

Comments
 (0)