From 6122c717fc1b639c9e4031c5c60926b90ecdb553 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 16:39:07 +0100 Subject: [PATCH 01/11] Update package.json From a569b790e69f2309c7ea49f724ab78840a5dda91 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 16:46:28 +0100 Subject: [PATCH 02/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 558f8a7..145a7de 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ Just a CPS Clicktest. # You wanna know how many CPS do you get? -Then [click here](https://example.com/)! +Then [click here](https://cps-clicktest.vercel.app/)! From 62e270306893024967c107f0b6372825b3b4f92d Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 16:47:00 +0100 Subject: [PATCH 03/11] Update index.html Clicker doesn't working yet --- index.html | 230 ++++++++++++++++++++--------------------------------- 1 file changed, 87 insertions(+), 143 deletions(-) diff --git a/index.html b/index.html index 5760fe4..a7a0fc6 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ - + @@ -13,85 +13,20 @@ - - - + + - - - + + + - - CPS Clicker + CPS Clicktest -

@@ -100,91 +35,100 @@ Score:
Clicks/s: +
+
- - + + From 4238c1032965788362eba0700307ff39ed0d7144 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 16:47:41 +0100 Subject: [PATCH 04/11] Add cps.js and sw.js --- scripts/cps.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/sw.js | 7 +++++++ 2 files changed, 64 insertions(+) create mode 100644 scripts/cps.js create mode 100644 scripts/sw.js diff --git a/scripts/cps.js b/scripts/cps.js new file mode 100644 index 0000000..3f1b1aa --- /dev/null +++ b/scripts/cps.js @@ -0,0 +1,57 @@ +var score; +var startTime; +var ended = true; +var durationInP = document.getElementById("durationInP"); +var duration = int(durationInP()); +var timerTxt = document.getElementById("timer"); +var scoreTxt = document.getElementById("score"); +var clicksTxt = document.getElementById("clicks"); +var startBtn = document.getElementById("start"); +var clickArea = document.getElementById("clickarea"); +var show = function(elem) { + elem.style.display = 'inline'; +}; +var hide = function(elem) { + elem.style.display = 'none'; +}; +function startGame() { + hide(startBtn); + hide(durationInP) + score = -1; + ended = false; + startTime = new Date().getTime(); + var timerId = setInterval(function() { + var total = (new Date().getTime() - startTime) / 1000; + console.log(total) + if (total < duration) { + timerTxt.textContent = total.toFixed(3); + clicksTxt.textContent = (score / total).toFixed(2); + } else { + ended = true; + clearInterval(timerId); + endGame(); + } + }, 1); +} + +function endGame() { +var clicsBySeconds = (score / durationInP).toFixed(2); +timerTxt.textContent = durationInP.toFixed(3); +clicksTxt.textContent = clicsBySeconds; +show(startBtn); +show(durationInP) +setTimeout(function() { + alert('You made ' + score + ' clicks in ' + durationInP + + ' seconds. It is ' + clicsBySeconds + + ' clicks by seconds. Try again!'); +}, 10); +} +startBtn.addEventListener("click", function(e) { +startGame(); +}); +clickArea.addEventListener("click", function(e) { +if (!ended) { + score++; + scoreTxt.textContent = score; +} +}); diff --git a/scripts/sw.js b/scripts/sw.js new file mode 100644 index 0000000..1f058c8 --- /dev/null +++ b/scripts/sw.js @@ -0,0 +1,7 @@ +importScripts('https://arc.io/arc-sw-core.js') +importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js'); + +workbox.routing.registerRoute( + /.*/, + new workbox.strategies.NetworkFirst() +); \ No newline at end of file From 1822b98c62a37b0c6aebd89b1c8ac57c3a4dbdcf Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:42:49 +0100 Subject: [PATCH 05/11] Add files via upload --- README.md | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 145a7de..489570b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,18 @@ -# CPS-Clicktest -Just a CPS Clicktest. - -# You wanna know how many CPS do you get? -Then [click here](https://cps-clicktest.vercel.app/)! - - + +![GitHub package.json version](https://img.shields.io/github/package-json/v/InvalidLenni/CPS-clicktest?style=for-the-badge) +![GitHub issues](https://img.shields.io/github/issues/InvalidLenni/CPS-clicktest) + + + +# Just a CPS Clickertest + +This is the source code of [CPS Clicktest](https://cps-clicktest.vercel.app/). + +## You found Issues? + +Report them [there](https://github.com/InvalidLenni/CPS-Clicktest/issues/new). + +## Thanks to + +- Vercel *-* for hosting. +- Shields *-* for the badges. From 8063f56e284c5cfa9a7564ecef9740582259b447 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:43:04 +0100 Subject: [PATCH 06/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 489570b..77b485a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![GitHub package.json version](https://img.shields.io/github/package-json/v/InvalidLenni/CPS-clicktest?style=for-the-badge) -![GitHub issues](https://img.shields.io/github/issues/InvalidLenni/CPS-clicktest) +![GitHub issues](https://img.shields.io/github/issues/InvalidLenni/CPS-clicktest?style=for-the-badge) From 2b104c809d671d5d4ae61420a3a8ffa3ec6725a6 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:45:09 +0100 Subject: [PATCH 07/11] Add footer.php --- footer.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 footer.php diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..2bfa863 --- /dev/null +++ b/footer.php @@ -0,0 +1,13 @@ + \ No newline at end of file From e0e9f2cc7475cebd9a3c565f1105817fd35ab984 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:47:28 +0100 Subject: [PATCH 08/11] Update version: 1.0.0 -> 1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 95e7f8b..4728083 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cpsclicktest", "description": "Just a CPS Clicktest.", - "version": "1.0.0", + "version": "1.0.1", "author": { "name": "InvalidLenni", "email": "contact@invalidlenni.de", From b1e9ca4eecaca96272cf50ab0cd43e4aa2c381a4 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:48:52 +0100 Subject: [PATCH 09/11] Create FUNDING.yml --- .github/workflows/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/FUNDING.yml diff --git a/.github/workflows/FUNDING.yml b/.github/workflows/FUNDING.yml new file mode 100644 index 0000000..215a0d2 --- /dev/null +++ b/.github/workflows/FUNDING.yml @@ -0,0 +1 @@ +custom: ['https://deinserverhost.de/store/aff.php?aff=4224'] From 896945820a63a4fd524d253bdc3e615e3cb33292 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:49:08 +0100 Subject: [PATCH 10/11] Wrong dir --- .github/workflows/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/workflows/FUNDING.yml diff --git a/.github/workflows/FUNDING.yml b/.github/workflows/FUNDING.yml deleted file mode 100644 index 215a0d2..0000000 --- a/.github/workflows/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ['https://deinserverhost.de/store/aff.php?aff=4224'] From 13a9b71975f2cfeeb2d5a8e61679502424a04ae6 Mon Sep 17 00:00:00 2001 From: InvalidLenni <68335355+InvalidLenni@users.noreply.github.com> Date: Sun, 27 Feb 2022 17:49:17 +0100 Subject: [PATCH 11/11] Create FUNDING.yml --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..215a0d2 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: ['https://deinserverhost.de/store/aff.php?aff=4224']