Odisha Board Digital Library PRO
Class 6–10 Books with Smart Features
const baseURL = "https://odishaboardsolutions.com/pdf/";
const books = [ { name: "Sahitya Surabhi", class: "8", subject: "Odia", slug: "sahitya-surabhi", chapters: ["Chapter 1", "Chapter 2", "Chapter 3"] }, { name: "Jigyasa Science", class: "8", subject: "Science", slug: "jigyasa-science", chapters: ["Chapter 1", "Chapter 2"] }, { name: "Mathematics", class: "9", subject: "Math", slug: "math-class-9", chapters: ["Chapter 1", "Chapter 2"] } ];
function generatePDFLink(book, chapter=null) { if(chapter){ return `${baseURL}${book.class}/${book.slug}/${chapter.replace(/ /g,'-').toLowerCase()}.pdf`; } return `${baseURL}${book.class}/${book.slug}.pdf`; }
function displayBooks(data) { const list = document.getElementById("bookList"); list.innerHTML = "";
data.forEach((book, index) => { let chaptersHTML = "";
book.chapters.forEach(ch => { chaptersHTML += `${ch}`; });
list.innerHTML += `
${book.name}
Class ${book.class} - ${book.subject}
`; }); }
function toggleChapter(index){ const el = document.getElementById(`chapters-${index}`); el.style.display = el.style.display === "block" ? "none" : "block"; }
function fuzzyMatch(text, search) { return text.toLowerCase().includes(search.toLowerCase()); }
function filterBooks() { const search = document.getElementById("search").value; const classVal = document.getElementById("classFilter").value; const subjectVal = document.getElementById("subjectFilter").value;
const filtered = books.filter(book => { return ( fuzzyMatch(book.name, search) && (classVal === "" || book.class === classVal) && (subjectVal === "" || book.subject === subjectVal) ); });
displayBooks(filtered); showSuggestions(search); }
function showSuggestions(search){ const sugBox = document.getElementById("suggestions"); sugBox.innerHTML = "";
if(!search) return;
books.forEach(book => { if(book.name.toLowerCase().includes(search.toLowerCase())){ sugBox.innerHTML += `
`; } }); }
function selectSuggestion(name){ document.getElementById("search").value = name; filterBooks(); }
function toggleDarkMode(){ document.body.classList.toggle("dark"); }
// Events document.getElementById("search").addEventListener("input", filterBooks); document.getElementById("classFilter").addEventListener("change", filterBooks); document.getElementById("subjectFilter").addEventListener("change", filterBooks);
// Init displayBooks(books);