Skip to content

Commit 687a29e

Browse files
committed
add super auto play
1 parent c7e379c commit 687a29e

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

app/assets/stylesheets/viewer.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,16 @@ h1, h1 a, #bullseye-logo a {
255255
background: rgba(64,64,64,0.6);
256256
}
257257

258-
#bullseye-problems-autoplay {
258+
#bullseye-problems-autoplay, #bullseye-problems-super-autoplay {
259259
color: #fff;
260260
cursor: pointer;
261261
margin: 12px 0 0 12px;
262262
font-size: 24px;
263+
transition: all 0.2s;
264+
}
265+
#bullseye-problems-autoplay:hover, #bullseye-problems-super-autoplay:hover {
266+
color: rgba(255,255,255,0.6);
267+
font-size: 30px;
263268
}
264269

265270
#bullseye-nowexploiting, #bullseye-result {

app/views/viewer/index.html.erb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<div class="items">
1212
<div id="bullseye-problems-autoplay">&#9654;</div>
1313
</div>
14+
<div class="items">
15+
<div id="bullseye-problems-super-autoplay">&#9654;&#9654;</div>
16+
</div>
1417
</div>
1518
</div>
1619
</div>
@@ -238,6 +241,34 @@ $(() => {
238241
localStorage.currentRound = current_round
239242
location.href = "<%= url_for :action => 'play' %>#" + first_id + '&' + mode + '&' + schedule_ids.join(',')
240243
})
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+
})
241272

242273
if (localStorage.currentProblemId !== undefined) {
243274
selectProblem(localStorage.currentProblemId, localStorage.currentRound)

0 commit comments

Comments
 (0)