diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2019-10-04 18:18:23 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2019-10-04 18:18:23 +0200 |
commit | b29e7396e952128a6feb4ad0e1d830fe3af43e64 (patch) | |
tree | 8a4c06b98bbec605867c4c9b14056341c493701d | |
parent | 64698f0860a131cb2db06f5ab10267f972a22ac3 (diff) | |
download | ramaskrik-social-ravenheart/2019.tar.gz ramaskrik-social-ravenheart/2019.tar.bz2 ramaskrik-social-ravenheart/2019.zip |
Add times to movie boxes.ravenheart/2019
-rw-r--r-- | public/js/app.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/public/js/app.js b/public/js/app.js index 821b0c1..9608aaa 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -67,6 +67,10 @@ window.addEventListener("load", function() { return [ f.format(hour), f.format(min) ].join(':') } + function time_f(t) { + _sec_to_time(_time_to_sec(t)) + } + function break_text(c, text, x, y, width) { let len = c.measureText(text).width if (len < width) { @@ -134,8 +138,10 @@ window.addEventListener("load", function() { c.strokeStyle = '#cfc' for (let s of screenings) { - let ystart = Math.ceil((_time_to_sec(s.start_time) - start_time) / 30) + margin; - let height = Math.ceil((_time_to_sec(_end_time(s)) - start_time ) / 30) + margin - ystart; + let stt = _time_to_sec(s.start_time) + let ett = _time_to_sec(_end_time(s)) + let ystart = Math.ceil((stt - start_time) / 30) + margin; + let height = Math.ceil((ett - start_time ) / 30) + margin - ystart; let ri = s.room.id - 1 let xstart = xmargin + ri * 150 @@ -143,9 +149,12 @@ window.addEventListener("load", function() { c.fillRect(xstart, ystart, 100, height) c.strokeRect(xstart, ystart, 100, height) - c.font = '12px sans-serif' c.fillStyle = '#000' - break_text(c, s.film.title, xstart + 5, ystart + 15, 90) + c.font = '10px sans-serif' + c.fillText(_sec_to_time(stt) + " - " + _sec_to_time(ett), xstart + 5, ystart + 10) + + c.font = '12px sans-serif' + break_text(c, s.film.title, xstart + 5, ystart + 25, 90) } } |