Skip to content

Commit bce3b05

Browse files
authored
Merge pull request #11 from pdedgar1/claude/add-letter-replacement-tool-oURUF
Add Letter Swap Lab tool and Export TXT to all tools
2 parents 402e9a0 + 0f7d8d6 commit bce3b05

11 files changed

Lines changed: 420 additions & 0 deletions

about.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<a href="lipogram-lab.html">Lipogram Lab</a>
1717
<a href="long-tail-lab.html">Long Tail Lab</a>
1818
<a href="grid-it-lab.html">Grid-It Lab</a>
19+
<a href="letter-replacement-lab.html">Letter Swap</a>
1920
<a href="about.html">About</a>
2021
</nav>
2122

alphabetizer-lab.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<a href="lipogram-lab.html">Lipogram Lab</a>
1717
<a href="long-tail-lab.html">Long Tail Lab</a>
1818
<a href="grid-it-lab.html">Grid-It Lab</a>
19+
<a href="letter-replacement-lab.html">Letter Swap</a>
1920
<a href="about.html">About</a>
2021
</nav>
2122

@@ -82,6 +83,7 @@ <h2>Upload Text File</h2>
8283
</div>
8384
<div class="word-display" id="wordDisplay"></div>
8485
<div class="stats" id="statsDisplay"></div>
86+
<button class="apply-btn" id="exportBtn" style="margin-top: 15px;">Export TXT</button>
8587
</div>
8688
</div>
8789

@@ -227,6 +229,26 @@ <h2>Upload Text File</h2>
227229
wordDisplay.style.fontSize = e.target.value + 'px';
228230
});
229231
}
232+
233+
document.getElementById('exportBtn').addEventListener('click', function() {
234+
const items = wordDisplay.querySelectorAll('.word-item');
235+
const words = Array.from(items).map(function(item) {
236+
const freqSpan = item.querySelector('.frequency');
237+
if (freqSpan) {
238+
return item.textContent.replace(freqSpan.textContent, '').trim();
239+
}
240+
return item.textContent.trim();
241+
});
242+
const text = words.join('\n');
243+
if (!text) return;
244+
const blob = new Blob([text], { type: 'text/plain' });
245+
const url = URL.createObjectURL(blob);
246+
const a = document.createElement('a');
247+
a.href = url;
248+
a.download = 'alphabetizer-lab-output.txt';
249+
a.click();
250+
URL.revokeObjectURL(url);
251+
});
230252
</script>
231253
</body>
232254
</html>

eraser-lab.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<a href="lipogram-lab.html">Lipogram Lab</a>
1717
<a href="long-tail-lab.html">Long Tail Lab</a>
1818
<a href="grid-it-lab.html">Grid-It Lab</a>
19+
<a href="letter-replacement-lab.html">Letter Swap</a>
1920
<a href="about.html">About</a>
2021
</nav>
2122

@@ -115,6 +116,7 @@ <h3>Display Options</h3>
115116
<span>Remaining: <span id="remainingCount">0</span> elements</span>
116117
<span>Erased: <span id="erasedCount">0</span> elements</span>
117118
</div>
119+
<button class="apply-btn" id="exportBtn" style="display: none; margin-top: 15px;">Export TXT</button>
118120
</div>
119121

120122
<script>
@@ -266,6 +268,19 @@ <h3>Display Options</h3>
266268
updateStats(elements, processedElements);
267269
}
268270

271+
const exportBtn = document.getElementById('exportBtn');
272+
exportBtn.addEventListener('click', function() {
273+
const text = outputText.textContent;
274+
if (!text) return;
275+
const blob = new Blob([text], { type: 'text/plain' });
276+
const url = URL.createObjectURL(blob);
277+
const a = document.createElement('a');
278+
a.href = url;
279+
a.download = 'eraser-lab-output.txt';
280+
a.click();
281+
URL.revokeObjectURL(url);
282+
});
283+
269284
function updateStats(originalElements, processedElements) {
270285
const originalCount = originalElements.length;
271286
const erasedCount = processedElements.filter((element, index) => {
@@ -282,6 +297,7 @@ <h3>Display Options</h3>
282297
document.getElementById('erasedCount').textContent = erasedCount;
283298

284299
stats.style.display = 'flex';
300+
exportBtn.style.display = 'block';
285301
}
286302
</script>
287303
</body>

grid-it-lab.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<a href="lipogram-lab.html">Lipogram Lab</a>
7676
<a href="long-tail-lab.html">Long Tail Lab</a>
7777
<a href="grid-it-lab.html">Grid-It Lab</a>
78+
<a href="letter-replacement-lab.html">Letter Swap</a>
7879
<a href="about.html">About</a>
7980
</nav>
8081

@@ -151,6 +152,7 @@ <h3>Reading Direction</h3>
151152
</div>
152153
<div id="gridContainer"></div>
153154
<div class="stats" id="statsDisplay"></div>
155+
<button class="apply-btn" id="exportBtn" style="margin-top: 15px;">Export TXT</button>
154156
</div>
155157
</div>
156158

@@ -338,6 +340,24 @@ <h3>Reading Direction</h3>
338340
});
339341
}
340342

343+
document.getElementById('exportBtn').addEventListener('click', function() {
344+
const table = gridContainer.querySelector('table');
345+
if (!table) return;
346+
const rows = Array.from(table.querySelectorAll('tr')).map(function(tr) {
347+
return Array.from(tr.querySelectorAll('td')).map(function(td) {
348+
return td.textContent;
349+
}).join('\t');
350+
});
351+
const text = rows.join('\n');
352+
const blob = new Blob([text], { type: 'text/plain' });
353+
const url = URL.createObjectURL(blob);
354+
const a = document.createElement('a');
355+
a.href = url;
356+
a.download = 'grid-it-lab-output.txt';
357+
a.click();
358+
URL.revokeObjectURL(url);
359+
});
360+
341361
</script>
342362
</body>
343363
</html>

index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<a href="lipogram-lab.html">Lipogram Lab</a>
1717
<a href="long-tail-lab.html">Long Tail Lab</a>
1818
<a href="grid-it-lab.html">Grid-It Lab</a>
19+
<a href="letter-replacement-lab.html">Letter Swap</a>
1920
<a href="about.html">About</a>
2021
</nav>
2122

@@ -57,6 +58,10 @@ <h2>Long Tail Lab</h2>
5758
<h2>Grid-It Lab</h2>
5859
<p>Organize text into a customizable grid with adjustable rows and columns.</p>
5960
</a>
61+
<a href="letter-replacement-lab.html" class="tool-card">
62+
<h2>Letter Swap Lab</h2>
63+
<p>Replace every occurrence of one letter with another throughout your text.</p>
64+
</a>
6065
</div>
6166
<script>
6267
// JavaScript for this specific tool

0 commit comments

Comments
 (0)