From 6acdebc9ced4f457975d215af9ab19811bea29d6 Mon Sep 17 00:00:00 2001
From: schneefux
Date: Tue, 25 Apr 2017 14:46:56 +0200
Subject: add API for crunches
---
index.html | 14 ++++++++++----
server.js | 53 +++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 49 insertions(+), 18 deletions(-)
diff --git a/index.html b/index.html
index 5f191e4..26c0f5e 100644
--- a/index.html
+++ b/index.html
@@ -32,6 +32,8 @@
@@ -51,7 +53,7 @@
client = webstomp.over(SockJS("http://localhost:15674/stomp"));
}
- let notif = (text, color) => {
+ const notif = (text, color) => {
$("#updates").append(
$("")
.text(text)
@@ -93,7 +95,7 @@
$("#update-form").submit((e) => {
e.preventDefault();
- let ign = $("#update-name").val(),
+ const ign = $("#update-name").val(),
force = $("#update-force").is(":checked"),
brawls = $("#update-brawl").is(":checked");
@@ -119,12 +121,16 @@
$("#crunch-form").submit((e) => {
e.preventDefault();
- let ign = $("#crunch-name").val();
+ const ign = $("#crunch-name").val();
$.post("/api/player/" + ign + "/crunch");
});
$("#crunchglobal-form").submit((e) => {
+ const force = $("#crunch-force").is(":checked");
e.preventDefault();
- $.post("/api/crunch");
+ if (force)
+ $.post("/api/recrunch");
+ else
+ $.post("/api/crunch");
});