From 70b247c640b506e407bc7f3daa48a6662a893cad Mon Sep 17 00:00:00 2001 From: Tiia Soikkeli Date: Tue, 12 Dec 2023 02:51:56 +0200 Subject: Adding nick resetting functionality. --- static/nick-lift.js | 7 +++++++ static/pages.json | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 static/nick-lift.js (limited to 'static') diff --git a/static/nick-lift.js b/static/nick-lift.js new file mode 100644 index 0000000..343608a --- /dev/null +++ b/static/nick-lift.js @@ -0,0 +1,7 @@ +var nickTimeout +Array.from(document.getElementsByClassName('kysNick')).forEach( (a) => { + a.addEventListener('mousedown', (event) => { nickTimeout = setTimeout( + () => { document.location = '/#nick_reset'}, 5000) }) + a.addEventListener('mouseup', (event) => { clearTimeout (nickTimeout) }) + a.addEventListener('mouseout', (event) => { clearTimeout (nickTimeout) }) +}) \ No newline at end of file diff --git a/static/pages.json b/static/pages.json index 8d0d376..d9374c3 100644 --- a/static/pages.json +++ b/static/pages.json @@ -45,6 +45,11 @@ "pageTitle": "Luodaanko uusi kyselmä?", "URL": "pages/quiz.html", "hidden": "yes" + }, + "nick_reset": { + "pageTitle": "Resetoidaanko nimimerkki?", + "URL": "pages/nick_reset.html", + "hidden": "yes" } } } -- cgit v1.2.3