1
0
Fork 0
This repository has been archived on 2025-05-26. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Checkpoint-Golang/develop/html/ai-san.html
2025-05-26 12:42:36 -05:00

224 lines
6.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Text Cleaner - caileb.com</title>
<meta name="description" content="Clean and convert formatted text to plain text">
<link rel="icon" href="/images/favi.png" type="image/png">
<link rel="apple-touch-icon" href="/images/favi.png">
<link rel="shortcut icon" href="/images/favi.png">
<link rel="preload" href="/webfonts/Poppins-Regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/webfonts/Poppins-SemiBold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="/css/u.css">
<style>
:root {
--background-color: #121212;
--card-gradient-start: #1e1e1e;
--card-gradient-end: #333;
--header-background: #262626;
--text-color: #fff;
--accent-color: #9B59B6;
--subtext-color: #ccc;
}
body {
background: #1c1c1c;
color: var(--text-color);
font-family: Poppins, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 800px;
width: 100%;
}
header {
text-align: center;
margin-bottom: 2rem;
}
header h1 {
font-size: 2.5rem;
margin-bottom: 0.5rem;
color: var(--accent-color);
}
header p {
font-size: 1.25rem;
color: var(--subtext-color);
}
.cleaner-card {
background: linear-gradient(135deg, rgba(30, 30, 30, 0.8), rgba(51, 51, 51, 0.8));
border-radius: 12px;
padding: 2rem;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
backdrop-filter: blur(10px);
}
label {
font-weight: 600;
display: block;
margin-bottom: 0.8rem;
color: var(--accent-color);
font-size: 1.1rem;
}
textarea {
width: 100%;
height: 200px;
margin-bottom: 1.5rem;
padding: 1rem;
font-size: 1rem;
font-family: Poppins, sans-serif;
border-radius: 8px;
border: 1px solid #444;
background: rgba(0, 0, 0, 0.2);
color: var(--text-color);
resize: vertical;
transition: border-color 0.2s ease;
}
textarea:focus {
outline: none;
border-color: var(--accent-color);
}
.button-row {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
}
button {
background: var(--accent-color);
color: #fff;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 8px;
font-size: 1rem;
font-family: Poppins, sans-serif;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
button:hover {
background: #8e44ad;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4);
}
footer {
text-align: center;
padding: 1rem 0;
color: var(--subtext-color);
font-size: 0.9rem;
margin-top: 2rem;
}
</style>
<script src="/js/u.js" async></script>
</head>
<body>
<div class="container">
<header>
<h1>Text Cleaner</h1>
<p>Convert formatted text to clean plain text</p>
</header>
<div class="cleaner-card">
<label for="inputText">Input Text</label>
<textarea id="inputText" placeholder="Paste text with smart quotes, dashes, or other special characters here..."></textarea>
<div class="button-row">
<button onclick="cleanText()">Clean Text</button>
<button onclick="copyToClipboard()">Copy to Clipboard</button>
</div>
<label for="outputText">Clean Text</label>
<textarea id="outputText" readonly placeholder="Cleaned text will appear here..."></textarea>
</div>
</div>
<script async>
function cleanText() {
const input = document.getElementById('inputText').value;
let cleaned = input;
// Fix all quotes
const quoteReplacements = {
'\u201C': '"', '\u201D': '"',
'\u2018': "'", '\u2019': "'",
'\u00AB': '"', '\u00BB': '"',
'\u2039': "'", '\u203A': "'"
};
cleaned = cleaned.replace(/[\u201C\u201D\u2018\u2019\u00AB\u00BB\u2039\u203A]/g, function(char) {
return quoteReplacements[char] || char;
});
// Fix all dashes
const dashReplacements = {
'\u2013': '-', '\u2014': '-',
'\u2010': '-', '\u2011': '-',
'\u2012': '-', '\u2015': '-',
'\u2212': '-'
};
cleaned = cleaned.replace(/[\u2013\u2014\u2010\u2011\u2012\u2015\u2212]/g, function(char) {
return dashReplacements[char] || char;
});
// Fix ellipses
cleaned = cleaned.replace(/\u2026/g, '...');
// Normalize line breaks (but preserve them)
cleaned = cleaned.replace(/\r\n|\r/g, '\n');
// Remove extra spaces within each line but preserve newlines
cleaned = cleaned.split('\n').map(line => line.replace(/\s+/g, ' ').trim()).join('\n');
// Remove lines that are just whitespace
cleaned = cleaned.replace(/^\s*[\r\n]/gm, '\n');
// Fix other common characters
cleaned = cleaned.replace(/[\u00B6\u00A7]/g, ''); // Remove paragraph and section marks
cleaned = cleaned.replace(/[\u00AE\u00A9\u2122]/g, ''); // Remove trademark symbols
cleaned = cleaned.replace(/[\u2022\u25E6\u2023\u2043]/g, '-'); // Replace bullets with hyphens
document.getElementById('outputText').value = cleaned;
}
function copyToClipboard() {
const outputText = document.getElementById('outputText');
if (!outputText.value) {
cleanText();
}
outputText.select();
document.execCommand('copy');
const copyButton = document.getElementsByTagName('button')[1];
copyButton.textContent = "Copied!";
setTimeout(function() {
copyButton.textContent = "Copy to Clipboard";
}, 1500);
}
</script>
</body>
</html>