अरण्यानी और कौशिक: वन और वेदना की प्रेम गाथा - भाग १
अरण्यानी और कौशिक कहानी का दृश्य

एक कालजयी गाथा

अरण्यानी च कौशिकश्च

वन और वेदना की प्रेम गाथा

... (पहले जैसा) ...

भाग 1: तपस्वी का आगमन

प्रारंभिक यात्रा

... (पहले जैसा) ...

... (पहले जैसा) ...

वन में आसन

... (पहले जैसा) ...

... (पहले जैसा) ...

... (पहले जैसा) ...
// चूँकि यह बाहरी स्क्रिप्ट है, इसे यहाँ JS में लोड नहीं कर सकते, आपको इसे HTML में डालना होगा। // फिलहाल, हम पिछली रेगेक्स आधारित विधि का उपयोग करेंगे। function clearSearchHighlights() { /* पहले जैसा */ contentToSearch.forEach(paragraph => { const marks = paragraph.querySelectorAll('mark'); marks.forEach(mark => { const parent = mark.parentNode; parent.replaceChild(document.createTextNode(mark.textContent), mark); }); paragraph.normalize(); }); } function performSearch() { /* पहले जैसा */ clearSearchHighlights(); const searchTerm = searchInput.value.trim(); if (searchTerm === "") { return; } const regex = new RegExp(searchTerm.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'gi'); let found = false; let firstMatchElement = null; contentToSearch.forEach(paragraph => { const walker = document.createTreeWalker(paragraph, NodeFilter.SHOW_TEXT, null, false); let node; let nodesToReplace = []; while (node = walker.nextNode()) { const text = node.nodeValue; let lastIndex = 0; let match; const newNodeContainer = document.createDocumentFragment(); while ((match = regex.exec(text)) !== null) { found = true; newNodeContainer.appendChild(document.createTextNode(text.substring(lastIndex, match.index))); const mark = document.createElement('mark'); mark.textContent = match[0]; newNodeContainer.appendChild(mark); if (!firstMatchElement) { firstMatchElement = mark; } lastIndex = regex.lastIndex; } newNodeContainer.appendChild(document.createTextNode(text.substring(lastIndex))); if (newNodeContainer.childNodes.length > 1 || (newNodeContainer.firstChild && newNodeContainer.firstChild.nodeType !== Node.TEXT_NODE)) { nodesToReplace.push({ original: node, replacement: newNodeContainer }); } } nodesToReplace.forEach(item => { item.original.parentNode.replaceChild(item.replacement, item.original); }); }); if (!found) { alert(`"${searchTerm}" नहीं मिला।`); } else if (firstMatchElement) { const offsetTop = firstMatchElement.getBoundingClientRect().top + window.pageYOffset; // सही ऑफसेट window.scrollTo({ top: offsetTop - navHeight - 80, behavior: 'smooth' }); // firstMatchElement.focus(); // फोकस अक्सर काम नहीं करता } } searchButton.addEventListener('click', performSearch); searchInput.addEventListener('keyup', function(event) { if (event.key === 'Enter') { performSearch(); } else if (searchInput.value.trim() === "") { clearSearchHighlights(); } }); // --- सर्च कार्यक्षमता समाप्त --- // --- स्वचालित पेजिनेशन --- function setupPagination() { const paginationContainer = document.querySelector('.pagination-section'); if (!paginationContainer) { console.warn("Pagination container not found."); return; } const totalPages = 6; const baseFilename = 'aranyani-kaushik-part'; // ** यह नाम बदलें ** const fileExtension = '.html'; let currentPageNumber = 1; try { const pathParts = window.location.pathname.split('/'); const filename = pathParts.pop() || pathParts.pop(); const match = filename.match(/part(\d+)/i); if (match && match[1]) { const num = parseInt(match[1], 10); if (!isNaN(num) && num >= 1 && num <= totalPages) { currentPageNumber = num; } else { console.warn(`Pagination: Page number ${num} invalid.`); currentPageNumber = 1; } } else { console.warn("Pagination: No page number in URL."); currentPageNumber = 1; } } catch (e) { console.error("Pagination Error:", e); currentPageNumber = 1; } paginationContainer.innerHTML = ''; const prevLink = document.createElement('a'); prevLink.textContent = '‹ पिछला'; prevLink.classList.add('pagination-link'); if (currentPageNumber > 1) { prevLink.href = `${baseFilename}${currentPageNumber - 1}${fileExtension}`; } else { prevLink.classList.add('disabled'); prevLink.href = "#"; } paginationContainer.appendChild(prevLink); const startPage = Math.max(1, currentPageNumber - 4); const endPage = Math.min(totalPages, currentPageNumber + 1); if (startPage > 1) { // यदि पहले पेज से गैप है const firstLink = document.createElement('a'); firstLink.href = `${baseFilename}1${fileExtension}`; firstLink.textContent = 1; firstLink.classList.add('pagination-link'); paginationContainer.appendChild(firstLink); if (startPage > 2) { const ellipsis = document.createElement('span'); ellipsis.textContent = '...'; ellipsis.classList.add('pagination-label'); paginationContainer.appendChild(ellipsis); } } for (let i = startPage; i <= endPage; i++) { if (i === currentPageNumber) { const currentSpan = document.createElement('span'); currentSpan.textContent = i; currentSpan.classList.add('pagination-link', 'current'); paginationContainer.appendChild(currentSpan); } else { const link = document.createElement('a'); link.href = `${baseFilename}${i}${fileExtension}`; link.textContent = i; link.classList.add('pagination-link'); paginationContainer.appendChild(link); } } if (endPage < totalPages) { // यदि अंतिम पेज से गैप है if (endPage < totalPages - 1) { const ellipsis = document.createElement('span'); ellipsis.textContent = '...'; ellipsis.classList.add('pagination-label'); paginationContainer.appendChild(ellipsis); } const lastLink = document.createElement('a'); lastLink.href = `${baseFilename}${totalPages}${fileExtension}`; lastLink.textContent = totalPages; lastLink.classList.add('pagination-link'); paginationContainer.appendChild(lastLink); } const nextLink = document.createElement('a'); nextLink.textContent = 'अगला ›'; nextLink.classList.add('pagination-link'); if (currentPageNumber < totalPages) { nextLink.href = `${baseFilename}${currentPageNumber + 1}${fileExtension}`; } else { nextLink.classList.add('disabled'); nextLink.href = "#"; } paginationContainer.appendChild(nextLink); } setupPagination(); // --- स्वचालित पेजिनेशन समाप्त --- // --- TTS कार्यक्षमता --- function speakText(text, lang = "hi-IN") { if ('speechSynthesis' in window) { window.speechSynthesis.cancel(); const speech = new SpeechSynthesisUtterance(text); speech.lang = lang; speech.volume = 1; speech.rate = 0.9; speech.pitch = 1; window.speechSynthesis.speak(speech); } else { console.warn("Speech synthesis not supported."); } } const specialTermElements = document.querySelectorAll(".special-term-1, .special-term-2, .special-term-3"); specialTermElements.forEach(term => { term.addEventListener("click", (event) => { event.stopPropagation(); const textToSpeak = term.textContent; speakText(textToSpeak, "hi-IN"); }); term.title = "सुनने के लिए क्लिक करें"; }); const paragraphElements = document.querySelectorAll(".custom-p"); paragraphElements.forEach(paragraph => { if (!paragraph.closest('.story-description')) { paragraph.addEventListener("click", () => { const textToSpeak = paragraph.textContent; speakText(textToSpeak, "hi-IN"); }); paragraph.title = "पूरा पैराग्राफ सुनने के लिए क्लिक करें"; paragraph.addEventListener("mouseenter", () => { paragraph.style.color = "#C71585"; paragraph.style.textShadow = "1px 1px 3px rgba(0, 0, 0, 0.2)"; }); paragraph.addEventListener("mouseout", () => { paragraph.style.color = ""; paragraph.style.textShadow = ""; }); } else { paragraph.style.cursor = "default"; } }); }); // DOMContentLoaded समाप्त

Post a Comment

0 Comments