HMC | Lyrics
${song.title}
CHURCH SLIDES
`;
div.onclick = () => openLyrics(song.id);
listDiv.appendChild(div);
});
};
window.openLyrics = (id) => {
const song = window.songs.find(s => s.id === id);
if(!song) return;
window.currentOpenSongId = id;
document.getElementById('ov-title').innerText = song.title;
document.getElementById('ov-text').innerText = song.lyrics;
document.getElementById('ov-yt').onclick = () => window.open(song.yt, '_blank');
const isFav = localStorage.getItem('fav_' + id) === 'true';
updateFavIcon(isFav);
const overlay = document.getElementById('lyrics-overlay');
overlay.style.display = 'flex';
document.getElementById('lyric-scroll-area').scrollTop = 0;
setTimeout(() => overlay.classList.add('active'), 10);
};
window.toggleFavorite = () => {
const id = window.currentOpenSongId;
const isFav = localStorage.getItem('fav_' + id) === 'true';
localStorage.setItem('fav_' + id, !isFav);
updateFavIcon(!isFav);
renderList();
const icon = document.getElementById('ov-fav-icon');
icon.style.transform = "scale(1.5)";
setTimeout(() => icon.style.transform = "scale(1)", 200);
};
window.saveNewSong = async () => {
const t = document.getElementById('new-title').value;
const l = document.getElementById('new-lyrics').value;
const y = document.getElementById('new-yt').value;
if(!t || !l) return alert("Title and Lyrics required");
try {
if(window.currentOpenSongId && document.getElementById('update-form').style.display === 'block') {
await updateDoc(doc(db, "hmc_songs", window.currentOpenSongId), { title: t, lyrics: l, yt: y });
window.currentOpenSongId = null;
} else {
await addDoc(collection(db, "hmc_songs"), { title: t, lyrics: l, yt: y });
}
document.getElementById('new-title').value = '';
document.getElementById('new-lyrics').value = '';
document.getElementById('new-yt').value = '';
alert("Cloud Updated Successfully");
} catch (e) { console.error(e); }
};
window.deleteSong = async (id) => {
if(confirm("Delete this song from cloud?")) {
await deleteDoc(doc(db, "hmc_songs", id));
}
};
window.renderAdminEditList = () => {
const editDiv = document.getElementById('edit-list');
editDiv.innerHTML = '';
window.songs.forEach((song, idx) => {
const div = document.createElement('div');
div.className = 'edit-list-item';
div.innerHTML = `
${idx + 1}. ${song.title}
`;
editDiv.appendChild(div);
});
};
window.loadForEdit = (id) => {
const song = window.songs.find(s => s.id === id);
window.currentOpenSongId = id;
document.getElementById('new-title').value = song.title;
document.getElementById('new-lyrics').value = song.lyrics;
document.getElementById('new-yt').value = song.yt;
document.getElementById('admin-modal').scrollTop = 0;
};
function updateFavIcon(isFav) {
const icon = document.getElementById('ov-fav-icon');
icon.className = isFav ? 'fas fa-heart' : 'far fa-heart';
icon.style.color = isFav ? '#D4AF37' : '#fff';
}
window.closeLyrics = () => {
const overlay = document.getElementById('lyrics-overlay');
overlay.classList.remove('active');
setTimeout(() => overlay.style.display = 'none', 500);
};
window.shareLyrics = () => {
const song = window.songs.find(s => s.id === window.currentOpenSongId);
window.open(`https://wa.me/?text=${encodeURIComponent('*'+song.title+'*\n\n'+song.lyrics)}`);
};
window.filterTab = (type, el) => {
window.currentTabFilter = type;
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
el.classList.add('active');
renderList();
};
window.openAdmin = () => document.getElementById('admin-modal').style.display = 'block';
window.closeAdmin = () => {
document.getElementById('admin-modal').style.display = 'none';
document.getElementById('login-form').style.display = 'block';
document.getElementById('update-form').style.display = 'none';
};
window.loginAdmin = () => {
if(document.getElementById('admin-pass').value === "SKS@2026") {
document.getElementById('login-form').style.display = 'none';
document.getElementById('update-form').style.display = 'block';
renderAdminEditList();
} else { alert("Access Denied"); }
};
ಬೈಬಲ್- ಕನ್ನಡದಲ್ಲಿ, ಜೀವನದಲ್ಲಿ!
HMC | Lyrics
${song.title}
CHURCH SLIDES
`;
div.onclick = () => openLyrics(song.id);
listDiv.appendChild(div);
});
};
window.openLyrics = (id) => {
const song = window.songs.find(s => s.id === id);
if(!song) return;
window.currentOpenSongId = id;
document.getElementById('ov-title').innerText = song.title;
document.getElementById('ov-text').innerText = song.lyrics;
document.getElementById('ov-yt').onclick = () => window.open(song.yt, '_blank');
const isFav = localStorage.getItem('fav_' + id) === 'true';
updateFavIcon(isFav);
const overlay = document.getElementById('lyrics-overlay');
overlay.style.display = 'flex';
document.getElementById('lyric-scroll-area').scrollTop = 0;
setTimeout(() => overlay.classList.add('active'), 10);
};
window.toggleFavorite = () => {
const id = window.currentOpenSongId;
const isFav = localStorage.getItem('fav_' + id) === 'true';
localStorage.setItem('fav_' + id, !isFav);
updateFavIcon(!isFav);
renderList();
const icon = document.getElementById('ov-fav-icon');
icon.style.transform = "scale(1.5)";
setTimeout(() => icon.style.transform = "scale(1)", 200);
};
window.saveNewSong = async () => {
const t = document.getElementById('new-title').value;
const l = document.getElementById('new-lyrics').value;
const y = document.getElementById('new-yt').value;
if(!t || !l) return alert("Title and Lyrics required");
try {
if(window.currentOpenSongId && document.getElementById('update-form').style.display === 'block') {
await updateDoc(doc(db, "hmc_songs", window.currentOpenSongId), { title: t, lyrics: l, yt: y });
window.currentOpenSongId = null;
} else {
await addDoc(collection(db, "hmc_songs"), { title: t, lyrics: l, yt: y });
}
document.getElementById('new-title').value = '';
document.getElementById('new-lyrics').value = '';
document.getElementById('new-yt').value = '';
alert("Cloud Updated Successfully");
} catch (e) { console.error(e); }
};
window.deleteSong = async (id) => {
if(confirm("Delete this song from cloud?")) {
await deleteDoc(doc(db, "hmc_songs", id));
}
};
window.renderAdminEditList = () => {
const editDiv = document.getElementById('edit-list');
editDiv.innerHTML = '';
window.songs.forEach((song, idx) => {
const div = document.createElement('div');
div.className = 'edit-list-item';
div.innerHTML = `
${idx + 1}. ${song.title}
`;
editDiv.appendChild(div);
});
};
window.loadForEdit = (id) => {
const song = window.songs.find(s => s.id === id);
window.currentOpenSongId = id;
document.getElementById('new-title').value = song.title;
document.getElementById('new-lyrics').value = song.lyrics;
document.getElementById('new-yt').value = song.yt;
document.getElementById('admin-modal').scrollTop = 0;
};
function updateFavIcon(isFav) {
const icon = document.getElementById('ov-fav-icon');
icon.className = isFav ? 'fas fa-heart' : 'far fa-heart';
icon.style.color = isFav ? '#D4AF37' : '#fff';
}
window.closeLyrics = () => {
const overlay = document.getElementById('lyrics-overlay');
overlay.classList.remove('active');
setTimeout(() => overlay.style.display = 'none', 500);
};
window.shareLyrics = () => {
const song = window.songs.find(s => s.id === window.currentOpenSongId);
window.open(`https://wa.me/?text=${encodeURIComponent('*'+song.title+'*\n\n'+song.lyrics)}`);
};
window.filterTab = (type, el) => {
window.currentTabFilter = type;
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
el.classList.add('active');
renderList();
};
window.openAdmin = () => document.getElementById('admin-modal').style.display = 'block';
window.closeAdmin = () => {
document.getElementById('admin-modal').style.display = 'none';
document.getElementById('login-form').style.display = 'block';
document.getElementById('update-form').style.display = 'none';
};
window.loginAdmin = () => {
if(document.getElementById('admin-pass').value === "SKS@2026") {
document.getElementById('login-form').style.display = 'none';
document.getElementById('update-form').style.display = 'block';
renderAdminEditList();
} else { alert("Access Denied"); }
};