txt / index.html
datxy's picture
Update index.html
ca9e624 verified
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>─=≡Σ((( つ•̀ω•́)つ</title>
<link rel="shortcut icon" href="https://github.githubassets.com/favicons/favicon.svg" />
<style>
body { font-family: Arial, sans-serif; width: 98%; margin: 0 auto; }
h1 { text-align: center; margin-top: 20px; }
#textarea { width: 72%; height: 430px; margin-top: 10px; font-size: 16px; padding: 10px; border: 2px solid #ddd; border-radius: 5px; }
#textarea2 { width: 35%; height: 360px; margin-top: 20px; font-size: 16px; padding: 10px; border: 2px solid #ddd; border-radius: 5px; }
#stats { display: flex; justify-content: space-between; margin-top: 20px; font-size: 10px; padding: 10px; background-color: #eee; border-radius: 5px; }
#stats div { margin-right: 20px; }
#stats div:last-child { margin-right: 0; }
#stats div span { font-weight: bold; font-size: 24px; display: block; margin-top: 5px; }
.input-group { display: flex; align-items: center; margin-bottom: 10px; }
.input-group input { margin-right: 10px; padding: 8px 16px; border: 1px solid #ddd; border-radius: 5px; }
.input-group button { font-size: 12px; padding: 8px 16px; border: none; border-radius: 5px; color: #fff; cursor: pointer; transition: background-color 0.3s; background-color: #28a745; margin-right: 10px; }
.input-group button:active { background-color: #2C6F33; }
/* 搜索功能样式 */
.search-container { margin-top: 20px; }
input[type="text"] { padding: 8px; border: 1px solid #ccc; border-radius: 4px; outline: none; font-size: 16px; width: 860px; }
button { padding: 8px 16px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; }
button:hover { background-color: #45a049; }
select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; outline: none; font-size: 16px; background-color: #fff; appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; }
select:hover { border-color: #999; }
select:focus { border-color: #555; }
/* 通用小按钮 */
.button { display: inline-block; padding: 10px 10px; font-size: 10px; border: 1px solid #ccc; border-radius: 5px; background-color: #f1f1f1; color: #333; cursor: pointer; transition: background-color 0.3s, color 0.3s; }
.button:hover { background-color: #ccc; color: #fff; }
.button:disabled { background-color: #e0e0e0; color: #999; cursor: not-allowed; }
/* === 语音朗读区样式(TTS) === */
.tts-panel { margin-top: 16px; padding: 12px; border: 1px dashed #bbb; border-radius: 8px; background: #fafafa; }
.tts-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tts-row label { font-size: 14px; }
.tts-row select { min-width: 260px; }
.tts-hint { font-size: 12px; color: #666; margin-top: 6px; }
</style>
</head>
<body>
<div style="display: flex; width: 100%; padding: 10px; box-sizing: border-box;">
<textarea id="textarea" placeholder="非数字:[^0-9]*
n位的数字:\d{n}
至少n位的数字:\d{n,}
匹配多行文本中每行的最后的两个字符:.{2}(?=\n|$)
匹配多行文本中每行的开始的两个字符:(?<=^|\n).{2}
中文字符的正则表达式:[\u4e00-\u9fa5]
英文和数字:[A-Za-z0-9]+ 或 [A-Za-z0-9]{4,40}
长度为3-20的所有字符:.{3,20}
由数字和26个英文字母组成的字符串:[A-Za-z0-9]+
由数字、26个英文字母或者下划线组成的字符串:\w+ 或 \w{3,20}
curl.exe -o NUL http://speedtest.tele2.net/10GB.zip
curl -s -o ~/x https://raw.githubusercontent.com/olegos2/mobox/main/install && . ~/x
curl -sSL https://dokploy.com/install.sh | sudo sh
sudo passwd root
conda create -n python38 python=3.8 # 创建虚拟环境
conda activate python38 # 切换虚拟环境
conda remove -n python38 --all # 删除虚拟环境
conda create -n python38 --clone old_python38 # 克隆虚拟环境
conda list # 列出已安装的包
conda env list # 列出所有虚拟环境
cd /f/d
export HF_ENDPOINT=https://hf-mirror.com
./hfd.sh datxy/file --dataset --local-dir ./dataset
Get-ChildItem -Recurse -File | Select-String -Pattern # 双引号 Windows 搜索
tracert baidu.cn
grep -rn 'py' /home/
rm -rf /*"></textarea>
<div style="flex: 3; display: flex; justify-content: center; align-items: center; width: 20%;">
<iframe id="iframe" scrolling="yes" src="time.html" style="width: 100%; height: 470px; border: none;"></iframe>
</div>
</div>
<div style="flex: 3; display: flex; justify-content: center; align-items: center; width:100%;">
<iframe id="iframe" scrolling="yes" src="rmb.html" style="width: 100%; height: 40px; border: none;"></iframe>
</div>
<div class="search-container">
<div class="input-group">
<select id="searchEngine" style="margin: 0 10px;">
<option value="https://so.csdn.net/so/search?q=">csdn.net</option>
<option value="https://s.weibo.com/weibo?q=">weibo.com</option>
<option value="https://github.com/search?q=">github.com</option>
<option value="https://www.google.com/search?q=">google.com</option>
<option value="https://www.youtube.com/results?search_query=">youtube.com</option>
<option value="https://huggingface.co/spaces?sort=likes&search=">huggingface.co</option>
<option value="https://www.baidu.com/s?q2=" selected="selected">www.baidu.com</option>
<option value="https://tieba.baidu.com/f/search/res?ie=utf-8&qw=">tieba.baidu.com</option>
<option value="https://search.bilibili.com/all?keyword=">www.bilibili.com</option>
<option value="https://www.tiktok.com/search?q=">www.tiktok.com</option>
<option value="https://www.douyin.com/search/">www.douyin.com</option>
</select>
<input style="width: 40%;" type="text" id="searchInput" placeholder="www.baidu.com" onfocus="this.placeholder = 'www.baidu.com';" onkeydown="searchRedirect(event)">
<div style="height: 10px;"></div>
<input id="search-input" style="width: 30%;" placeholder="输入要查找的文本" value='https?:\/\/[^\s\/$.?#]+[^\s]*?(?=")'>
<input id="replace-input" style="width: 30%;" placeholder="输入要替换的文本">
<!-- 隐藏的 API Key 输入框(可自行修改显示方式) -->
<div class="input-group" style="display: none;">
<input type="text" id="api_key" placeholder="sk-jLgZkKSjwN20PfeHA2eiHAG5HQ0lX8COKCM0UUW7EUSJQ8wN">
<div id="response">等待请求...</div>
</div>
</div>
</div>
<div class="input-group" style="margin: 0 5px;">
<button class="button" id="remove-duplicates-btn" style="background-color: #007bff; color: white;">去重</button>
<button class="button" id="replace-btn" style="background-color: #007bff; color: white;">替换</button>
<button class="button" id="preserve-matches-btn" style="background-color: #A52A2A; color: white;">保留</button>
<button class="button" id="regex-replace-btn" style="background-color: #A52A2A; color: white;">正则</button>
<button class="button" id="copy-btn" style="background-color: #FFA500; color: white;">复制</button>
<button class="button" id="paste-btn" style="background-color: #FF4500; color: white;">粘贴</button>
<button class="button" id="clear-btn" style="background-color: red; color: white;">清空</button>
<button onclick="formatAndPreview()" class="button" style="background-color: #511a1a; color: white;">网页</button>
<button class="button" id="openkey-btn" data-api-url="https://api.poixe.com/v1/chat/completions" style="background-color: purple;">文本测试</button>
<a href="https://poixe.com/i/realfake" target="_blank"><button class="button">密钥来自</button></a>
<a href="https://cloudstudio.net/" target="_blank"><button class="button">腾讯算力</button></a>
<a href="https://aixdownloader.com/zh" target="_blank"><button class="button">网页音视</button></a>
<a href="https://youtube.iiilab.com/" target="_blank"><button class="button">视频预览</button></a>
<a href="https://huggingface.co/datasets/datxy/file/tree/main/win" target="_blank"><button class="button" style="background-color: #007bff; color: white;">微软备份</button></a>
<a href="https://datxy.com/" target="_blank" ><button class="button" style="background-color: #007bff; color: white;">收藏链接</button></a>
<a href="m3u8.html" ><button class="button" style="background-color: #007bff; color: white;">视频提帧</button></a>
<a href="index.html"><button class="button" style="background-color: #007bff; color: white;">刷新首页</button></a>
</div>
<div id="stats">
<div id="total">总数:0</div>
<div id="chinese">汉字:0</div>
<div id="punctuation">标点:0</div>
<div id="alphabet">字母:0</div>
<div id="numbers">数字:0</div>
<div id="duplicate">重复:0</div>
<div id="replace-count">替换:0</div>
<div id="regex-replace-count">正则:0</div>
</div>
<!-- === 语音朗读(Web Speech Synthesis)=== -->
<div class="tts-panel" id="tts-panel">
<div class="tts-row" style="margin-bottom: 1px;">
<label for="tts-filterChinese">只显示中文语音?</label>
<input type="checkbox" id="tts-filterChinese" checked>
<label for="tts-voiceSelect">选择语音(音色):</label>
<select id="tts-voiceSelect"></select>
<button id="tts-start" class="button" style="background-color:#007bff;color:#fff;">开始朗读</button>
<button id="tts-stop" class="button" style="background-color:#FF4500;color:#fff;">停止朗读</button>
</div>
<div class="tts-row">
<label for="tts-rate">语速</label>
<input id="tts-rate" type="range" min="0.1" max="10" step="0.1" value="1" />
<span id="tts-rate-val">1.0x</span>
<label for="tts-pitch" style="margin-left:12px;">音调</label>
<input id="tts-pitch" type="range" min="0" max="10" step="0.1" value="1" />
<span id="tts-pitch-val">1.0</span>
<label for="tts-volume" style="margin-left:12px;">音量</label>
<input id="tts-volume" type="range" min="0" max="10" step="0.1" value="1" />
<span id="tts-volume-val">1.0</span>
</div>
<div class="tts-hint">提示:朗读内容取自上方大文本框(#textarea)。长文本将自动分句逐段播放;点击“停止朗读”可立即终止。</div>
</div>
<script>
// 根据用户选择的搜索引擎和输入的关键词跳转
function searchRedirect(event) {
if (event.key === "Enter") {
const searchEngine = document.getElementById("searchEngine").value;
const keyword = document.getElementById("searchInput").value.trim();
if (searchEngine && keyword) {
if (searchEngine === "https://so.csdn.net/so/search?q=") {
const csdnURL = `https://so.csdn.net/so/search?q=${encodeURIComponent(keyword)}&t=blog&u=feeday`;
window.open(csdnURL, '_blank');
} else {
const searchURL = `${searchEngine}${encodeURIComponent(keyword)}`;
window.open(searchURL, '_blank');
}
} else {
alert("请选择搜索引擎并输入关键词!");
}
}
}
</script>
<script>
const textarea = document.getElementById("textarea");
const searchInput = document.getElementById("search-input");
const replaceInput = document.getElementById("replace-input");
const replaceBtn = document.getElementById("replace-btn");
const regexReplaceBtn = document.getElementById("regex-replace-btn");
const clearBtn = document.getElementById("clear-btn");
const removeDuplicatesBtn = document.getElementById("remove-duplicates-btn");
const totalEl = document.getElementById("total");
const chineseEl = document.getElementById("chinese");
const punctuationEl = document.getElementById("punctuation");
const alphabetEl = document.getElementById("alphabet");
const numbersEl = document.getElementById("numbers");
const duplicateEl = document.getElementById("duplicate");
const textarea2 = document.getElementById("textarea");
const copyBtn = document.getElementById("copy-btn");
textarea.addEventListener("input", updateStats);
clearBtn.addEventListener("click", clearTextarea);
removeDuplicatesBtn.addEventListener("click", removeDuplicates);
replaceBtn.addEventListener("click", replaceText);
regexReplaceBtn.addEventListener("click", replaceTextUsingRegex);
function updateStats() {
const text = textarea.value;
const total = text.length;
const chinese = text.match(/[\u4e00-\u9fa5]/g)?.length || 0;
const punctuation = text.match(/[^\u4e00-\u9fa5\w]/g)?.length || 0;
const alphabet = text.match(/[a-zA-Z]/g)?.length || 0;
const numbers = text.match(/\d/g)?.length || 0;
totalEl.textContent = `总数:${total}`;
chineseEl.textContent = `汉字:${chinese}`;
punctuationEl.textContent = `标点:${punctuation}`;
alphabetEl.textContent = `字母:${alphabet}`;
numbersEl.textContent = `数字:${numbers}`;
}
function clearTextarea() { textarea.value = ""; updateStats(); }
// 去重处理
function removeDuplicates() {
const text = textarea.value;
const textList = text.split("\n");
const uniqueList = [...new Set(textList)];
const duplicateCount = textList.length - uniqueList.length;
duplicateEl.textContent = `重复:${duplicateCount}`;
textarea.value = uniqueList.join("\n");
updateStats();
}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById("preserve-matches-btn").addEventListener("click", function() {
const searchValue = document.getElementById("search-input").value;
const text = document.getElementById("textarea").value;
try {
const regex = new RegExp(searchValue, 'g');
let matches = text.match(regex);
if (matches && matches.length > 0) {
const newText = matches.join("\n");
document.getElementById("textarea").value = newText;
updateRegexReplaceCount(matches.length);
} else {
console.log("没有找到匹配项。");
updateRegexReplaceCount(0);
}
} catch (e) { alert("正则表达式有误: " + e.message); }
});
});
function updateRegexReplaceCount(matchCount) { document.getElementById("regex-replace-count").textContent = `正则:${matchCount}`; }
function replaceText() {
const searchValue = searchInput.value; const replaceValue = replaceInput.value; const text = textarea.value;
if (searchValue !== "") {
const matches = text.match(new RegExp(searchValue, 'g'));
const replaceCount = matches ? matches.length : 0;
const newText = text.replaceAll(searchValue, replaceValue);
document.getElementById("replace-count").textContent = `替换:${replaceCount}`;
textarea.value = newText; updateStats();
}
}
function replaceTextUsingRegex() {
const searchValue = searchInput.value; const replaceValue = replaceInput.value; const text = textarea.value;
if (searchValue !== "") {
let newText; let matchCount = (text.match(new RegExp(searchValue, 'g')) || []).length;
try { newText = text.replace(new RegExp(searchValue, 'g'), replaceValue); }
catch (e) { alert("正则表达式有误: " + e.message); return; }
document.getElementById("regex-replace-count").textContent = `正则:${matchCount}`;
textarea.value = newText; updateStats();
}
}
// API 调用示例(保持原逻辑)
document.getElementById("openkey-btn").addEventListener("click", async function() {
const apiUrl = this.getAttribute("data-api-url");
const inputField = document.getElementById("api_key");
const apiKey = inputField.value.trim() || inputField.placeholder;
let originalInput = textarea.value.trim();
if (!originalInput) { alert("请输入一些文本!"); return; }
textarea.value = "请稍后..."; document.getElementById("response").textContent = "请求中...";
const data = { model: "deepseek-chat:free", messages: [ { role: "system", content: "简要回复,字符不超500个。" }, { role: "user", content: originalInput } ], temperature: 0.7, max_tokens: 1000 };
try {
const res = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` }, body: JSON.stringify(data) });
if (!res.ok) { throw new Error(`HTTP错误! 状态码: ${res.status}`); }
const result = await res.json();
if (result.choices && result.choices[0] && result.choices[0].message) {
textarea.value = result.choices[0].message.content;
} else { textarea.value = JSON.stringify(result, null, 2); }
document.getElementById("response").textContent = JSON.stringify(result, null, 2);
updateStats();
} catch (error) {
textarea.value = "请求失败,请检查您的API密钥和其他设置。";
document.getElementById("response").textContent = `请求失败: ${error.message}\n请检查API密钥和网络连接。`;
console.error("API请求错误:", error);
}
});
document.getElementById("api_key").addEventListener("blur", function() {
const value = this.value.trim();
if (!value) { console.log("使用placeholder值作为默认值: " + this.placeholder); }
else { console.log("用户输入的值: " + value); }
});
document.getElementById("copy-btn").addEventListener("click", function() {
let textToCopy;
if (textarea.value === "") { textToCopy = textarea2.getAttribute("placeholder").split("*").join("*\n"); }
else { textToCopy = textarea2.value; }
const tempInput = document.createElement("textarea");
document.body.appendChild(tempInput); tempInput.value = textToCopy; tempInput.select(); document.execCommand("copy"); document.body.removeChild(tempInput);
});
document.getElementById("paste-btn").addEventListener("click", function() {
navigator.clipboard.readText().then(clipText => { textarea.value = clipText; updateStats(); }).catch(err => {});
});
</script>
<script>
function formatHTML(input) {
let formatted = ''; let pad = 0; const tags = ['<p>', '</p>', '<div>', '</div>', '<span>', '</span>', '<br>', '<br/>'];
input.split(/\r?\n/).forEach(line => {
let indent = 0; tags.forEach(tag => { if (line.includes(tag)) { if (tag.startsWith('</')) { pad -= 1; } } });
for (let i = 0; i < pad; i++) { indent += 4; }
formatted += ' '.repeat(indent) + line.trim() + '\n';
tags.forEach(tag => { if (line.includes(tag)) { if (!tag.startsWith('</')) { pad += 1; } } });
});
return formatted;
}
function formatAndPreview() {
const code = document.getElementById('textarea').value; const formattedCode = formatHTML(code);
document.getElementById('textarea').value = formattedCode; const newWindow = window.open("", "Preview Window", "width=600,height=600"); newWindow.document.write(code); newWindow.document.close();
}
</script>
<!-- === Web Speech Synthesis 集成脚本 === -->
<script>
(function() {
const voiceSelect = document.getElementById('tts-voiceSelect');
const filterChineseBox = document.getElementById('tts-filterChinese');
const startBtn = document.getElementById('tts-start');
const stopBtn = document.getElementById('tts-stop');
const rateInput = document.getElementById('tts-rate');
const pitchInput = document.getElementById('tts-pitch');
const volumeInput = document.getElementById('tts-volume');
const rateVal = document.getElementById('tts-rate-val');
const pitchVal = document.getElementById('tts-pitch-val');
const volumeVal = document.getElementById('tts-volume-val');
let currentQueue = []; // 保存分句后的队列
let speaking = false;
function listVoices() {
const voices = window.speechSynthesis.getVoices();
voiceSelect.innerHTML = '';
const onlyZH = filterChineseBox.checked;
let filtered = voices;
if (onlyZH) { filtered = voices.filter(v => v.lang && v.lang.toLowerCase().startsWith('zh')); }
if (filtered.length === 0) {
const opt = document.createElement('option');
opt.textContent = '无可用语音(请安装TTS并刷新)'; opt.disabled = true; voiceSelect.appendChild(opt);
return;
}
filtered.forEach(v => {
const opt = document.createElement('option');
opt.value = v.name; opt.textContent = `${v.name} (${v.lang})`; voiceSelect.appendChild(opt);
});
// 恢复上次选择
const saved = localStorage.getItem('tts_voice_name');
if (saved) {
const idx = [...voiceSelect.options].findIndex(o => o.value === saved);
if (idx >= 0) voiceSelect.selectedIndex = idx;
}
}
function getSelectedVoice() {
const voices = window.speechSynthesis.getVoices();
const name = voiceSelect.value;
const v = voices.find(v => v.name === name);
return v || null;
}
function splitTextToChunks(text) {
// 先按换行,再按标点分句,保证长文不会一次性卡住
const lines = text.split(/\n+/).map(s => s.trim()).filter(Boolean);
const chunks = [];
lines.forEach(line => {
const parts = line.split(/(?<=[。!?!?;;\.…])/);
parts.forEach(p => { const s = p.trim(); if (s) chunks.push(s); });
});
return chunks.length ? chunks : [text];
}
function speakQueue(chunks, voice) {
speaking = true; currentQueue = chunks.slice();
const next = () => {
if (!speaking || currentQueue.length === 0) { speaking = false; return; }
const text = currentQueue.shift();
const utt = new SpeechSynthesisUtterance(text);
if (voice) { utt.voice = voice; utt.lang = voice.lang; }
utt.rate = parseFloat(rateInput.value || '1');
utt.pitch = parseFloat(pitchInput.value || '1');
utt.volume = parseFloat(volumeInput.value || '1');
utt.onend = () => { next(); };
utt.onerror = (e) => { console.warn('TTS 错误:', e); next(); };
window.speechSynthesis.speak(utt);
};
next();
}
function startSpeak() {
const text = document.getElementById('textarea').value.trim();
if (!text) { alert('请输入要朗读的文本'); return; }
const v = getSelectedVoice();
if (!v) { alert('请选择一个有效语音'); return; }
// 如在朗读中,先停止再开始
if (speaking) { window.speechSynthesis.cancel(); speaking = false; }
const chunks = splitTextToChunks(text);
speakQueue(chunks, v);
localStorage.setItem('tts_voice_name', v.name);
}
function stopSpeak() { speaking = false; window.speechSynthesis.cancel(); }
// 事件绑定
startBtn.addEventListener('click', startSpeak);
stopBtn.addEventListener('click', stopSpeak);
filterChineseBox.addEventListener('change', listVoices);
voiceSelect.addEventListener('change', () => { localStorage.setItem('tts_voice_name', voiceSelect.value); });
rateInput.addEventListener('input', () => { rateVal.textContent = rateInput.value + 'x'; });
pitchInput.addEventListener('input', () => { pitchVal.textContent = pitchInput.value; });
volumeInput.addEventListener('input', () => { volumeVal.textContent = volumeInput.value; });
// 初始化语音列表(注意:部分浏览器需要 onvoiceschanged 触发)
listVoices();
if (typeof window.speechSynthesis !== 'undefined') {
if (typeof window.speechSynthesis.onvoiceschanged !== 'undefined') {
window.speechSynthesis.onvoiceschanged = listVoices;
}
}
})();
</script>
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id:"JRHGRBPWC7lJIaXq",ck:"JRHGRBPWC7lJIaXq"})</script>
</body>
</html>