|
11 | 11 | <div class="items">
|
12 | 12 | <div id="bullseye-problems-autoplay">▶</div>
|
13 | 13 | </div>
|
| 14 | + <div class="items"> |
| 15 | + <div id="bullseye-problems-super-autoplay">▶▶</div> |
| 16 | + </div> |
14 | 17 | </div>
|
15 | 18 | </div>
|
16 | 19 | </div>
|
|
20 | 23 | <div id="bullseye-teams"></div>
|
21 | 24 | <div id="bullseye-nowexploiting">
|
22 | 25 | <div class="message">
|
23 |
| - <input type="text" value="Now evaluation" class="text"> |
| 26 | + <input type="text" value="Evaluating..." class="text" id="bullseye-notice-input"> |
24 | 27 | <!--<input type="time">-->
|
25 | 28 | </div>
|
26 | 29 | </div>
|
| 30 | +<div id="bullseye-loading"><div class="loader"></div></div> |
27 | 31 |
|
28 | 32 | <script type="text/x-jsrender" id="bullseye-template-problems-list">
|
29 | 33 | <div id="bullseye-problems-selected" class="bullseye-btn" data-problem-id="0">Select problem</div>
|
|
34 | 38 | </div>
|
35 | 39 | {{/for}}
|
36 | 40 | <div class="problems bullseye-panel-items" data-problem-id="-1" id="bullseye-nowexploiting-trigger">
|
37 |
| - <div class="name">Now exploting...</div> |
| 41 | + <div class="name">notice</div> |
38 | 42 | </div>
|
39 | 43 | </div>
|
40 | 44 | </script>
|
@@ -110,15 +114,16 @@ $(() => {
|
110 | 114 |
|
111 | 115 | let formatRound = (problem_id, round_id) => {
|
112 | 116 | if (PROBLEMS[problem_id]['round'][round_id] === undefined) {
|
113 |
| - return `R-` |
| 117 | + return `-` |
114 | 118 | }
|
115 | 119 |
|
| 120 | + let label = PROBLEMS[problem_id]['round'][round_id]['label'] |
116 | 121 | let start_date = new Date(Date.parse(PROBLEMS[problem_id]['round'][1]['start_at']))
|
117 | 122 | let date = new Date(Date.parse(PROBLEMS[problem_id]['round'][round_id]['start_at']))
|
118 | 123 | let day = (date.getDate() - start_date.getDate() + 1)
|
119 | 124 | let hour = ('0' + date.getHours()).slice(-2)
|
120 | 125 | let min = ('0' + date.getMinutes()).slice(-2)
|
121 |
| - return `R${round_id} (${day}day ${hour}:${min})` |
| 126 | + return `${label} (${day}day ${hour}:${min})` |
122 | 127 | }
|
123 | 128 |
|
124 | 129 | let selectProblem = (problem_id, current_round) => {
|
@@ -236,6 +241,34 @@ $(() => {
|
236 | 241 | localStorage.currentRound = current_round
|
237 | 242 | location.href = "<%= url_for :action => 'play' %>#" + first_id + '&' + mode + '&' + schedule_ids.join(',')
|
238 | 243 | })
|
| 244 | + |
| 245 | + $('#bullseye-problems-super-autoplay').click((e) => { |
| 246 | + if (confirm('PLAY ALL PROBLEMS, YES?') === false) { |
| 247 | + return |
| 248 | + } |
| 249 | + |
| 250 | + let current_round = getRound() |
| 251 | + let schedule_ids = [] |
| 252 | + for (let problem_id in PROBLEMS) { |
| 253 | + for (let schedule_team_id in PROBLEMS[problem_id]['round'][current_round]['team_result']) { |
| 254 | + schedule_id = PROBLEMS[problem_id]['round'][current_round]['team_result'][schedule_team_id] |
| 255 | + schedule_ids.push(schedule_id) |
| 256 | + setPlayed(schedule_team_id, schedule_id, problem_id, current_round) |
| 257 | + } |
| 258 | + } |
| 259 | + |
| 260 | + if (schedule_ids.length === 0) { |
| 261 | + alert('This round result not found') |
| 262 | + return |
| 263 | + } |
| 264 | + |
| 265 | + schedule_ids.sort(() => { return Math.random() - .5 }) // what?? |
| 266 | + let first_id = schedule_ids.shift() |
| 267 | + let mode = $('#bullseye-problems-mode').text() === 'play' ? 'play' : 'skip' |
| 268 | + |
| 269 | + localStorage.currentRound = current_round |
| 270 | + location.href = "<%= url_for :action => 'play' %>#" + first_id + '&' + mode + '&' + schedule_ids.join(',') |
| 271 | + }) |
239 | 272 |
|
240 | 273 | if (localStorage.currentProblemId !== undefined) {
|
241 | 274 | selectProblem(localStorage.currentProblemId, localStorage.currentRound)
|
@@ -297,19 +330,43 @@ $(() => {
|
297 | 330 | })
|
298 | 331 | }
|
299 | 332 |
|
| 333 | + $('#bullseye-notice-input').change((e) => { |
| 334 | + let self = $(e.currentTarget) |
| 335 | + localStorage.notice = self.val() |
| 336 | + self.blur() |
| 337 | + }) |
| 338 | + if (localStorage.notice) { |
| 339 | + $('#bullseye-notice-input').val(localStorage.notice) |
| 340 | + } |
| 341 | + |
| 342 | + /** |
| 343 | + * loading |
| 344 | + */ |
| 345 | + let _loading = 2 |
| 346 | + |
| 347 | + let endLoading = () => { |
| 348 | + _loading-- |
| 349 | + if (_loading <= 0) { |
| 350 | + $('#bullseye-loading').hide() |
| 351 | + } |
| 352 | + } |
| 353 | + |
| 354 | + $('#bullseye-loading').show() |
300 | 355 | $.getJSON(CONFIG.API_BASE + '/teams.json', (r) => {
|
| 356 | + localStorage.teams = JSON.stringify(r) |
301 | 357 | loadTeams(r)
|
| 358 | + endLoading() |
302 | 359 | })
|
303 |
| - |
304 | 360 | $.getJSON(CONFIG.API_BASE + '/problems.json', (r) => {
|
| 361 | + localStorage.problems = JSON.stringify(r) |
305 | 362 | PROBLEMS = r
|
306 | 363 | for (let problem_id in r) {
|
307 | 364 | let round = Object.keys(r[problem_id]['round'])
|
308 | 365 | PROBLEMS[problem_id]['min_round'] = Math.min(...round)
|
309 | 366 | PROBLEMS[problem_id]['max_round'] = Math.max(...round)
|
310 | 367 | }
|
311 | 368 | loadProblems()
|
| 369 | + endLoading() |
312 | 370 | })
|
313 |
| - |
314 | 371 | })
|
315 | 372 | </script>
|
0 commit comments