From 847d09e7348fcabb127ee998e4474ccf366a6fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Sun, 26 Sep 2021 15:08:45 +0200 Subject: [PATCH] Remove unnecessary js code --- .../kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt | 1 - src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt | 5 +++-- src/main/resources/js/gameMasterClient.js | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 src/main/resources/js/gameMasterClient.js diff --git a/src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt b/src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt index a21b436..042d204 100644 --- a/src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt +++ b/src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt @@ -16,7 +16,6 @@ fun HTML.createGameMasterDocument() { src = "https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer = true } - script { src = "/assets/gameMasterClient.js" } script { src = "/assets/buzzerWebSocket.js" } } body { diff --git a/src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt b/src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt index a830ab1..0fa491d 100644 --- a/src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt +++ b/src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt @@ -29,16 +29,16 @@ fun HTML.createPlayerDocument() { } } body { + xData("{playerName: \"\", buzzerWebSocket: null}") div(classes = "parent") { xInit( + //language=JavaScript """ () => { - Alpine.data('buzzerWebSocket', null) startWebSocket('/socket/player') } """.trimIndent() ) - xData("{playerName: \"\"}") div(classes = "input") { label { +"Player" } div(classes = "bumper") {} @@ -58,6 +58,7 @@ fun HTML.createPlayerDocument() { xData("{clicked: false}") xOn( "click", + //language=JavaScript """ () => { sendUsername(playerName); diff --git a/src/main/resources/js/gameMasterClient.js b/src/main/resources/js/gameMasterClient.js deleted file mode 100644 index db9c853..0000000 --- a/src/main/resources/js/gameMasterClient.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -function appendUsername(username) { - $('ol#usernames').append(`
  • ${username}
  • `) -}