predelava web vmesnika - zaslonska tipkovnica + drugi gumbi
This commit is contained in:
@@ -3,90 +3,130 @@ console.log('JavaScript se izvaja...');
|
|||||||
// DOM elementi
|
// DOM elementi
|
||||||
const songNumberInput = document.getElementById('song-number');
|
const songNumberInput = document.getElementById('song-number');
|
||||||
const loadBtn = document.getElementById('load-btn');
|
const loadBtn = document.getElementById('load-btn');
|
||||||
const searchQueryInput = document.getElementById('search-query');
|
|
||||||
const searchBtn = document.getElementById('search-btn');
|
|
||||||
const capsBtn = document.getElementById('caps-btn');
|
|
||||||
const displayArea = document.getElementById('display-area');
|
const displayArea = document.getElementById('display-area');
|
||||||
const prevBtn = document.getElementById('prev-btn');
|
const prevBtn = document.getElementById('prev-btn');
|
||||||
const nextBtn = document.getElementById('next-btn');
|
const nextBtn = document.getElementById('next-btn');
|
||||||
const darkBtn = document.getElementById('dark-btn');
|
const darkBtn = document.getElementById('dark-btn');
|
||||||
const pageInfo = document.getElementById('page-info');
|
const pageInfo = document.getElementById('page-info');
|
||||||
|
const clearBtn = document.getElementById('clear-btn');
|
||||||
console.log('DOM elementi najdeni:', { songNumberInput: !!songNumberInput, loadBtn: !!loadBtn, searchQueryInput: !!searchQueryInput, searchBtn: !!searchBtn, capsBtn: !!capsBtn, displayArea: !!displayArea, prevBtn: !!prevBtn, nextBtn: !!nextBtn, darkBtn: !!darkBtn, pageInfo: !!pageInfo });
|
const keypadButtons = document.querySelectorAll('.btn-key');
|
||||||
|
const keypadWrapper = document.getElementById('keypad-wrapper');
|
||||||
|
const toggleKeypadBtn = document.getElementById('toggle-keypad-btn');
|
||||||
|
|
||||||
let capsMode = false;
|
let capsMode = false;
|
||||||
|
let wakeLock = null;
|
||||||
|
let lastStateSignature = "";
|
||||||
|
|
||||||
// Naloži trenutne podatke
|
// vibracija telefona
|
||||||
async function updateState() {
|
function vibrate() {
|
||||||
console.log('updateState() se kliče...');
|
if (navigator.vibrate && /Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
||||||
|
navigator.vibrate([25, 30, 25]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// poskus, da se zaslon ne ugaša
|
||||||
|
async function requestWakeLock() {
|
||||||
try {
|
try {
|
||||||
console.log('Pošiljam fetch za /api/state...');
|
if ('wakeLock' in navigator) {
|
||||||
const response = await fetch('/api/state');
|
wakeLock = await navigator.wakeLock.request('screen');
|
||||||
console.log('Response status:', response.status);
|
console.log('Wake lock aktiviran');
|
||||||
|
|
||||||
|
wakeLock.addEventListener('release', () => {
|
||||||
|
console.log('Wake lock sproščen');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Wake lock ni uspel:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ob vrnitvi v zavihek ponovno zahtevaj wake lock
|
||||||
|
document.addEventListener('visibilitychange', async () => {
|
||||||
|
if (document.visibilityState === 'visible') {
|
||||||
|
await requestWakeLock();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// posodobi stanje
|
||||||
|
async function updateState(force = false) {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/state', { cache: 'no-store' });
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
console.log('Response data:', data);
|
|
||||||
|
const signature = JSON.stringify({
|
||||||
|
current_text: data.current_text || '',
|
||||||
|
page_info: data.page_info || '',
|
||||||
|
caps_mode: data.caps_mode || false,
|
||||||
|
can_prev: !!data.can_prev
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!force && signature === lastStateSignature) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 || '';
|
pageInfo.textContent = data.page_info || '';
|
||||||
|
|
||||||
capsMode = data.caps_mode || false;
|
capsMode = data.caps_mode || false;
|
||||||
|
|
||||||
if (capsMode) {
|
if (capsMode) {
|
||||||
capsBtn.classList.add('active');
|
darkBtn.classList.add('active');
|
||||||
} else {
|
} else {
|
||||||
capsBtn.classList.remove('active');
|
darkBtn.classList.remove('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
prevBtn.disabled = !data.can_prev;
|
prevBtn.disabled = !data.can_prev;
|
||||||
nextBtn.disabled = !data.can_next;
|
|
||||||
console.log('updateState() uspešno zaključeno');
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Napaka pri posodabljanju stanja:', error);
|
console.error('Napaka pri posodabljanju stanja:', error);
|
||||||
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
||||||
prevBtn.disabled = true; nextBtn.disabled = true; loadBtn.disabled = true; searchBtn.disabled = true; capsBtn.disabled = true; darkBtn.disabled = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Naloži pesem
|
// dodaj številko
|
||||||
|
function addDigit(digit) {
|
||||||
|
songNumberInput.value += digit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// počisti vnos
|
||||||
|
function clearInput() {
|
||||||
|
songNumberInput.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enter:
|
||||||
|
// - če je številka -> naloži pesem
|
||||||
|
// - če ni številke -> naslednja kitica
|
||||||
async function loadSong() {
|
async function loadSong() {
|
||||||
console.log('loadSong() se kliče');
|
|
||||||
const songNumber = songNumberInput.value.trim();
|
const songNumber = songNumberInput.value.trim();
|
||||||
console.log('Song number:', songNumber);
|
|
||||||
if (!songNumber) return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('Pošiljam POST za /api/load_song...');
|
if (songNumber) {
|
||||||
const response = await fetch('/api/load_song', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({song_number: songNumber}) });
|
await fetch('/api/load_song', {
|
||||||
console.log('Response status:', response.status);
|
method: 'POST',
|
||||||
const data = await response.json();
|
headers: { 'Content-Type': 'application/json' },
|
||||||
console.log('Response data:', data);
|
body: JSON.stringify({ song_number: songNumber })
|
||||||
|
});
|
||||||
|
|
||||||
songNumberInput.value = '';
|
songNumberInput.value = '';
|
||||||
updateState();
|
} else {
|
||||||
} catch (error) {
|
|
||||||
console.error('Napaka pri nalaganju pesmi:', error);
|
|
||||||
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Naslednja stran
|
|
||||||
async function nextPage() {
|
|
||||||
try {
|
|
||||||
await fetch('/api/next_page', { method: 'POST' });
|
await fetch('/api/next_page', { method: 'POST' });
|
||||||
updateState();
|
}
|
||||||
|
|
||||||
|
await updateState(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Napaka pri navigaciji:', error);
|
console.error('Napaka:', error);
|
||||||
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prejšnja stran
|
// prejšnja kitica
|
||||||
async function prevPage() {
|
async function prevPage() {
|
||||||
try {
|
try {
|
||||||
await fetch('/api/prev_page', { method: 'POST' });
|
await fetch('/api/prev_page', { method: 'POST' });
|
||||||
updateState();
|
await updateState(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Napaka pri navigaciji:', error);
|
console.error('Napaka pri navigaciji:', error);
|
||||||
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +134,7 @@ async function prevPage() {
|
|||||||
async function clearScreen() {
|
async function clearScreen() {
|
||||||
try {
|
try {
|
||||||
await fetch('/api/clear_screen', {method: 'POST'});
|
await fetch('/api/clear_screen', {method: 'POST'});
|
||||||
updateState();
|
await updateState(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Napaka pri zatamnitvi ekrana:', error);
|
console.error('Napaka pri zatamnitvi ekrana:', error);
|
||||||
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
||||||
@@ -104,54 +144,140 @@ async function clearScreen() {
|
|||||||
// Preklop VELIKIH ČRK
|
// Preklop VELIKIH ČRK
|
||||||
async function toggleCaps() {
|
async function toggleCaps() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/toggle_caps', {method: 'POST'});
|
await fetch('/api/toggle_caps', { method: 'POST' });
|
||||||
updateState();
|
await updateState(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Napaka pri preklopa velikih črk:', error); displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>'; }
|
console.error('Napaka pri preklopu velikih črk:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iskanje pesmi
|
// skrij/pokaži tipkovnico
|
||||||
async function searchSongs() {
|
function toggleKeypad() {
|
||||||
const query = searchQueryInput.value.trim();
|
if (!keypadWrapper || !toggleKeypadBtn) return;
|
||||||
if (!query) return;
|
|
||||||
|
|
||||||
try {
|
keypadWrapper.classList.toggle('hidden');
|
||||||
const response = await fetch('/api/search_songs', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({query: query}) });
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
if (data.results && data.results.length > 0) {
|
if (keypadWrapper.classList.contains('hidden')) {
|
||||||
const resultList = data.results.map(item => `${item[0]}: ${item[1]}`).join('\n');
|
toggleKeypadBtn.textContent = 'Pokaži tipkovnico';
|
||||||
displayArea.innerHTML = '<span class="status-message">' + resultList.replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br>') + '</span>';
|
|
||||||
} else {
|
} else {
|
||||||
displayArea.innerHTML = '<span class="status-message">Ni zadetkov.</span>';
|
toggleKeypadBtn.textContent = 'Skrij tipkovnico';
|
||||||
}
|
|
||||||
searchQueryInput.value = '';
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Napaka pri iskanju:', error);
|
|
||||||
displayArea.innerHTML = '<span class="status-message">Napaka: ni povezave do strežnika</span>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dodaj poslušalce
|
// ============================
|
||||||
console.log('Dodajam event listenerje...');
|
// EVENT LISTENERJI
|
||||||
loadBtn.addEventListener('click', loadSong);
|
// ============================
|
||||||
console.log('loadBtn listener dodan');
|
|
||||||
songNumberInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') loadSong(); });
|
|
||||||
console.log('songNumberInput listener dodan');
|
|
||||||
|
|
||||||
/* searchBtn.addEventListener('click', searchSongs);
|
// številke na zaslonu
|
||||||
searchQueryInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') searchSongs(); }); */
|
keypadButtons.forEach(btn => {
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
vibrate();
|
||||||
|
const key = btn.dataset.key;
|
||||||
|
if (key !== undefined) {
|
||||||
|
addDigit(key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
capsBtn.addEventListener('click', toggleCaps);
|
// Enter
|
||||||
prevBtn.addEventListener('click', prevPage);
|
loadBtn.addEventListener('click', () => {
|
||||||
nextBtn.addEventListener('click', nextPage);
|
vibrate();
|
||||||
darkBtn.addEventListener('click', clearScreen);
|
loadSong();
|
||||||
console.log('Vsi event listenerji dodani');
|
});
|
||||||
|
|
||||||
// Začetna inicijalizacija
|
// C
|
||||||
console.log('Začenjam začetno inicijalizacijo...');
|
clearBtn.addEventListener('click', () => {
|
||||||
updateState();
|
vibrate();
|
||||||
|
clearInput();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Nazaj
|
||||||
|
prevBtn.addEventListener('click', () => {
|
||||||
|
vibrate();
|
||||||
|
prevPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Zastri
|
||||||
|
nextBtn.addEventListener('click', () => {
|
||||||
|
vibrate();
|
||||||
|
clearScreen();
|
||||||
|
});
|
||||||
|
|
||||||
|
// AAaa
|
||||||
|
darkBtn.addEventListener('click', () => {
|
||||||
|
vibrate();
|
||||||
|
toggleCaps();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Skrij/Pokaži tipkovnico
|
||||||
|
if (toggleKeypadBtn) {
|
||||||
|
toggleKeypadBtn.addEventListener('click', toggleKeypad);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fizična tipkovnica
|
||||||
|
document.addEventListener('keydown', (e) => {
|
||||||
|
// na telefonu ni potrebe; na velikih ekranih pa naj dela
|
||||||
|
if (window.innerWidth < 901) return;
|
||||||
|
|
||||||
|
// da ne ponavlja pri držanju tipke
|
||||||
|
if (e.repeat) return;
|
||||||
|
|
||||||
|
// številke
|
||||||
|
if (e.key >= '0' && e.key <= '9') {
|
||||||
|
e.preventDefault();
|
||||||
|
addDigit(e.key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enter
|
||||||
|
if (e.key === 'Enter' || e.code === 'NumpadEnter') {
|
||||||
|
e.preventDefault();
|
||||||
|
loadSong();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// C
|
||||||
|
if (e.key === 'Backspace' || e.key === 'Delete') {
|
||||||
|
e.preventDefault();
|
||||||
|
clearInput();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zastri
|
||||||
|
if (e.key === '+' || e.code === 'NumpadAdd') {
|
||||||
|
e.preventDefault();
|
||||||
|
clearScreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nazaj
|
||||||
|
if (e.key === '-' || e.code === 'NumpadSubtract') {
|
||||||
|
e.preventDefault();
|
||||||
|
prevPage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AAaa
|
||||||
|
if (e.key === '*' || e.code === 'NumpadMultiply') {
|
||||||
|
e.preventDefault();
|
||||||
|
toggleCaps();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// numpad številke
|
||||||
|
if (e.code.startsWith('Numpad') && /\d/.test(e.key)) {
|
||||||
|
e.preventDefault();
|
||||||
|
addDigit(e.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// začetno stanje
|
||||||
|
updateState(true);
|
||||||
|
requestWakeLock();
|
||||||
|
|
||||||
|
// osveževanje za sinhronizacijo med več napravami
|
||||||
|
setInterval(() => {
|
||||||
|
updateState(false);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
// Osveži stanje vsako sekundo (za sinhronizacijo s tipkovnico)
|
|
||||||
// setInterval(updateState, 1000);
|
|
||||||
console.log('JavaScript inicializacija zaključena');
|
console.log('JavaScript inicializacija zaključena');
|
||||||
@@ -4,101 +4,109 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--vh: 100vh;
|
||||||
|
--container-min-h: 100vh;
|
||||||
|
--keypad-gap: 10px;
|
||||||
|
--panel-bg: #111111;
|
||||||
|
--body-bg: #000000;
|
||||||
|
--text-main: #ffffff;
|
||||||
|
--text-muted: #aaaaaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@supports (height: 100svh) {
|
||||||
|
:root {
|
||||||
|
--vh: 100svh;
|
||||||
|
--container-min-h: 100svh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@supports (height: 100dvh) {
|
||||||
|
:root {
|
||||||
|
--vh: 100dvh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Times New Roman', serif;
|
font-family: 'Times New Roman', serif;
|
||||||
background-color: #0a0a0a;
|
background-color: #0a0a0a;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
display: flex;
|
min-height: var(--container-min-h);
|
||||||
flex-direction: column;
|
overflow: auto;
|
||||||
height: 100vh;
|
|
||||||
overflow: hidden; /* Prevent body scroll */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
min-height: var(--vh);
|
||||||
padding: 0;
|
height: var(--vh);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
background-color: var(--body-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gornja vrstica - Vnos pesmi */
|
/* skrito vnosno polje - script.js ga še vedno uporablja */
|
||||||
.top-bar {
|
#song-number {
|
||||||
background-color: #1a1a1a;
|
display: none;
|
||||||
padding: 15px;
|
}
|
||||||
border-bottom: 2px solid #333;
|
|
||||||
|
/* vrstica s stanjem */
|
||||||
|
.status-bar {
|
||||||
|
background-color: #111111;
|
||||||
|
border-bottom: 1px solid #222;
|
||||||
|
color: #dddddd;
|
||||||
|
padding: 8px 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
justify-content: space-between;
|
||||||
flex-shrink: 0; /* Keep fixed size */
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-bar label {
|
.page-info {
|
||||||
font-size: 16px;
|
color: #cccccc;
|
||||||
font-weight: bold;
|
font-size: 20px;
|
||||||
|
line-height: 1.2;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-bar input {
|
.toggle-keypad-btn {
|
||||||
padding: 10px 15px;
|
display: none;
|
||||||
font-size: 16px;
|
background-color: #333;
|
||||||
background-color: #2a2a2a;
|
color: #fff;
|
||||||
border: 1px solid #444;
|
|
||||||
color: #ffffff;
|
|
||||||
border-radius: 4px;
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-bar button {
|
|
||||||
padding: 10px 20px;
|
|
||||||
font-size: 16px;
|
|
||||||
background-color: #3a7ca5;
|
|
||||||
border: none;
|
border: none;
|
||||||
color: white;
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
font-size: 15px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-bar button:hover {
|
.toggle-keypad-btn:hover {
|
||||||
background-color: #2d6183;
|
filter: brightness(1.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.caps-toggle {
|
/* glavni prikaz besedila */
|
||||||
padding: 10px 15px;
|
|
||||||
font-size: 14px;
|
|
||||||
background-color: #4a4a4a;
|
|
||||||
border: 1px solid #666;
|
|
||||||
color: #ffffff;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.caps-toggle.active {
|
|
||||||
background-color: #3a7ca5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sredenska vrstica - Prikaz besedila */
|
|
||||||
.content {
|
.content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start; /* Better for scrolling long text */
|
align-items: flex-start;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 20px;
|
padding: 20px 16px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
-webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lyrics-display {
|
.lyrics-display {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 24px; /* Adjusted for mobile */
|
font-size: 24px;
|
||||||
line-height: 1.4;
|
line-height: 1.45;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-message {
|
.status-message {
|
||||||
@@ -106,125 +114,198 @@ body {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Donja vrstica - Navigacijski gumbi */
|
/* ovijalec tipkovnice */
|
||||||
.bottom-bar {
|
.keypad-wrapper {
|
||||||
background-color: #1a1a1a;
|
flex-shrink: 0;
|
||||||
padding: 15px;
|
background-color: #111111;
|
||||||
border-top: 2px solid #333;
|
border-top: 1px solid #222;
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
gap: 10px;
|
|
||||||
align-items: center;
|
|
||||||
flex-shrink: 0; /* Keep fixed size */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-bar button {
|
.keypad-wrapper.hidden {
|
||||||
padding: 12px 10px;
|
display: none;
|
||||||
font-size: 16px;
|
}
|
||||||
|
|
||||||
|
/* numerična tipkovnica */
|
||||||
|
.keypad {
|
||||||
|
background-color: #111111;
|
||||||
|
padding: 12px;
|
||||||
|
padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: var(--keypad-gap);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* osnovni videz gumbov */
|
||||||
|
.keypad button {
|
||||||
|
min-height: 58px;
|
||||||
border: none;
|
border: none;
|
||||||
color: white;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
font-family: Arial, sans-serif;
|
||||||
transition: background-color 0.3s;
|
font-size: 28px;
|
||||||
flex: 1;
|
font-weight: bold;
|
||||||
min-width: 0; /* Allow shrinking */
|
transition: transform 0.05s ease, filter 0.2s ease, opacity 0.2s ease, box-shadow 0.05s ease;
|
||||||
max-width: 120px;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-nav {
|
.keypad button:active {
|
||||||
background-color: #556b79;
|
transform: scale(0.80);
|
||||||
|
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-nav:hover {
|
.keypad button:disabled {
|
||||||
background-color: #3d4a52;
|
opacity: 0.45;
|
||||||
}
|
|
||||||
|
|
||||||
.btn-nav:disabled {
|
|
||||||
background-color: #2a2a2a;
|
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
opacity: 0.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* številke */
|
||||||
|
.btn-key {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
color: #111111;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zastri / Nazaj */
|
||||||
|
.btn-action {
|
||||||
|
background-color: #c28b24;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AAaa */
|
||||||
.btn-dark {
|
.btn-dark {
|
||||||
background-color: #8b4513;
|
background-color: #8b4513;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-dark:hover {
|
.btn-dark.active {
|
||||||
background-color: #6b3410;
|
outline: 2px solid #ffffff;
|
||||||
|
outline-offset: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* C */
|
||||||
|
.btn-clear {
|
||||||
|
background-color: #555555;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enter čez dve vrstici */
|
||||||
|
.btn-enter {
|
||||||
|
background-color: #1f8a46;
|
||||||
|
color: #ffffff;
|
||||||
|
grid-row: span 2;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* hover samo za naprave z miško */
|
||||||
|
@media (hover: hover) and (pointer: fine) {
|
||||||
|
.btn-key:hover {
|
||||||
|
filter: brightness(0.92);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-action:hover,
|
||||||
|
.btn-dark:hover,
|
||||||
|
.btn-clear:hover,
|
||||||
|
.btn-enter:hover,
|
||||||
|
.toggle-keypad-btn:hover {
|
||||||
|
filter: brightness(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* tablica / manjši laptop */
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.lyrics-display {
|
||||||
|
font-size: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-info {
|
.page-info {
|
||||||
color: #999;
|
font-size: 18px;
|
||||||
font-size: 16px;
|
|
||||||
min-width: 60px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====== Viewport & varni odmik (mobilni) ====== */
|
.keypad button {
|
||||||
|
min-height: 54px;
|
||||||
/* Fallback: najprej uporabimo 100vh, potem nove enote (svh/dvh) kjer so podprte */
|
font-size: 24px;
|
||||||
:root {
|
}
|
||||||
--vh: 100vh; /* fallback */
|
|
||||||
--container-min-h: 100vh; /* fallback */
|
|
||||||
--bottom-bar-h: 60px; /* realna višina spodnje vrstice (glej .bottom-bar padding) */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Novejši brskalniki – stabilna višina toolbara */
|
/* telefon */
|
||||||
@supports (height: 100svh) {
|
@media (max-width: 600px) {
|
||||||
:root { --vh: 100svh; --container-min-h: 100svh; }
|
|
||||||
}
|
|
||||||
/* Alternativa: dinamična višina (ko toolbar skrije/prikaže) */
|
|
||||||
@supports (height: 100dvh) {
|
|
||||||
:root { --vh: 100dvh; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Odstrani zaklepanje scrolla – to pogosto povzroči prekrivanje na mobilnih */
|
|
||||||
body {
|
|
||||||
/* odstrani prejšnje overflow: hidden; */
|
|
||||||
overflow: auto !important;
|
|
||||||
min-height: var(--container-min-h);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Glavni vsebnik naj razpne celoten pogled in upošteva varne robove */
|
|
||||||
.container {
|
|
||||||
min-height: var(--vh);
|
|
||||||
padding-bottom: calc(var(--bottom-bar-h) + env(safe-area-inset-bottom, 0px));
|
|
||||||
/* ostalo iz tvojega CSS lahko ostane */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Vsebinski del naj dopušča scroll, kot že imaš */
|
|
||||||
.content {
|
.content {
|
||||||
/* ostane: flex:1; overflow-y:auto; ... */
|
padding: 14px 10px;
|
||||||
/* vendar dodamo malo dna, da zadnja vrstica besedila ne trči v panel */
|
|
||||||
padding-bottom: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Spodnja vrstica – naj bo vedno vidna in nad UI brskalnika */
|
.lyrics-display {
|
||||||
.bottom-bar {
|
font-size: 20px;
|
||||||
position: sticky; /* ostane z dokumentom, a se prilepi na dno ob scrollu */
|
line-height: 1.4;
|
||||||
bottom: 0;
|
|
||||||
z-index: 1000; /* nad vsebino */
|
|
||||||
/* ozadje + robovi ostanejo */
|
|
||||||
padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
|
|
||||||
/* poravnaj navidezno višino: */
|
|
||||||
min-height: var(--bottom-bar-h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gumbi v spodnjem panelu: malenkost večja višina za lažji tap */
|
.status-message {
|
||||||
.bottom-bar button {
|
font-size: 18px;
|
||||||
min-height: 44px; /* Apple/Google priporočilo za ‘tap targets’ */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Top bar: zadrži stabilno višino, a brez vpliva na dno */
|
.page-info {
|
||||||
.top-bar {
|
font-size: 18px;
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- (Opcijsko) tema: prilagodi spodnji panel za boljši kontrast nad browser UI --- */
|
.keypad {
|
||||||
@supports (backdrop-filter: blur(4px)) {
|
gap: 8px;
|
||||||
.bottom-bar {
|
padding: 10px;
|
||||||
background-color: rgba(26, 26, 26, 0.95);
|
padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
|
||||||
backdrop-filter: saturate(120%) blur(4px);
|
}
|
||||||
|
|
||||||
|
.keypad button {
|
||||||
|
min-height: 52px;
|
||||||
|
font-size: 22px;
|
||||||
|
border-radius: 9px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* zelo majhen telefon */
|
||||||
|
@media (max-width: 400px) {
|
||||||
|
.lyrics-display {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-info {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keypad button {
|
||||||
|
min-height: 48px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* veliki ekrani */
|
||||||
|
@media (min-width: 901px) {
|
||||||
|
.toggle-keypad-btn {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keypad {
|
||||||
|
width: fit-content;
|
||||||
|
margin: 0 auto;
|
||||||
|
grid-template-columns: repeat(4, 120px);
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keypad button {
|
||||||
|
height: 80px;
|
||||||
|
min-height: 80px;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-action,
|
||||||
|
.btn-dark,
|
||||||
|
.btn-clear {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-enter {
|
||||||
|
font-size: 22px;
|
||||||
|
height: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,41 +3,53 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
|
||||||
<title>Projektor pesmi - Web vmesnik</title>
|
<title>Projektor pesmi</title>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Gornja vrstica -->
|
|
||||||
<div class="top-bar">
|
|
||||||
<!-- <label for="song-number">Pesem:</label> -->
|
|
||||||
<input type="number" id="song-number" placeholder="Vpiši številko" min="0">
|
|
||||||
<button id="load-btn">▷</button>
|
|
||||||
|
|
||||||
<!-- <label for="search-query">Iskanje:</label>
|
<input type="text" id="song-number">
|
||||||
<input type="text" id="search-query" placeholder="Naslovna beseda...">
|
|
||||||
<button id="search-btn">Išči</button> -->
|
|
||||||
|
|
||||||
<button id="caps-btn" class="btn-dark">A/a</button>
|
<div class="status-bar">
|
||||||
|
<span id="page-info" class="page-info"></span>
|
||||||
|
<button id="toggle-keypad-btn" class="toggle-keypad-btn" type="button">Skrij tipkovnico</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Sredenska vrstica - Prikaz -->
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div id="display-area" class="lyrics-display">
|
<div id="display-area" class="lyrics-display">
|
||||||
<span class="status-message">Pripravljeno. Vpiši številko pesmi.</span>
|
<span class="status-message">Pripravljeno. Vpiši številko pesmi.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Spodnja vrstica - Navigacija -->
|
<div id="keypad-wrapper" class="keypad-wrapper">
|
||||||
<div class="bottom-bar">
|
<div class="keypad">
|
||||||
<button id="prev-btn" class="btn◁-nav">◄</button>
|
|
||||||
<span id="page-info" class="page-info"></span>
|
<button class="btn-key" data-key="7">7</button>
|
||||||
<button id="dark-btn" class="btn-dark">■</button>
|
<button class="btn-key" data-key="8">8</button>
|
||||||
<span id="page-info-right" class="page-info"></span>
|
<button class="btn-key" data-key="9">9</button>
|
||||||
<button id="next-btn" class="btn-nav">►</button>
|
<button id="next-btn" class="btn-action">Zastri</button>
|
||||||
|
|
||||||
|
<button class="btn-key" data-key="4">4</button>
|
||||||
|
<button class="btn-key" data-key="5">5</button>
|
||||||
|
<button class="btn-key" data-key="6">6</button>
|
||||||
|
<button id="prev-btn" class="btn-action">Nazaj</button>
|
||||||
|
|
||||||
|
<button class="btn-key" data-key="1">1</button>
|
||||||
|
<button class="btn-key" data-key="2">2</button>
|
||||||
|
<button class="btn-key" data-key="3">3</button>
|
||||||
|
<button id="load-btn" class="btn-enter">Enter</button>
|
||||||
|
|
||||||
|
<button id="dark-btn" class="btn-dark">AAaa</button>
|
||||||
|
<button class="btn-key" data-key="0">0</button>
|
||||||
|
<button id="clear-btn" class="btn-clear">C</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user