Vizualni feedback ob vnosu številke (preko ekrana ali preko tipkovnice).
This commit is contained in:
@@ -20,6 +20,7 @@ const searchResults = document.getElementById('search-results');
|
|||||||
let capsMode = false;
|
let capsMode = false;
|
||||||
let wakeLock = null;
|
let wakeLock = null;
|
||||||
let lastStateSignature = "";
|
let lastStateSignature = "";
|
||||||
|
let lastPageInfo = "";
|
||||||
|
|
||||||
// vibracija telefona
|
// vibracija telefona
|
||||||
function vibrate() {
|
function vibrate() {
|
||||||
@@ -71,7 +72,8 @@ async function updateState(force = false) {
|
|||||||
lastStateSignature = signature;
|
lastStateSignature = signature;
|
||||||
|
|
||||||
displayArea.textContent = data.current_text || 'Pripravljeno. Vpiši številko pesmi.';
|
displayArea.textContent = data.current_text || 'Pripravljeno. Vpiši številko pesmi.';
|
||||||
pageInfo.textContent = data.page_info || '';
|
lastPageInfo = data.page_info || '';
|
||||||
|
updatePageInfoDisplay();
|
||||||
|
|
||||||
capsMode = data.caps_mode || false;
|
capsMode = data.caps_mode || false;
|
||||||
|
|
||||||
@@ -88,14 +90,28 @@ async function updateState(force = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Posodobi prikaz v page-info (vključno z vnosom številke)
|
||||||
|
function updatePageInfoDisplay() {
|
||||||
|
const songNumber = songNumberInput.value;
|
||||||
|
if (songNumber) {
|
||||||
|
pageInfo.textContent = 'Vnos: ' + songNumber;
|
||||||
|
pageInfo.classList.add('input-active');
|
||||||
|
} else {
|
||||||
|
pageInfo.textContent = lastPageInfo;
|
||||||
|
pageInfo.classList.remove('input-active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dodaj številko
|
// dodaj številko
|
||||||
function addDigit(digit) {
|
function addDigit(digit) {
|
||||||
songNumberInput.value += digit;
|
songNumberInput.value += digit;
|
||||||
|
updatePageInfoDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// počisti vnos
|
// počisti vnos
|
||||||
function clearInput() {
|
function clearInput() {
|
||||||
songNumberInput.value = '';
|
songNumberInput.value = '';
|
||||||
|
updatePageInfoDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter:
|
// Enter:
|
||||||
@@ -113,6 +129,7 @@ async function loadSong() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
songNumberInput.value = '';
|
songNumberInput.value = '';
|
||||||
|
updatePageInfoDisplay();
|
||||||
} else {
|
} else {
|
||||||
await fetch('/api/next_page', { method: 'POST' });
|
await fetch('/api/next_page', { method: 'POST' });
|
||||||
}
|
}
|
||||||
@@ -152,6 +169,7 @@ async function searchSongs() {
|
|||||||
`;
|
`;
|
||||||
item.addEventListener('click', () => {
|
item.addEventListener('click', () => {
|
||||||
songNumberInput.value = song[0];
|
songNumberInput.value = song[0];
|
||||||
|
updatePageInfoDisplay();
|
||||||
loadSong();
|
loadSong();
|
||||||
searchInput.value = '';
|
searchInput.value = '';
|
||||||
searchResults.innerHTML = '';
|
searchResults.innerHTML = '';
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ body {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
transition: color 0.2s ease, font-weight 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-info.input-active {
|
||||||
|
color: #1f8a46;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-container {
|
.menu-container {
|
||||||
|
|||||||
Reference in New Issue
Block a user