-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhackathon.html
More file actions
183 lines (157 loc) Β· 6.1 KB
/
Copy pathhackathon.html
File metadata and controls
183 lines (157 loc) Β· 6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lerinilia Serendipity - Accessibility Tool</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
transition: background-color 0.3s, color 0.3s;
}
button {
padding: 15px 30px;
font-size: 18px;
margin: 10px;
border: none;
border-radius: 10px;
cursor: pointer;
background-color: #4CAF50;
color: white;
}
button:hover {
opacity: 0.8;
}
.big-button {
padding: 25px 50px;
font-size: 24px;
}
</style>
</head>
<body>
<h1>πΏ Lerinilia Serendipity</h1>
<p>Making the web accessible for everyone</p>
<hr>
<!-- Feature 1: Text to Speech -->
<h2>π Text to Speech</h2>
<p id="readText">Hello! This is your accessibility tool. Click the button below to hear me speak.</p>
<button onclick="speakText()">π Read Aloud</button>
<hr>
<!-- Feature 2: Voice to Text -->
<h2>π€ Voice to Text</h2>
<button onclick="startListening()">π€ Start Speaking</button>
<p id="voiceOutput">Your words will appear here...</p>
<hr>
<!-- Feature 3: Resize Text -->
<h2>π Resize Text</h2>
<button onclick="increaseFont()">A+ Bigger</button>
<button onclick="decreaseFont()">A- Smaller</button>
<button onclick="resetFont()">A Reset</button>
<p id="resizeText">This text will change size when you click the buttons above.</p>
<hr>
<!-- Feature 4: High Contrast -->
<h2>π High Contrast Mode</h2>
<button onclick="toggleContrast()">π Toggle Contrast</button>
<hr>
<!-- Feature 5: Big Buttons Mode -->
<h2>π±οΈ Big Button Mode</h2>
<button onclick="toggleBigButtons()">π±οΈ Toggle Big Buttons</button>
<hr>
<!-- Feature 6: Demo Alert -->
<h2>π― Demo</h2>
<button onclick="showWelcome()">π Say Hello</button>
<button onclick="clearAll()">ποΈ Clear All</button>
<script>
// ==========================================
// FEATURE 1: TEXT TO SPEECH
// ==========================================
function speakText() {
const text = document.getElementById("readText").textContent;
const speech = new SpeechSynthesisUtterance(text);
speech.lang = 'en-US';
speech.rate = 1;
speech.pitch = 1;
window.speechSynthesis.speak(speech);
}
// ==========================================
// FEATURE 2: VOICE TO TEXT
// ==========================================
function startListening() {
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
recognition.lang = 'en-US';
recognition.onresult = function(event) {
document.getElementById("voiceOutput").textContent = "π£οΈ You said: " + event.results[0][0].transcript;
};
recognition.onerror = function() {
document.getElementById("voiceOutput").textContent = "β οΈ Couldn't hear you. Try again!";
};
recognition.start();
document.getElementById("voiceOutput").textContent = "π€ Listening... Speak now!";
}
// ==========================================
// FEATURE 3: RESIZE TEXT
// ==========================================
let fontSize = 16;
function increaseFont() {
fontSize = fontSize + 2;
document.getElementById("resizeText").style.fontSize = fontSize + "px";
}
function decreaseFont() {
fontSize = fontSize - 2;
document.getElementById("resizeText").style.fontSize = fontSize + "px";
}
function resetFont() {
fontSize = 16;
document.getElementById("resizeText").style.fontSize = fontSize + "px";
}
// ==========================================
// FEATURE 4: HIGH CONTRAST
// ==========================================
let highContrast = false;
function toggleContrast() {
if (highContrast) {
document.body.style.backgroundColor = "white";
document.body.style.color = "black";
highContrast = false;
} else {
document.body.style.backgroundColor = "black";
document.body.style.color = "#00FF00"; // Bright green
highContrast = true;
}
}
// ==========================================
// FEATURE 5: BIG BUTTONS
// ==========================================
let bigButtons = false;
function toggleBigButtons() {
const buttons = document.querySelectorAll('button');
if (bigButtons) {
buttons.forEach(btn => {
btn.classList.remove('big-button');
});
bigButtons = false;
} else {
buttons.forEach(btn => {
btn.classList.add('big-button');
});
bigButtons = true;
}
}
// ==========================================
// FEATURE 6: DEMO FUNCTIONS
// ==========================================
function showWelcome() {
alert("π Welcome to Lerinilia Serendipity! We're building tools for accessibility.");
}
function clearAll() {
document.getElementById("voiceOutput").textContent = "Your words will appear here...";
document.getElementById("resizeText").textContent = "This text will change size when you click the buttons above.";
resetFont();
document.body.style.backgroundColor = "white";
document.body.style.color = "black";
highContrast = false;
}
</script>
</body>
</html>