Skip to content

Commit

Permalink
give up for pieceless tactics
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneVogel committed Nov 29, 2021
1 parent 4270917 commit bc1c964
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/js/pieceless_tactics.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ function setup_to_play(chess) {
document.getElementById("pieceless_to_play").innerText = to_play;
}

function setup_give_up() {
let e = document.getElementById("give-up");
e.onclick = function() {
document.getElementById("next").classList.remove("hidden");
};
}

function main() {
window.chess = new Chess(fen);
setup_pieces(chess);
Expand All @@ -158,6 +165,7 @@ function main() {
resize_ground();
window.setTimeout(ground.redrawAll, 10);
window.setTimeout(ground.redrawAll, 100);
setup_give_up();
}

window.onresize = resize_ground;
Expand Down
2 changes: 2 additions & 0 deletions lib/listudy_web/templates/pieceless_tactic/public.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<a href="<%= Routes.pieceless_tactic_path(@conn, :random, @locale, @pieceless_tactic.id) %>">
<button id="next" class="hidden continue_button"><%= dgettext "tactics", "Continue"%></button>
</a>

<a class="icon" data-icon="-" id="give-up"><%= dgettext("tactics", "Give up") %></a>
</div>
<br>
<br>
Expand Down

0 comments on commit bc1c964

Please sign in to comment.