diff options
| author | User Content <content@content.events.ccc.de> | 2024-12-22 23:03:02 +0000 |
|---|---|---|
| committer | User Content <content@content.events.ccc.de> | 2024-12-22 23:03:02 +0000 |
| commit | 8f8a60a3b35020daedadfa041b01bda2fc163164 (patch) | |
| tree | 67be10057c9e8ddb7e8a0257edf79b9a7c110f8e /static/rater.js | |
| parent | df142fc3849671f8af421ff96a8a17e664c12318 (diff) | |
Introduce dark mode
Diffstat (limited to 'static/rater.js')
| -rw-r--r-- | static/rater.js | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/static/rater.js b/static/rater.js index ec1bcfe..495775f 100644 --- a/static/rater.js +++ b/static/rater.js | |||
| @@ -97,6 +97,14 @@ function fourcol() { | |||
| 97 | document.body.classList.remove('three-column'); | 97 | document.body.classList.remove('three-column'); |
| 98 | document.body.classList.toggle('four-column'); | 98 | document.body.classList.toggle('four-column'); |
| 99 | } | 99 | } |
| 100 | function darkmode() { | ||
| 101 | document.body.classList.remove('light-mode'); | ||
| 102 | document.body.classList.toggle('dark-mode'); | ||
| 103 | } | ||
| 104 | function lightmode() { | ||
| 105 | document.body.classList.remove('dark-mode'); | ||
| 106 | document.body.classList.toggle('light-mode'); | ||
| 107 | } | ||
| 100 | 108 | ||
| 101 | function invert_sort() { | 109 | function invert_sort() { |
| 102 | var evl = document.getElementById('event-list'); | 110 | var evl = document.getElementById('event-list'); |
| @@ -283,16 +291,35 @@ function do_take(eid) { | |||
| 283 | } | 291 | } |
| 284 | 292 | ||
| 285 | function update_status() { | 293 | function update_status() { |
| 286 | var accepted_count = document.querySelectorAll('.event-list-item[event_state=accepted]').length; | 294 | var accepted_count = document.querySelectorAll('.event-list-item[event_state=accepted]').length + document.querySelectorAll('.event-list-item[event_state=accepting]').length; |
| 287 | var rejected_count = document.querySelectorAll('.event-list-item[event_state=rejected]').length; | 295 | var rejected_count = document.querySelectorAll('.event-list-item[event_state=rejected]').length + document.querySelectorAll('.event-list-item[event_state=rejecting]').length; |
| 288 | var taken_count = document.querySelectorAll('.event-list-item .event-coordinator').length; | 296 | var taken_count = document.querySelectorAll('.event-list-item .event-coordinator').length; |
| 289 | var total_count = document.getElementsByClassName('event-list-item').length; | 297 | var total_count = document.getElementsByClassName('event-list-item').length; |
| 290 | var total_voted_count = document.querySelectorAll('.event-rating:first-child').length; | 298 | var total_voted_count = document.querySelectorAll('.event-rating:first-child').length; |
| 299 | var total_minute_count = 0; | ||
| 300 | document.querySelectorAll('.event-list-item[event_state=accepted]').forEach(function(ev) { | ||
| 301 | var event_duration = Number(ev.getAttribute('event_duration') || 0); | ||
| 302 | if (event_duration == 40) { | ||
| 303 | total_minute_count += 45; | ||
| 304 | } else { | ||
| 305 | total_minute_count += event_duration; | ||
| 306 | } | ||
| 307 | }); | ||
| 308 | document.querySelectorAll('.event-list-item[event_state=accepting]').forEach(function(ev) { | ||
| 309 | var event_duration = Number(ev.getAttribute('event_duration') || 0); | ||
| 310 | if (event_duration == 40) { | ||
| 311 | total_minute_count += 45; | ||
| 312 | } else { | ||
| 313 | total_minute_count += event_duration; | ||
| 314 | } | ||
| 315 | }); | ||
| 316 | |||
| 291 | var username = document.getElementById('Username').value; | 317 | var username = document.getElementById('Username').value; |
| 292 | var own_voted_count = 0; | 318 | var own_voted_count = 0; |
| 293 | if (username) | 319 | if (username) |
| 294 | own_voted_count = document.querySelectorAll('.event-rating[submitter="'+username+'"]').length; | 320 | own_voted_count = document.querySelectorAll('.event-rating[submitter="'+username+'"]').length; |
| 295 | document.getElementById('status').innerHTML = total_count + ' events. ' + accepted_count + ' accepted. ' + rejected_count + ' rejected. ' + (total_count - own_voted_count) + ' todo. ' + (total_count - total_voted_count) + ' unvoted. ' + (total_count - taken_count) + ' untaken.'; | 321 | document.getElementById('status').innerHTML = total_count + ' events. ' + accepted_count + ' accepted (' + Math.floor(total_minute_count / 60) + ':' + ('0'+(total_minute_count % 60)).slice(-2) + 'h). ' + rejected_count + ' rejected. ' + (total_count - own_voted_count) + ' todo. ' + (total_count - total_voted_count) + ' unvoted. ' + (total_count - taken_count) + ' untaken.'; |
| 322 | |||
| 296 | 323 | ||
| 297 | /* Do the math */ | 324 | /* Do the math */ |
| 298 | document.querySelectorAll('.event-list-item').forEach(function(ev) { | 325 | document.querySelectorAll('.event-list-item').forEach(function(ev) { |
