From 34db4e34e760a526703c5dcddeca098884619d76 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Sun, 24 Nov 2024 21:40:48 +0100 Subject: [PATCH] Use AlpineJS clipboard plugin, eliminating empty lines in copy --- src/alfagok/static/game.css | 4 ++-- src/alfagok/static/game.js | 19 ++----------------- src/alfagok/templates/index.html | 6 +++--- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/alfagok/static/game.css b/src/alfagok/static/game.css index bd0772b..187ade0 100644 --- a/src/alfagok/static/game.css +++ b/src/alfagok/static/game.css @@ -33,8 +33,8 @@ a.title { padding: 2rem 0 0 0; } -.guessesheading { - color: #CCC;; +.guessesheading, .copied { + color: #CCC; } .guessesheading, .guessesbefore, .guessesafter { diff --git a/src/alfagok/static/game.js b/src/alfagok/static/game.js index d969a07..f9f8cb1 100644 --- a/src/alfagok/static/game.js +++ b/src/alfagok/static/game.js @@ -24,6 +24,8 @@ document.addEventListener('alpine:init', () => { resultGuesses: Alpine.$persist('').as('resultGuesses'), resultTimeTaken: Alpine.$persist('').as('resultTimeTaken'), + resultsCopied: false, + async init() { /** Initialise the application after loading */ await this.getGameID(); @@ -190,23 +192,6 @@ document.addEventListener('alpine:init', () => { }); - -/* Clipboard stuff **/ - -let clip = new ClipboardJS('.copy'); - -clip.on("success", function(e) { - document.getElementById('copyresults').innerHTML = '

Gekopieerd! Deel je resultaat.

'; - e.clearSelection(); -}); - -clip.on("error", function() { - document.getElementById('copyresults').innerHTML = '

Fout. Graag handmatig kopiëren...

'; -}); - - -/* Get current gameID etc **/ - // document.addEventListener('alpine:initialized', () => { /* On AlpineJS completely loaded, do all this */ // Alpine.store('alfagok').getGameID(); diff --git a/src/alfagok/templates/index.html b/src/alfagok/templates/index.html index 794fb30..b6cf855 100644 --- a/src/alfagok/templates/index.html +++ b/src/alfagok/templates/index.html @@ -12,6 +12,7 @@ + @@ -49,8 +50,8 @@

🔗 alfagok.diginaut.net

-
- @@ -64,7 +65,6 @@ - {#