Update index.html
Browse files- index.html +16 -89
index.html
CHANGED
|
@@ -81,6 +81,12 @@
|
|
| 81 |
.voice-option.selected {
|
| 82 |
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
| 83 |
border: 2px solid #3b82f6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
.progress-bar {
|
|
@@ -792,15 +798,6 @@
|
|
| 792 |
<div class="glass-effect rounded-2xl p-8 max-w-md w-full mx-4">
|
| 793 |
<h3 class="text-2xl font-semibold mb-6">Save Document</h3>
|
| 794 |
<input type="text" id="document-title" placeholder="Document title" class="w-full p-4 border border-gray-300 rounded-lg mb-6 focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
| 795 |
-
<div class="mb-6">
|
| 796 |
-
<label class="block text-sm font-medium text-gray-700 mb-3">Language</label>
|
| 797 |
-
<select id="save-language" class="w-full border border-gray-300 rounded-lg px-4 py-3 focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
| 798 |
-
<option value="en-US">English (United States)</option>
|
| 799 |
-
<option value="en-GB">English (United Kingdom)</option>
|
| 800 |
-
<option value="en-AU">English (Australia)</option>
|
| 801 |
-
<option value="en-IN">English (India)</option>
|
| 802 |
-
</select>
|
| 803 |
-
</div>
|
| 804 |
<div class="mb-6">
|
| 805 |
<label class="block text-sm font-medium text-gray-700 mb-3">Tags</label>
|
| 806 |
<input type="text" id="document-tags" placeholder="Add tags (comma separated)" class="w-full p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
@@ -955,14 +952,11 @@
|
|
| 955 |
updateUtteranceSettings();
|
| 956 |
});
|
| 957 |
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
showLessVoices.addEventListener('click', () => {
|
| 964 |
-
moreVoices.classList.add('hidden');
|
| 965 |
-
showMoreVoices.classList.remove('hidden');
|
| 966 |
});
|
| 967 |
|
| 968 |
readingModeBtns.forEach(btn => {
|
|
@@ -1422,7 +1416,6 @@
|
|
| 1422 |
const plainText = documentEditor.innerText;
|
| 1423 |
const date = new Date().toLocaleDateString();
|
| 1424 |
const length = plainText.split(/\s+/).length;
|
| 1425 |
-
const language = saveLanguage.value;
|
| 1426 |
const tags = document.getElementById('document-tags').value.trim();
|
| 1427 |
|
| 1428 |
const doc = {
|
|
@@ -1432,7 +1425,7 @@
|
|
| 1432 |
plainText,
|
| 1433 |
date,
|
| 1434 |
length,
|
| 1435 |
-
language,
|
| 1436 |
tags: tags ? tags.split(',').map(t => t.trim()) : []
|
| 1437 |
};
|
| 1438 |
|
|
@@ -1588,14 +1581,6 @@
|
|
| 1588 |
`;
|
| 1589 |
} else {
|
| 1590 |
savedDocsList.innerHTML = paginatedDocs.map((doc, idx) => {
|
| 1591 |
-
const flagClass = doc.language === 'en-US' ? 'flag-us' :
|
| 1592 |
-
doc.language === 'en-GB' ? 'flag-uk' :
|
| 1593 |
-
doc.language === 'en-AU' ? 'flag-au' :
|
| 1594 |
-
doc.language === 'en-IN' ? 'flag-in' :
|
| 1595 |
-
doc.language === 'en-ZA' ? 'flag-za' :
|
| 1596 |
-
doc.language === 'en-IE' ? 'flag-ie' :
|
| 1597 |
-
doc.language === 'en-NZ' ? 'flag-nz' : 'flag-us';
|
| 1598 |
-
|
| 1599 |
const preview = doc.plainText.substring(0, 100) + (doc.plainText.length > 100 ? '...' : '');
|
| 1600 |
const tags = doc.tags ? doc.tags.map(tag => `<span class="inline-block bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full mr-1">${tag}</span>`).join('') : '';
|
| 1601 |
|
|
@@ -1613,8 +1598,7 @@
|
|
| 1613 |
<div class="text-gray-500 font-medium">${doc.length} words</div>
|
| 1614 |
</td>
|
| 1615 |
<td class="px-6 py-4 whitespace-nowrap">
|
| 1616 |
-
<
|
| 1617 |
-
<span class="text-gray-500 font-medium">${doc.language}</span>
|
| 1618 |
</td>
|
| 1619 |
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 1620 |
<div class="flex justify-end space-x-3">
|
|
@@ -1911,7 +1895,7 @@
|
|
| 1911 |
|
| 1912 |
// Initialize default voice selection
|
| 1913 |
setTimeout(() => {
|
| 1914 |
-
const defaultVoice = document.querySelector('.voice-option[data-voice="en-US-
|
| 1915 |
if (defaultVoice) {
|
| 1916 |
defaultVoice.click();
|
| 1917 |
}
|
|
@@ -1968,65 +1952,8 @@
|
|
| 1968 |
e.returnValue = 'You have unsaved changes. Are you sure you want to leave?';
|
| 1969 |
}
|
| 1970 |
});
|
| 1971 |
-
|
| 1972 |
-
// Initialize tooltips (if using a tooltip library)
|
| 1973 |
-
// This is just a placeholder for where you might initialize tooltips
|
| 1974 |
-
|
| 1975 |
-
// Performance optimization: Debounce functions
|
| 1976 |
-
function debounce(func, wait) {
|
| 1977 |
-
let timeout;
|
| 1978 |
-
return function executedFunction(...args) {
|
| 1979 |
-
const later = () => {
|
| 1980 |
-
clearTimeout(timeout);
|
| 1981 |
-
func(...args);
|
| 1982 |
-
};
|
| 1983 |
-
clearTimeout(timeout);
|
| 1984 |
-
timeout = setTimeout(later, wait);
|
| 1985 |
-
};
|
| 1986 |
-
}
|
| 1987 |
-
|
| 1988 |
-
// Debounce search function for better performance
|
| 1989 |
-
searchDocs.addEventListener('input', debounce(filterSavedDocuments, 300));
|
| 1990 |
-
|
| 1991 |
-
// Add visual feedback for buttons
|
| 1992 |
-
document.querySelectorAll('button').forEach(btn => {
|
| 1993 |
-
btn.addEventListener('click', () => {
|
| 1994 |
-
btn.style.transform = 'scale(0.98)';
|
| 1995 |
-
setTimeout(() => {
|
| 1996 |
-
btn.style.transform = '';
|
| 1997 |
-
}, 100);
|
| 1998 |
-
});
|
| 1999 |
-
});
|
| 2000 |
-
|
| 2001 |
-
// Initialize welcome message
|
| 2002 |
-
if (!localStorage.getItem('tts-welcome-shown')) {
|
| 2003 |
-
setTimeout(() => {
|
| 2004 |
-
showNotification('Welcome to HD TTS Document Reader! Start by typing or pasting text, then click play to hear it read aloud.', 'info');
|
| 2005 |
-
localStorage.setItem('tts-welcome-shown', 'true');
|
| 2006 |
-
}, 1000);
|
| 2007 |
-
}
|
| 2008 |
-
|
| 2009 |
-
// Check for Web Speech API support
|
| 2010 |
-
if (!window.speechSynthesis) {
|
| 2011 |
-
showNotification('Your browser does not support speech synthesis. Please try a modern browser like Chrome, Firefox, or Edge.', 'error');
|
| 2012 |
-
}
|
| 2013 |
-
|
| 2014 |
-
// Add focus management for better accessibility
|
| 2015 |
-
document.addEventListener('keydown', (e) => {
|
| 2016 |
-
if (e.key === 'Tab') {
|
| 2017 |
-
// Ensure focus is visible
|
| 2018 |
-
const focusedElement = document.activeElement;
|
| 2019 |
-
if (focusedElement) {
|
| 2020 |
-
focusedElement.style.outline = '2px solid #3b82f6';
|
| 2021 |
-
focusedElement.style.outlineOffset = '2px';
|
| 2022 |
-
}
|
| 2023 |
-
}
|
| 2024 |
-
});
|
| 2025 |
-
|
| 2026 |
-
// Initialize the application
|
| 2027 |
-
console.log('HD TTS Document Reader initialized successfully');
|
| 2028 |
-
showNotification('Application loaded successfully', 'success');
|
| 2029 |
});
|
| 2030 |
</script>
|
| 2031 |
</body>
|
| 2032 |
-
</html>
|
|
|
|
|
|
| 81 |
.voice-option.selected {
|
| 82 |
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
| 83 |
border: 2px solid #3b82f6;
|
| 84 |
+
box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.voice-option .voice-check {
|
| 88 |
+
color: #3b82f6;
|
| 89 |
+
font-size: 1.25rem;
|
| 90 |
}
|
| 91 |
|
| 92 |
.progress-bar {
|
|
|
|
| 798 |
<div class="glass-effect rounded-2xl p-8 max-w-md w-full mx-4">
|
| 799 |
<h3 class="text-2xl font-semibold mb-6">Save Document</h3>
|
| 800 |
<input type="text" id="document-title" placeholder="Document title" class="w-full p-4 border border-gray-300 rounded-lg mb-6 focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 801 |
<div class="mb-6">
|
| 802 |
<label class="block text-sm font-medium text-gray-700 mb-3">Tags</label>
|
| 803 |
<input type="text" id="document-tags" placeholder="Add tags (comma separated)" class="w-full p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
|
|
| 952 |
updateUtteranceSettings();
|
| 953 |
});
|
| 954 |
|
| 955 |
+
voiceOptions.forEach(btn => {
|
| 956 |
+
btn.addEventListener('click', () => {
|
| 957 |
+
const tab = btn.dataset.tab;
|
| 958 |
+
switchTab(tab);
|
| 959 |
+
});
|
|
|
|
|
|
|
|
|
|
| 960 |
});
|
| 961 |
|
| 962 |
readingModeBtns.forEach(btn => {
|
|
|
|
| 1416 |
const plainText = documentEditor.innerText;
|
| 1417 |
const date = new Date().toLocaleDateString();
|
| 1418 |
const length = plainText.split(/\s+/).length;
|
|
|
|
| 1419 |
const tags = document.getElementById('document-tags').value.trim();
|
| 1420 |
|
| 1421 |
const doc = {
|
|
|
|
| 1425 |
plainText,
|
| 1426 |
date,
|
| 1427 |
length,
|
| 1428 |
+
language: 'en-US',
|
| 1429 |
tags: tags ? tags.split(',').map(t => t.trim()) : []
|
| 1430 |
};
|
| 1431 |
|
|
|
|
| 1581 |
`;
|
| 1582 |
} else {
|
| 1583 |
savedDocsList.innerHTML = paginatedDocs.map((doc, idx) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1584 |
const preview = doc.plainText.substring(0, 100) + (doc.plainText.length > 100 ? '...' : '');
|
| 1585 |
const tags = doc.tags ? doc.tags.map(tag => `<span class="inline-block bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full mr-1">${tag}</span>`).join('') : '';
|
| 1586 |
|
|
|
|
| 1598 |
<div class="text-gray-500 font-medium">${doc.length} words</div>
|
| 1599 |
</td>
|
| 1600 |
<td class="px-6 py-4 whitespace-nowrap">
|
| 1601 |
+
<div class="text-gray-500 font-medium">English</div>
|
|
|
|
| 1602 |
</td>
|
| 1603 |
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 1604 |
<div class="flex justify-end space-x-3">
|
|
|
|
| 1895 |
|
| 1896 |
// Initialize default voice selection
|
| 1897 |
setTimeout(() => {
|
| 1898 |
+
const defaultVoice = document.querySelector('.voice-option[data-voice="en-US-Neural2-H"]');
|
| 1899 |
if (defaultVoice) {
|
| 1900 |
defaultVoice.click();
|
| 1901 |
}
|
|
|
|
| 1952 |
e.returnValue = 'You have unsaved changes. Are you sure you want to leave?';
|
| 1953 |
}
|
| 1954 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1955 |
});
|
| 1956 |
</script>
|
| 1957 |
</body>
|
| 1958 |
+
</html> formatting tab
|
| 1959 |
+
document.querySelectorAll('[data-align
|