diff options
| author | zlg <zlg@zlg.space> | 2025-08-02 23:33:12 -0700 |
|---|---|---|
| committer | zlg <zlg@zlg.space> | 2025-08-02 23:33:12 -0700 |
| commit | 8f8ca7cc0ed420f3ee1fe0e672df4cc8a042ecf9 (patch) | |
| tree | 954a4f548910ce3d9606246fefac41b200b7d1db /src | |
| parent | setup.py: Add VGStash-Web to 'web' data directory (diff) | |
| download | vgstash-8f8ca7cc0ed420f3ee1fe0e672df4cc8a042ecf9.tar.gz vgstash-8f8ca7cc0ed420f3ee1fe0e672df4cc8a042ecf9.tar.bz2 vgstash-8f8ca7cc0ed420f3ee1fe0e672df4cc8a042ecf9.tar.xz vgstash-8f8ca7cc0ed420f3ee1fe0e672df4cc8a042ecf9.zip | |
vgstash-web: Include dates on default view displaysnext
All views now feature some way to represent the Purchase, Beaten, and
Completion dates for games.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vgstash/web/vgstash.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vgstash/web/vgstash.js b/src/vgstash/web/vgstash.js index 1b4046e..5f2fab7 100644 --- a/src/vgstash/web/vgstash.js +++ b/src/vgstash/web/vgstash.js @@ -66,6 +66,13 @@ function data_loaded(evt) { render(anchor, filter_vgs(gamecol, "all")); } +function ts_to_isodate(ts) { + if (ts == '' || ts == null) { + return ""; + } + return new Date(parseInt(ts) * 1000).toISOString().split("T")[0]; +} + function filter_vgs(vgscol, filter_name) { var new_col = new Array(); for (game in vgscol) { @@ -170,7 +177,7 @@ function render(target, vgscol) { if (current_filter == "backlog_age") { output = "<table>\n<colgroup>\n<col id=\"title_col\"></col>\n<col></col>\n<col></col>\n<col></col>\n<col></col>\n<col></col>\n</colgroup><thead>\n<th>Title</th>\n<th>System</th>\n<th>Ownership</th>\n<th>Progress</th>\n<th>Years</th>\n<th>Days</th>\n</thead>\n<tbody>\n"; } else { - output = "<table>\n<colgroup>\n<col id=\"title_col\"></col>\n<col></col>\n<col></col>\n<col></col>\n</colgroup><thead>\n<th>Title</th>\n<th>System</th>\n<th>Ownership</th>\n<th>Progress</th>\n</thead>\n<tbody>\n"; + output = "<table>\n<colgroup>\n<col id=\"title_col\"></col>\n<col></col>\n<col></col>\n<col></col>\n<col></col>\n<col></col>\n<col></col>\n</colgroup><thead>\n<th>Title</th>\n<th>System</th>\n<th>Ownership</th>\n<th>Progress</th>\n<th>Purchase Date</th>\n<th>Beaten Date</th>\n<th>Completion Date</th>\n</thead>\n<tbody>\n"; } for (var game in vgscol) { var has_notes = false; @@ -191,7 +198,7 @@ function render(target, vgscol) { if (current_filter == "backlog_age") { output += "<tr><td>" + ntitle + "</td><td>" + vgscol[game].system + "</td><td>" + own_map[vgscol[game].ownership] + "</td><td>" + prog_map[vgscol[game].progress] + "</td><td>" + vgscol[game].years.toString() + "</td><td>" + vgscol[game].days.toString() + "</td></tr>\n"; } else { - output += "<tr><td>" + ntitle + "</td><td>" + vgscol[game].system + "</td><td>" + own_map[vgscol[game].ownership] + "</td><td>" + prog_map[vgscol[game].progress] + "</td></tr>\n"; + output += "<tr><td>" + ntitle + "</td><td>" + vgscol[game].system + "</td><td>" + own_map[vgscol[game].ownership] + "</td><td>" + prog_map[vgscol[game].progress] + "</td><td>" + ts_to_isodate(vgscol[game].p_date) + "</td><td>" + ts_to_isodate(vgscol[game].b_date) + "</td><td>" + ts_to_isodate(vgscol[game].c_date) + "</td></tr>\n"; } } output += "\n</tbody>\n</table>\n"; |
