Files
filmdle/static/js/player.js
SimolZimol 526b0353e7 new file: .env.example
new file:   .gitignore
	new file:   Dockerfile
	new file:   README.md
	new file:   app.py
	new file:   app/__init__.py
	new file:   app/game.py
	new file:   app/models.py
	new file:   app/routes.py
	new file:   app/seed.py
	new file:   data/movies.json
	new file:   docker-compose.yml
	new file:   requirements.txt
	new file:   static/css/style.css
	new file:   static/js/game.js
	new file:   static/js/player.js
	new file:   templates/index.html
2026-08-07 20:48:08 +02:00

37 lines
877 B
JavaScript

// Spieler-Verwaltung (Nickname -> player_id in localStorage)
const PlayerStore = (() => {
const KEY = "filmdle_player";
const STREAK_KEY = "filmdle_streaks";
function save(player) {
localStorage.setItem(KEY, JSON.stringify(player));
}
function load() {
try {
return JSON.parse(localStorage.getItem(KEY));
} catch (e) {
return null;
}
}
function getStreaks() {
try {
return JSON.parse(localStorage.getItem(STREAK_KEY));
} catch (e) {
return null;
}
}
function setStreaks(streaks) {
localStorage.setItem(STREAK_KEY, JSON.stringify(streaks));
}
function clear() {
localStorage.removeItem(KEY);
localStorage.removeItem(STREAK_KEY);
}
return { save, load, getStreaks, setStreaks, clear };
})();