From d1e59579ca19454369d56a8c7525e109a86841e2 Mon Sep 17 00:00:00 2001 From: fschildt Date: Fri, 17 Oct 2025 14:00:16 +0200 Subject: first commit --- apps/accounts/__init__.py | 0 apps/accounts/admin.py | 3 + apps/accounts/apps.py | 6 ++ apps/accounts/migrations/__init__.py | 0 apps/accounts/models.py | 3 + apps/accounts/static/accounts/login.css | 23 ++++ apps/accounts/templates/accounts/login.html | 15 +++ apps/accounts/templates/accounts/register.html | 18 ++++ apps/accounts/tests.py | 3 + apps/accounts/urls.py | 10 ++ apps/accounts/views.py | 44 ++++++++ apps/cultivation/__init__.py | 0 apps/cultivation/admin.py | 3 + apps/cultivation/apps.py | 6 ++ apps/cultivation/migrations/__init__.py | 0 apps/cultivation/models.py | 114 ++++++++++++++++++++ apps/cultivation/templates/cultivation/index.html | 7 ++ apps/cultivation/tests.py | 3 + apps/cultivation/urls.py | 12 +++ apps/cultivation/views.py | 17 +++ apps/home/__init__.py | 0 apps/home/admin.py | 3 + apps/home/apps.py | 6 ++ apps/home/migrations/__init__.py | 0 apps/home/models.py | 2 + apps/home/templates/index.html | 14 +++ apps/home/tests.py | 3 + apps/home/urls.py | 7 ++ apps/home/views.py | 7 ++ apps/tools/__init__.py | 0 apps/tools/admin.py | 3 + apps/tools/apps.py | 6 ++ apps/tools/migrations/__init__.py | 0 apps/tools/models.py | 3 + apps/tools/static/tools/css/hangboard-timer.css | 115 ++++++++++++++++++++ apps/tools/static/tools/js/hangboard-timer.js | 126 ++++++++++++++++++++++ apps/tools/templates/tools/hangboard-timer.html | 28 +++++ apps/tools/templates/tools/index.html | 7 ++ apps/tools/tests.py | 3 + apps/tools/urls.py | 9 ++ apps/tools/views.py | 7 ++ 41 files changed, 636 insertions(+) create mode 100644 apps/accounts/__init__.py create mode 100644 apps/accounts/admin.py create mode 100644 apps/accounts/apps.py create mode 100644 apps/accounts/migrations/__init__.py create mode 100644 apps/accounts/models.py create mode 100644 apps/accounts/static/accounts/login.css create mode 100644 apps/accounts/templates/accounts/login.html create mode 100644 apps/accounts/templates/accounts/register.html create mode 100644 apps/accounts/tests.py create mode 100644 apps/accounts/urls.py create mode 100644 apps/accounts/views.py create mode 100644 apps/cultivation/__init__.py create mode 100644 apps/cultivation/admin.py create mode 100644 apps/cultivation/apps.py create mode 100644 apps/cultivation/migrations/__init__.py create mode 100644 apps/cultivation/models.py create mode 100644 apps/cultivation/templates/cultivation/index.html create mode 100644 apps/cultivation/tests.py create mode 100644 apps/cultivation/urls.py create mode 100644 apps/cultivation/views.py create mode 100644 apps/home/__init__.py create mode 100644 apps/home/admin.py create mode 100644 apps/home/apps.py create mode 100644 apps/home/migrations/__init__.py create mode 100644 apps/home/models.py create mode 100644 apps/home/templates/index.html create mode 100644 apps/home/tests.py create mode 100644 apps/home/urls.py create mode 100644 apps/home/views.py create mode 100644 apps/tools/__init__.py create mode 100644 apps/tools/admin.py create mode 100644 apps/tools/apps.py create mode 100644 apps/tools/migrations/__init__.py create mode 100644 apps/tools/models.py create mode 100644 apps/tools/static/tools/css/hangboard-timer.css create mode 100644 apps/tools/static/tools/js/hangboard-timer.js create mode 100644 apps/tools/templates/tools/hangboard-timer.html create mode 100644 apps/tools/templates/tools/index.html create mode 100644 apps/tools/tests.py create mode 100644 apps/tools/urls.py create mode 100644 apps/tools/views.py (limited to 'apps') diff --git a/apps/accounts/__init__.py b/apps/accounts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/accounts/admin.py b/apps/accounts/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/accounts/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/accounts/apps.py b/apps/accounts/apps.py new file mode 100644 index 0000000..bd9d60a --- /dev/null +++ b/apps/accounts/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'apps.accounts' diff --git a/apps/accounts/migrations/__init__.py b/apps/accounts/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/accounts/models.py b/apps/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/apps/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/apps/accounts/static/accounts/login.css b/apps/accounts/static/accounts/login.css new file mode 100644 index 0000000..252e026 --- /dev/null +++ b/apps/accounts/static/accounts/login.css @@ -0,0 +1,23 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +:root { + --bg-default: #2e2e2e; + --bg-action: #923737; + --bg-pause: #416e46; +} + +body { + background-color: var(--bg-default); + font-family: 'Segoe UI', 'Roboto', sans-serif; + color: #e8e6e3; + transition: background-color 0.3s ease; +} + diff --git a/apps/accounts/templates/accounts/login.html b/apps/accounts/templates/accounts/login.html new file mode 100644 index 0000000..5f11c28 --- /dev/null +++ b/apps/accounts/templates/accounts/login.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} + +{% block title %}Login - fsweb{% endblock %} + +{% block content %} +Log in. +
{% csrf_token %} +
+
+ +
+Don't have an account? Register +
+Forgot your password? Unfortunate. +{% endblock %} diff --git a/apps/accounts/templates/accounts/register.html b/apps/accounts/templates/accounts/register.html new file mode 100644 index 0000000..213250f --- /dev/null +++ b/apps/accounts/templates/accounts/register.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} + +{% block title %}Login - fsweb{% endblock %} + +{% block content %} +Create account.
+
{% csrf_token %} +
+
+
+
+ +
+
+{{ form.errors }} +
+Already have an account? Go to Login +{% endblock %} diff --git a/apps/accounts/tests.py b/apps/accounts/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/accounts/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/accounts/urls.py b/apps/accounts/urls.py new file mode 100644 index 0000000..a4cb240 --- /dev/null +++ b/apps/accounts/urls.py @@ -0,0 +1,10 @@ +from django.urls import path + +from . import views + +app_name = 'accounts' +urlpatterns = [ + path("register/", views.register_view, name="register"), + path("login/", views.login_view, name="login"), + path("logout/", views.logout_view, name="logout") +] diff --git a/apps/accounts/views.py b/apps/accounts/views.py new file mode 100644 index 0000000..2027982 --- /dev/null +++ b/apps/accounts/views.py @@ -0,0 +1,44 @@ +from django.shortcuts import render, redirect +from django.contrib.auth import authenticate, login, logout +from django.contrib.auth.forms import UserCreationForm + + +def login_view(request): + if request.method == "POST": + username = request.POST['username'] + password = request.POST['password'] + user = authenticate(request, username=username, password=password) + if user: + login(request, user) + return redirect('index') + else: + pass + + return render(request, 'accounts/login.html', {'form': None}) + + +def register_view(request): + form = None + + if request.method == 'POST': + form = UserCreationForm(request.POST) + if form.is_valid(): + form.save() + + username = request.POST.get('username') + password = request.POST.get('password1') + user = authenticate(request, username=username, password=password) + if user: + login(request, user) + return redirect('index') + + return render(request, 'accounts/register.html', {'form': form}) + + +def logout_view(request): + if request.method == 'POST': + if request.user.is_authenticated: + logout(request) + + return redirect('index') + diff --git a/apps/cultivation/__init__.py b/apps/cultivation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/cultivation/admin.py b/apps/cultivation/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/cultivation/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/cultivation/apps.py b/apps/cultivation/apps.py new file mode 100644 index 0000000..1a320db --- /dev/null +++ b/apps/cultivation/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class CultivationConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'apps.cultivation' diff --git a/apps/cultivation/migrations/__init__.py b/apps/cultivation/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/cultivation/models.py b/apps/cultivation/models.py new file mode 100644 index 0000000..d28cc79 --- /dev/null +++ b/apps/cultivation/models.py @@ -0,0 +1,114 @@ +from django.db import models +from django.contrib.auth.models import User + + + +class MindSubject(models.Model): + name = models.CharField(max_length=32, unique=True) + + class Meta: + db_table = "mind_subjects" + + def __str__(self): + return f"{self.name}" + + +class MindMaterial(models.Model): + subject = models.ForeignKey(MindSubject, on_delete=models.CASCADE) + material = models.CharField(max_length=32, unique=True) + + class Meta: + db_table = "mind_materials" + + def __str__(self): + return f"{self.subject},{self.material}" + + +class MindEvent(models.Model): + date = models.DateField() + user = models.ForeignKey(User, on_delete=models.CASCADE) + material = models.ForeignKey(MindMaterial, on_delete=models.CASCADE) + duration = models.DurationField() + + class Meta: + db_table = "mind_events" + + def __str__(self): + return f"{self.date},{self.user},{self.material},{self.duration}" + + + +class CardioExercise(models.Model): + name = models.CharField(max_length=32) + + class Meta: + db_table = "cardio_exercises" + + def __str__(self): + return f"{self.name}" + + +class CardioEvent(models.Model): + date = models.DateField() + user = models.ForeignKey(User, on_delete=models.CASCADE) + exercise = models.ForeignKey(CardioExercise, on_delete=models.CASCADE) + duration = models.DurationField() + distance = models.DecimalField(max_digits=3, decimal_places=3) + + class Meta: + db_table = "cardio_events" + + def __str__(self): + return f"{self.date},{self.user},{self.exercise},{self.duration},{self.distance}" + + + +class StrengthExercise(models.Model): + name = models.CharField(max_length=32) + + class Meta: + db_table = "strength_exercises" + + def __str__(self): + return f"{self.name}" + + +class StrengthEvent(models.Model): + date = models.DateField() + user = models.ForeignKey(User, on_delete=models.CASCADE) + exercise = models.ForeignKey(StrengthExercise, on_delete=models.CASCADE) + weight = models.DecimalField(max_digits=3, decimal_places=3) + reps = models.SmallIntegerField() + + class Meta: + db_table = "strength_events" + + def __str__(self): + return f"{self.date},{self.user},{self.exercise},{self.weight},{self.reps}" + + + +class FlexibilityExercise(models.Model): + name = models.CharField(max_length=32) + + class Meta: + db_table = "flexibility_exercises" + + def __str__(self): + return f"{self.name}" + + +class FlexibilityEvent(models.Model): + date = models.DateField() + user = models.ForeignKey(User, on_delete=models.CASCADE) + exercise = models.ForeignKey(FlexibilityExercise, on_delete=models.CASCADE) + duration = models.DurationField() + + class Meta: + db_table = "flexibility_events" + + def __str__(self): + return f"{self.date},{self.user},{self.exercise},{self.duration}" + + + diff --git a/apps/cultivation/templates/cultivation/index.html b/apps/cultivation/templates/cultivation/index.html new file mode 100644 index 0000000..2d51317 --- /dev/null +++ b/apps/cultivation/templates/cultivation/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Cultivation - fsweb{% endblock %} + +{% block content %} + +{% endblock %} diff --git a/apps/cultivation/tests.py b/apps/cultivation/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/cultivation/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/cultivation/urls.py b/apps/cultivation/urls.py new file mode 100644 index 0000000..f56b4cf --- /dev/null +++ b/apps/cultivation/urls.py @@ -0,0 +1,12 @@ +from django.urls import path + +from . import views + +app_name = 'cultivation' +urlpatterns = [ + path("", views.view_index, name="index"), + path("cardio", views.view_cardio, name="cardio"), + path("strength", views.view_strength, name="strength"), + path("flexibility", views.view_flexibility, name="flexibility"), + path("mind", views.view_mind, name="mind"), +] diff --git a/apps/cultivation/views.py b/apps/cultivation/views.py new file mode 100644 index 0000000..6db6307 --- /dev/null +++ b/apps/cultivation/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render + +def view_index(request): + return render(request, 'cultivation/index.html', {'form': None}) + +def view_cardio(request): + return render(request, 'cultivation/index.html', {'form': None}) + +def view_strength(request): + return render(request, 'cultivation/index.html', {'form': None}) + +def view_flexibility(request): + return render(request, 'cultivation/index.html', {'form': None}) + +def view_mind(request): + return render(request, 'cultivation/index.html', {'form': None}) + diff --git a/apps/home/__init__.py b/apps/home/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/home/admin.py b/apps/home/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/home/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/home/apps.py b/apps/home/apps.py new file mode 100644 index 0000000..c11732f --- /dev/null +++ b/apps/home/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class HomeConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'apps.home' diff --git a/apps/home/migrations/__init__.py b/apps/home/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/home/models.py b/apps/home/models.py new file mode 100644 index 0000000..beeb308 --- /dev/null +++ b/apps/home/models.py @@ -0,0 +1,2 @@ +from django.db import models + diff --git a/apps/home/templates/index.html b/apps/home/templates/index.html new file mode 100644 index 0000000..f3b97e2 --- /dev/null +++ b/apps/home/templates/index.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} + +{% block title %}Home{% endblock %} + +{% block content %} +

Welcome to my Website!

+

Programs

+

fscord (Chat Client/Server)

+

fsarcade (Games: Tetris, Snake, Minesweeper)

+

Donations

+

XMR: 876bxaEVzSL7w6hMMbxzo3EofakfFfHbP4etxYgPcX9bQnnik26TPFH85iMvaX4j6xM7312iRVPrtGKiC6unR8251ZWi1Fy

+

BTC: bc1quavtkgtkephly8769lyqsx6ja002y5srgjj6sq

+{% endblock %} + diff --git a/apps/home/tests.py b/apps/home/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/home/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/home/urls.py b/apps/home/urls.py new file mode 100644 index 0000000..5119061 --- /dev/null +++ b/apps/home/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path("", views.index, name="index"), +] diff --git a/apps/home/views.py b/apps/home/views.py new file mode 100644 index 0000000..714ba06 --- /dev/null +++ b/apps/home/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render + + +def index(request): + context = {} + return render(request, 'index.html', context) + diff --git a/apps/tools/__init__.py b/apps/tools/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/tools/admin.py b/apps/tools/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/tools/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/tools/apps.py b/apps/tools/apps.py new file mode 100644 index 0000000..a6e23d6 --- /dev/null +++ b/apps/tools/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ToolsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'apps.tools' diff --git a/apps/tools/migrations/__init__.py b/apps/tools/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/tools/models.py b/apps/tools/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/apps/tools/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/apps/tools/static/tools/css/hangboard-timer.css b/apps/tools/static/tools/css/hangboard-timer.css new file mode 100644 index 0000000..afee9bd --- /dev/null +++ b/apps/tools/static/tools/css/hangboard-timer.css @@ -0,0 +1,115 @@ +:root { + --bg-action: #923737; + --bg-pause: #416e46; +} + +body { + transition: background-color 0.3s ease; +} + +main { + max-width: 800px; + margin: 0 auto; + padding: 2rem; + text-align: center; + display: grid; + grid-template-rows: auto auto auto auto; + row-gap: 40px; + min-height: 100vh; + align-content: center; +} + +h1 { + font-size: 2.5rem; + color: #e8e6e3; + text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); +} + +p { + font-size: 1.1rem; + color: #b0b0b0; +} + +p a { + color: #4ecdc4; + text-decoration: none; + transition: color 0.2s ease; +} + +p a:hover { + color: #ff6b6b; +} + +.timer-container { + display: grid; + grid-template-rows: 14vh 12vh 12vh auto; + gap: 4vh; + align-items: center; + justify-content: center; + background: rgba(255, 255, 255, 0.05); + padding: 2rem; + border-radius: 15px; + box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); +} + +.timer-container #countdown { + height: 14vh; + font-size: 14vh; + font-weight: bold; + color: #e8e6e3; + text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); +} + +.timer-container #exercise_state { + max-height: 12vh; + height: 12vh; + font-size: clamp(1rem, 6vw, 4.5rem); + color: #b0b0b0; + transition: color 0.3s ease; + text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); +} + +.timer-container #exercise_name { + height: 12vh; + font-size: clamp(1rem, 6vw, 4.5rem); + line-height: 1; + white-space: nowrap; + + color: #b0b0b0; + transition: color 0.3s ease; + text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); +} + +.button-container { + display: flex; + justify-content: center; + gap: 2rem; +} + +.button-container #btn-start, .button-container #btn-reset { + font-size: 1.3rem; + padding: 0.8rem 2rem; + border: none; + border-radius: 8px; + cursor: pointer; + background-color: #4ecdc4; + color: #fff; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 1px; + transition: transform 0.2s ease, background-color 0.2s ease; +} + +.button-container #btn-start:hover, .button-container #btn-reset:hover { + background-color: #45b7b0; + transform: translateY(-2px); +} + +.button-container #btn-reset { + background-color: #ff6b6b; +} + +.button-container #btn-reset:hover { + background-color: #e65b5b; +} + diff --git a/apps/tools/static/tools/js/hangboard-timer.js b/apps/tools/static/tools/js/hangboard-timer.js new file mode 100644 index 0000000..5949ab2 --- /dev/null +++ b/apps/tools/static/tools/js/hangboard-timer.js @@ -0,0 +1,126 @@ +let HangboardTimer = { + exercise_names: ["Half-Crimp", "3-Finger Drag", "Front 2-Finger Drag", "Middle 2-Finger Drag", "Front 2-Finger Crimp", "Middle 2-Finger Crimp"], + exercise_reps: [6, 6, 2, 2, 2, 2], + action_duration: 10, + pause_duration: 20, + start: function() { + this.el_body = document.body; + this.el_countdown = document.getElementById("countdown"); + this.el_exercise_state = document.getElementById("exercise_state"); + this.el_exercise_name = document.getElementById("exercise_name"); + if (!this.el_body || !this.el_countdown || !this.el_exercise_state || !this.el_exercise_name || !this.exercise_names.length) { + console.error("Missing required elements or exercises"); + return; + } + this.audioContext = this.audioContext || new (window.AudioContext || window.webkitAudioContext)(); + + this.reset(); + this.show_state(); + + this.interval_id = setInterval(this.update.bind(this), 100); + }, + reset: function() { + clearInterval(this.interval_id); + this.interval_id = 0; + this.exercise_index = 0; + this.exercise_rep = 1; + this.is_paused = true; + this.timer = this.pause_duration; + this.last_timestamp = performance.now(); + this.el_body.style.backgroundColor = "var(--bg-default)"; + this.el_countdown.textContent = ""; + this.el_exercise_state.textContent = ""; + this.el_exercise_name.textContent = ""; + }, + update: function() { + const current_timestamp = performance.now() + const elapsed = (current_timestamp - this.last_timestamp) / 1000; + + this.last_timestamp = current_timestamp; + this.timer -= elapsed; + + if (this.timer <= 3 && !this.beep_triggered) { + this.play_beeps(); + this.beep_triggered = true; + } + if (this.timer <= 0) { + const phase_switched = this.switch_phase(); + if (!phase_switched) { + this.finish(); + return; + } + } + + this.show_state(); + }, + switch_phase: function() { + if (this.is_paused) { + this.timer = this.action_duration; + this.is_paused = false; + } + else { + this.timer = this.pause_duration; + this.is_paused = true; + if (this.exercise_rep == this.exercise_reps[this.exercise_index]) { + this.exercise_index += 1; + this.exercise_rep = 1; + if (this.exercise_index >= this.exercise_names.length) { + return false; + } + } + else { + this.exercise_rep += 1; + } + } + this.beep_triggered = false; + return true; + }, + show_state: function() { + this.el_countdown.textContent = Math.ceil(this.timer); + if (this.is_paused) { + this.el_body.style.backgroundColor = "var(--bg-pause)"; + this.el_exercise_state.textContent = "Upcoming:"; + } + else { + this.el_body.style.backgroundColor = "var(--bg-action)"; + this.el_exercise_state.textContent = "Currently:"; + } + const name = this.exercise_names[this.exercise_index]; + const rep = this.exercise_rep; + const reps = this.exercise_reps[this.exercise_index]; + this.el_exercise_name.textContent = `${name} (${rep}/${reps})`; + }, + play_beeps: function() { + const now = this.audioContext.currentTime; + const oscillator = this.audioContext.createOscillator(); + const gain_node = this.audioContext.createGain(); + oscillator.connect(gain_node); + gain_node.connect(this.audioContext.destination); + + oscillator.type = 'sine'; + oscillator.frequency.value = 400; + oscillator.frequency.setValueAtTime(500, now + 3.0); + + oscillator.start(now); + gain_node.gain.setValueAtTime(0.5, now); + gain_node.gain.setValueAtTime(0, now + 0.5); + gain_node.gain.setValueAtTime(0.5, now + 1.0); + gain_node.gain.setValueAtTime(0, now + 1.5); + gain_node.gain.setValueAtTime(0.5, now + 2.0); + gain_node.gain.setValueAtTime(0, now + 2.5); + gain_node.gain.setValueAtTime(0.5, now + 3.0); + gain_node.gain.setValueAtTime(0, now + 3.5); + oscillator.stop(now + 3.5); + }, + finish: function() { + this.el_exercise_state.textContent = ""; + this.el_exercise_name.textContent = ""; + this.el_countdown.textContent = "Done."; + this.el_body.style.backgroundColor = "var(--bg-default)"; + clearInterval(this.interval_id); + this.interval_id = 0; + } +} + +document.getElementById('btn-start').addEventListener('click', () => HangboardTimer.start()); +document.getElementById('btn-reset').addEventListener('click', () => HangboardTimer.reset()); diff --git a/apps/tools/templates/tools/hangboard-timer.html b/apps/tools/templates/tools/hangboard-timer.html new file mode 100644 index 0000000..248db62 --- /dev/null +++ b/apps/tools/templates/tools/hangboard-timer.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} +{% load static %} + + +{% block title %}Hangboard-Timer - fsweb{% endblock %} + + +{% block morelinks %} + +{% endblock %} + + +{% block content %} +

Hangboard Timer

+

Increase your finger strength! Routine adopted from this video.

+ +
+
+
+
+
+ + +
+
+ + +{% endblock %} diff --git a/apps/tools/templates/tools/index.html b/apps/tools/templates/tools/index.html new file mode 100644 index 0000000..45ed82f --- /dev/null +++ b/apps/tools/templates/tools/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Tools - fsweb{% endblock %} + +{% block content %} +

Welcome to the Tools Page

+{% endblock %} diff --git a/apps/tools/tests.py b/apps/tools/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/tools/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/tools/urls.py b/apps/tools/urls.py new file mode 100644 index 0000000..93ccff8 --- /dev/null +++ b/apps/tools/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from . import views + +app_name = 'tools' +urlpatterns = [ + path("", views.view_index, name="index"), + path("hangboard-timer/", views.view_hangboard_timer, name="hangboard_timer") +] diff --git a/apps/tools/views.py b/apps/tools/views.py new file mode 100644 index 0000000..182600a --- /dev/null +++ b/apps/tools/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render + +def view_index(request): + return render(request, 'tools/index.html') + +def view_hangboard_timer(request): + return render(request, 'tools/hangboard-timer.html') -- cgit v1.2.3