Skip to content

Instantly share code, notes, and snippets.

@theorem93
Created January 28, 2026 08:30
Show Gist options
  • Select an option

  • Save theorem93/040d7b2552413cbfce594955d916f91b to your computer and use it in GitHub Desktop.

Select an option

Save theorem93/040d7b2552413cbfce594955d916f91b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<title>數學符號快速檢索器</title>
<style>
body { font-family: sans-serif; padding: 20px; background: #f4f7f6; }
.search-box { width: 100%; padding: 12px; font-size: 18px; margin-bottom: 20px; border: 2px solid #ddd; border-radius: 8px; }
.category { margin-bottom: 30px; }
.category-title { font-size: 20px; font-weight: bold; color: #2c3e50; border-left: 5px solid #3498db; padding-left: 10px; margin-bottom: 15px; }
.symbol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.symbol-item {
background: white; padding: 15px; text-align: center; border-radius: 8px; cursor: pointer;
box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: transform 0.1s, background 0.2s;
}
.symbol-item:hover { background: #e8f4fd; transform: scale(1.05); }
.symbol-item:active { transform: scale(0.95); }
.char { font-size: 24px; display: block; margin-bottom: 5px; }
.name { font-size: 12px; color: #7f8c8d; }
.toast {
position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
background: #333; color: white; padding: 10px 20px; border-radius: 20px;
display: none; z-index: 100;
}
</style>
</head>
<body>
<input type="text" class="search-box" id="searchInput" placeholder="搜尋符號名稱(如:平方, 大於, alpha...)">
<div id="container"></div>
<div class="toast" id="toast">已複製到剪貼簿!</div>
<script>
const symbolData = [
{ category: "基礎運算", symbols: [
{ char: "+", name: "加" }, { char: "-", name: "減" }, { char: "×", name: "乘" },
{ char: "÷", name: "除" }, { char: "±", name: "正負" }, { char: "√", name: "根號" },
{ char: "∝", name: "正比" }, { char: "∞", name: "無限大" }
]},
{ category: "關係比較", symbols: [
{ char: "=", name: "等於" }, { char: "≠", name: "不等於" }, { char: "≈", name: "約等於" },
{ char: ">", name: "大於" }, { char: "<", name: "小於" }, { char: "≥", name: "大於等於" },
{ char: "≤", name: "小於等於" }, { char: "≡", name: "恆等於" }
]},
{ category: "幾何與集合", symbols: [
{ char: "∠", name: "角" }, { char: "⊥", name: "垂直" }, { char: "∥", name: "平行" },
{ char: "△", name: "三角形" }, { char: "⊙", name: "圓" }, { char: "π", name: "圓周率" },
{ char: "∈", name: "屬於" }, { char: "∉", name: "不屬於" }, { char: "⊂", name: "子集" },
{ char: "∪", name: "聯集" }, { char: "∩", name: "交集" }
]},
{ category: "希臘字母 (常用)", symbols: [
{ char: "α", name: "alpha" }, { char: "β", name: "beta" }, { char: "γ", name: "gamma" },
{ char: "δ", name: "delta" }, { char: "θ", name: "theta" }, { char: "λ", name: "lambda" },
{ char: "μ", name: "mu" }, { char: "σ", name: "sigma" }, { char: "Ω", name: "omega" }
]}
];
function render(filter = "") {
const container = document.getElementById('container');
container.innerHTML = "";
symbolData.forEach(cat => {
const filtered = cat.symbols.filter(s => s.name.toLowerCase().includes(filter.toLowerCase()));
if (filtered.length === 0) return;
const section = document.createElement('div');
section.className = 'category';
section.innerHTML = `<div class="category-title">${cat.category}</div>`;
const grid = document.createElement('div');
grid.className = 'symbol-grid';
filtered.forEach(s => {
const item = document.createElement('div');
item.className = 'symbol-item';
item.innerHTML = `<span class="char">${s.char}</span><span class="name">${s.name}</span>`;
item.onclick = () => copyToClipboard(s.char);
grid.appendChild(item);
});
section.appendChild(grid);
container.appendChild(section);
});
}
function copyToClipboard(text) {
navigator.clipboard.writeText(text);
const toast = document.getElementById('toast');
toast.style.display = 'block';
setTimeout(() => { toast.style.display = 'none'; }, 1500);
}
document.getElementById('searchInput').oninput = (e) => render(e.target.value);
render();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment