updated index.html
This commit is contained in:
parent
f2b434983e
commit
24ae1a622c
|
@ -8,7 +8,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('Cover') }}</th>
|
<th>{{ _('Cover') }}</th>
|
||||||
<th>{{ _('Name') }}</th>
|
<th>{{ _('Name') }}</th>
|
||||||
<th class="key-col d-md-table-cell">{{ _('Key') }}</th>
|
<th class="key-col">{{ _('Key') }}</th>
|
||||||
<th>{{ _('Status') }}</th>
|
<th>{{ _('Status') }}</th>
|
||||||
<th>{{ _('Created') }}</th>
|
<th>{{ _('Created') }}</th>
|
||||||
<th>{{ _('Redeem by') }}</th>
|
<th>{{ _('Redeem by') }}</th>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ game.name }}</td>
|
<td>{{ game.name }}</td>
|
||||||
<td class="font-monospace key-col d-none d-md-table-cell">{{ game.steam_key }}</td>
|
<td class="font-monospace key-col">{{ game.steam_key }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if game.status == 'nicht eingelöst' %}
|
{% if game.status == 'nicht eingelöst' %}
|
||||||
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
||||||
|
@ -169,19 +169,30 @@ document.querySelectorAll('.generate-redeem').forEach(btn => {
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
console.log("DOM ist geladen!"); // Überprüfe, ob DOMContentLoaded überhaupt ausgeführt wird
|
const KEY_STORAGE = 'showKeys';
|
||||||
const toggleKeysButton = document.getElementById('toggle-keys');
|
const toggleBtn = document.getElementById('toggle-keys');
|
||||||
if (toggleKeysButton) {
|
|
||||||
console.log("Button with ID 'toggle-keys' found!");
|
function toggleKeys(visible) {
|
||||||
toggleKeysButton.addEventListener('click', function() {
|
document.querySelectorAll('.key-col').forEach(el => {
|
||||||
console.log("Button clicked!");
|
visible ? el.classList.remove('d-none') : el.classList.add('d-none');
|
||||||
const keyCols = document.querySelectorAll('.key-col');
|
});
|
||||||
keyCols.forEach(function(el) {
|
}
|
||||||
el.classList.toggle('hidden');
|
|
||||||
});
|
const savedState = localStorage.getItem(KEY_STORAGE);
|
||||||
|
const initialVisibility = savedState ? JSON.parse(savedState) : true;
|
||||||
|
toggleKeys(initialVisibility);
|
||||||
|
|
||||||
|
if (toggleBtn) {
|
||||||
|
let isVisible = initialVisibility;
|
||||||
|
|
||||||
|
toggleBtn.addEventListener('click', () => {
|
||||||
|
isVisible = !isVisible;
|
||||||
|
toggleKeys(isVisible);
|
||||||
|
localStorage.setItem(KEY_STORAGE, JSON.stringify(isVisible));
|
||||||
|
|
||||||
|
console.log(`Keys sind jetzt: ${isVisible ? 'sichtbar' : 'versteckt'}`);
|
||||||
|
console.log(`LocalStorage-Wert: ${localStorage.getItem(KEY_STORAGE)}`);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
console.log("Button with ID 'toggle-keys' not found!");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -189,4 +200,3 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
<div class="alert alert-info">{{ _('No games yet') }}</div>
|
<div class="alert alert-info">{{ _('No games yet') }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue