update
This commit is contained in:
1 parent
2ce1c9056a
commit
9a726dbd9f
13 files changed
+8542
-5830
No files matched your search
@@ -4,93 +4,101 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
This is a Chinese-language web-based utility toolbox (功能工具箱) that provides multiple practical tools through a single interface. It's a pure frontend application built with vanilla HTML, CSS, and JavaScript that requires no backend server or external dependencies.
|
Chinese-language browser toolbox (功能工具箱) offering multiple practical utilities through one interface. Pure frontend: vanilla HTML, CSS, and JavaScript with no build step and no backend. All processing happens in the browser.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
### Core Structure
|
### Core Structure
|
||||||
|
|
||||||
- **Single-page application (SPA)** with modular tool architecture
|
- **Single-page shell** (`index.html`): collapsible sidebar, top bar, searchable tool cards, hash-based routing.
|
||||||
- **Main entry point**: `index.html` - Central hub with collapsible sidebar navigation
|
- **Tool pages**: standalone HTML files loaded in an iframe when selected, so each tool also works when opened directly.
|
||||||
- **Individual tools**: Separate HTML files loaded via iframe when selected
|
- **Shared design system**: `assets/styles.css` (tokens + components) and `assets/common.js` (theme, toast, clipboard, helpers) are used by every page.
|
||||||
- **Pure client-side**: All processing happens in the browser, ensuring data privacy
|
- **No dependencies** except jsPDF, loaded from CDN by `image_to_pdf.html`.
|
||||||
|
|
||||||
### Tool Modules
|
### Tools
|
||||||
|
|
||||||
- **Electricity Calculator** (`electricity_calculator.html`): Calculate appliance electricity costs
|
| File | Tool |
|
||||||
- **Programmer Calculator** (`number.html`): Base conversion utility (binary, octal, decimal, hex)
|
| --- | --- |
|
||||||
- **Color Picker** (`color_pick.html`): Professional color selection and format conversion
|
| `electricity_calculator.html` | 电费计算器 (single + peak/valley pricing) |
|
||||||
- **Other Functions** (`other_function.html`): Placeholder for future tools (under construction)
|
| `number.html` | 程序员计算器 (binary/octal/decimal/hex, arbitrary precision) |
|
||||||
|
| `color_pick.html` | 颜色选择器 (SV/H hue picker, HSV/RGB/HEX/HSL) |
|
||||||
|
| `json_formatter.html` | JSON 格式化 (pretty, minify, sort keys, highlight) |
|
||||||
|
| `url_encoder.html` | URL 编解码 (URI component/full/form/Base64) |
|
||||||
|
| `image_to_pdf.html` | 图片转 PDF (ordering, preview, page settings) |
|
||||||
|
| `image_compressor.html` | 图片压缩 (quality, format, resize, batch download) |
|
||||||
|
| `other_function.html` | 其他功能 (roadmap) |
|
||||||
|
|
||||||
|
### Shared assets
|
||||||
|
|
||||||
|
- `assets/styles.css`: design tokens for light/dark themes, resets, and reusable components (`.card`, `.btn`, `.field`, `.segmented`, `.editor-app`, `.image-grid`, `.dropzone`, `.toast`, etc.). Tool pages should reuse these instead of adding ad-hoc styles.
|
||||||
|
- `assets/common.js`: exposes `window.Toolbox` with `theme()`, `setTheme()`, `toggleTheme()`, `onThemeChange()`, `toast()`, `copy()`, `copyWithToast()`, `formatBytes()`, `escapeHtml()`, `debounce()`. It also wires `[data-theme-toggle]` buttons and declarative copy buttons (`data-copy-text` / `data-copy-target`).
|
||||||
|
|
||||||
|
### Theme
|
||||||
|
|
||||||
|
- Theme is stored in `localStorage` under `toolbox-theme`; without a stored value the system preference is used.
|
||||||
|
- `common.js` applies the theme before paint and listens to `storage` events, which keeps the parent page and iframe in sync live.
|
||||||
|
- Theme toggles use `<svg class="icon-moon">` + `<svg class="icon-sun">` inside a `[data-theme-toggle]` element.
|
||||||
|
|
||||||
|
### Routing
|
||||||
|
|
||||||
|
- Hashes map to tools: `#calculator`, `#number`, `#color`, `#json`, `#url`, `#image2pdf`, `#image-compressor`, `#other`.
|
||||||
|
- `index.html` uses `history.pushState` plus `popstate` / `hashchange` listeners.
|
||||||
|
- Keyboard shortcuts: `Ctrl/Cmd + K` focuses search, `Ctrl/Cmd + 1…8` opens tools, `Esc` closes mobile sidebar.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### No Build Process
|
### No build process
|
||||||
|
|
||||||
- **Static files**: Direct HTML/CSS/JS - no compilation needed
|
Open `index.html` directly or serve the folder:
|
||||||
- **No dependencies**: Pure frontend with no npm packages or build tools
|
|
||||||
- **Simple deployment**: Can be served by any web server or opened directly in browser
|
|
||||||
|
|
||||||
### Testing
|
```bash
|
||||||
|
python3 -m http.server 8000
|
||||||
|
```
|
||||||
|
|
||||||
- Open `index.html` directly in browser to test
|
### Testing checklist
|
||||||
- Test individual tools by opening their respective HTML files
|
|
||||||
- Check responsive design at different viewport sizes
|
|
||||||
- Verify keyboard shortcuts (Ctrl/Cmd + 1-5 for tool navigation)
|
|
||||||
|
|
||||||
### Adding New Tools
|
- Open `index.html`; verify sidebar collapse, mobile drawer, search, theme toggle, hash links.
|
||||||
|
- Open each tool directly; verify it works standalone and inside the iframe.
|
||||||
|
- Test light and dark themes; check contrast and iframe theme sync.
|
||||||
|
- Test mobile widths (≈375px) and desktop (≈1440px).
|
||||||
|
- Verify localStorage persists theme, sidebar state, and color history.
|
||||||
|
- Image tools: add multiple files, reorder/delete, change options, generate/compress, download.
|
||||||
|
|
||||||
1. Create new HTML file in root directory (following naming convention: `tool_name.html`)
|
### Adding a tool
|
||||||
2. Update `index.html` sidebar navigation to include new tool
|
|
||||||
3. Ensure new tool follows existing design patterns and styling
|
|
||||||
4. Test iframe loading and responsive behavior
|
|
||||||
|
|
||||||
### Code Style
|
1. Create `tool_name.html` using the shared assets:
|
||||||
|
```html
|
||||||
|
<link rel="stylesheet" href="assets/styles.css" />
|
||||||
|
<script src="assets/common.js"></script>
|
||||||
|
```
|
||||||
|
2. Use the `.tool-page` / `.tool-header` / `.card` layout and existing components; add a theme toggle in `.header-actions`.
|
||||||
|
3. Add the tool to the `TOOLS` array in `index.html` (name, description, URL, hash, icon, tint). The sidebar and home cards are generated from that array.
|
||||||
|
4. Add an icon `<symbol>` to the sprite at the top of `index.html` if needed; use `viewBox="0 0 24 24"` and stroke-style paths.
|
||||||
|
5. Test inside the iframe and standalone, in both themes and on mobile.
|
||||||
|
|
||||||
- **HTML5**: Semantic markup with Chinese UI text
|
### Code style
|
||||||
- **CSS3**: Modern features (Flexbox, Grid, animations, gradients)
|
|
||||||
- **Vanilla JavaScript**: No external libraries, cross-browser compatible
|
|
||||||
- **Responsive design**: Mobile-first approach with media queries
|
|
||||||
- **Consistent styling**: Shared CSS patterns across all tools
|
|
||||||
|
|
||||||
### Key Features to Maintain
|
- Semantic HTML5, Chinese UI text, accessible labels (`aria-label`, `role`, visible focus).
|
||||||
|
- Vanilla ES5+/ES2020 browser JavaScript; no frameworks.
|
||||||
- **Privacy-focused**: All processing happens locally, no external data transmission
|
- Prefer shared CSS variables and components over inline styling.
|
||||||
- **User experience**: Smooth animations, collapsible sidebar, tooltips
|
- Keep all processing local; do not add backend calls or telemetry.
|
||||||
- **Accessibility**: Semantic HTML and keyboard navigation support
|
|
||||||
- **Professional UI**: Gradient backgrounds, modern styling, clean layouts
|
|
||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
/
|
/
|
||||||
├── index.html # Main application hub with navigation
|
├── index.html # App shell, sidebar, routing, tool registry
|
||||||
├── electricity_calculator.html # Electricity cost calculator
|
├── electricity_calculator.html
|
||||||
├── number.html # Programmer calculator (base conversion)
|
├── number.html
|
||||||
├── color_pick.html # Color picker and format converter
|
├── color_pick.html
|
||||||
├── other_function.html # Future tools placeholder
|
├── json_formatter.html
|
||||||
└── CLAUDE.md # This file
|
├── url_encoder.html
|
||||||
|
├── image_to_pdf.html
|
||||||
|
├── image_compressor.html
|
||||||
|
├── other_function.html
|
||||||
|
├── assets/
|
||||||
|
│ ├── styles.css # Shared design tokens and components
|
||||||
|
│ ├── common.js # Theme, toast, clipboard, helpers
|
||||||
|
│ └── favicon.svg # App icon
|
||||||
|
└── CLAUDE.md
|
||||||
```
|
```
|
||||||
|
|
||||||
## Common Tasks
|
|
||||||
|
|
||||||
### Running the Application
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Serve with any web server (optional)
|
|
||||||
python3 -m http.server 8000
|
|
||||||
# or open directly in browser
|
|
||||||
open index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
### Adding New Tools
|
|
||||||
|
|
||||||
- Follow existing HTML structure and CSS patterns
|
|
||||||
- Include Chinese interface text consistent with current tools
|
|
||||||
- Ensure responsive design for mobile devices
|
|
||||||
- Test iframe integration with main navigation
|
|
||||||
|
|
||||||
### Modifying Styles
|
|
||||||
|
|
||||||
- Main styles are embedded in individual HTML files
|
|
||||||
- Consistent color scheme and design patterns across tools
|
|
||||||
- Use CSS variables for easy theme maintenance if needed
|
|
||||||
@@ -0,0 +1,265 @@
|
|||||||
|
/* ============================================================
|
||||||
|
功能工具箱 · 共享脚本
|
||||||
|
主题同步 / Toast / 剪贴板 / 格式化工具
|
||||||
|
============================================================ */
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var THEME_KEY = "toolbox-theme";
|
||||||
|
var root = document.documentElement;
|
||||||
|
|
||||||
|
function readStoredTheme() {
|
||||||
|
try {
|
||||||
|
var value = localStorage.getItem(THEME_KEY);
|
||||||
|
return value === "light" || value === "dark" ? value : null;
|
||||||
|
} catch (error) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function systemTheme() {
|
||||||
|
return window.matchMedia &&
|
||||||
|
window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
|
? "dark"
|
||||||
|
: "light";
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyTheme(theme, persist) {
|
||||||
|
if (theme !== "light" && theme !== "dark") return;
|
||||||
|
root.dataset.theme = theme;
|
||||||
|
root.style.colorScheme = theme;
|
||||||
|
if (persist) {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(THEME_KEY, theme);
|
||||||
|
} catch (error) {
|
||||||
|
/* 忽略隐私模式下的写入失败 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("toolbox:themechange", { detail: { theme: theme } }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function currentTheme() {
|
||||||
|
return root.dataset.theme === "dark" ? "dark" : "light";
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleTheme() {
|
||||||
|
var next = currentTheme() === "dark" ? "light" : "dark";
|
||||||
|
applyTheme(next, true);
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 首次渲染前应用主题,避免闪烁
|
||||||
|
applyTheme(readStoredTheme() || systemTheme(), false);
|
||||||
|
|
||||||
|
// 跟随系统主题(用户未手动选择时)
|
||||||
|
if (window.matchMedia) {
|
||||||
|
var media = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
|
var onSystemChange = function (event) {
|
||||||
|
if (!readStoredTheme()) {
|
||||||
|
applyTheme(event.matches ? "dark" : "light", false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (media.addEventListener) {
|
||||||
|
media.addEventListener("change", onSystemChange);
|
||||||
|
} else if (media.addListener) {
|
||||||
|
media.addListener(onSystemChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同一个页面内(父页面 / iframe)的主题同步
|
||||||
|
window.addEventListener("storage", function (event) {
|
||||||
|
if (event.key === THEME_KEY && event.newValue) {
|
||||||
|
applyTheme(event.newValue, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ---------- Toast ---------- */
|
||||||
|
|
||||||
|
function toastContainer() {
|
||||||
|
var el = document.querySelector(".toast-wrap");
|
||||||
|
if (!el) {
|
||||||
|
el = document.createElement("div");
|
||||||
|
el.className = "toast-wrap";
|
||||||
|
document.body.appendChild(el);
|
||||||
|
}
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toast(message, type) {
|
||||||
|
if (!document.body) return;
|
||||||
|
type = type || "info";
|
||||||
|
var el = document.createElement("div");
|
||||||
|
el.className = "toast toast--" + type;
|
||||||
|
el.setAttribute("role", "status");
|
||||||
|
el.setAttribute("aria-live", "polite");
|
||||||
|
|
||||||
|
var icon = document.createElement("span");
|
||||||
|
icon.className = "toast-icon";
|
||||||
|
icon.textContent = type === "success" ? "✓" : type === "error" ? "!" : "i";
|
||||||
|
|
||||||
|
var text = document.createElement("span");
|
||||||
|
text.textContent = message;
|
||||||
|
|
||||||
|
el.appendChild(icon);
|
||||||
|
el.appendChild(text);
|
||||||
|
toastContainer().appendChild(el);
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
|
el.classList.add("show");
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
el.classList.remove("show");
|
||||||
|
setTimeout(function () {
|
||||||
|
el.remove();
|
||||||
|
}, 220);
|
||||||
|
}, 2400);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 剪贴板 ---------- */
|
||||||
|
|
||||||
|
function legacyCopy(text) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
try {
|
||||||
|
var area = document.createElement("textarea");
|
||||||
|
area.value = text;
|
||||||
|
area.style.position = "fixed";
|
||||||
|
area.style.top = "-9999px";
|
||||||
|
area.style.opacity = "0";
|
||||||
|
document.body.appendChild(area);
|
||||||
|
area.focus();
|
||||||
|
area.select();
|
||||||
|
var ok = document.execCommand("copy");
|
||||||
|
document.body.removeChild(area);
|
||||||
|
ok ? resolve() : reject(new Error("copy failed"));
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyText(text) {
|
||||||
|
text = String(text == null ? "" : text);
|
||||||
|
if (navigator.clipboard && window.isSecureContext) {
|
||||||
|
return navigator.clipboard.writeText(text).catch(function () {
|
||||||
|
// iframe 或权限受限时回退到 execCommand
|
||||||
|
return legacyCopy(text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return legacyCopy(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyWithToast(text, message) {
|
||||||
|
return copyText(text)
|
||||||
|
.then(function () {
|
||||||
|
toast(message || "已复制到剪贴板", "success");
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
toast("复制失败,请手动选择复制", "error");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 格式化工具 ---------- */
|
||||||
|
|
||||||
|
function formatBytes(bytes, decimals) {
|
||||||
|
bytes = Number(bytes) || 0;
|
||||||
|
if (bytes <= 0) return "0 B";
|
||||||
|
var k = 1024;
|
||||||
|
var sizes = ["B", "KB", "MB", "GB", "TB"];
|
||||||
|
var i = Math.min(
|
||||||
|
Math.floor(Math.log(bytes) / Math.log(k)),
|
||||||
|
sizes.length - 1,
|
||||||
|
);
|
||||||
|
var value = bytes / Math.pow(k, i);
|
||||||
|
return (
|
||||||
|
parseFloat(value.toFixed(decimals == null ? 1 : decimals)) +
|
||||||
|
" " +
|
||||||
|
sizes[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeHtml(value) {
|
||||||
|
return String(value).replace(/[&<>"']/g, function (char) {
|
||||||
|
return {
|
||||||
|
"&": "&",
|
||||||
|
"<": "<",
|
||||||
|
">": ">",
|
||||||
|
'"': """,
|
||||||
|
"'": "'",
|
||||||
|
}[char];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function debounce(fn, wait) {
|
||||||
|
var timer = null;
|
||||||
|
return function () {
|
||||||
|
var args = arguments;
|
||||||
|
var context = this;
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = setTimeout(function () {
|
||||||
|
fn.apply(context, args);
|
||||||
|
}, wait);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 初始化 ---------- */
|
||||||
|
|
||||||
|
function initThemeButtons() {
|
||||||
|
var buttons = document.querySelectorAll("[data-theme-toggle]");
|
||||||
|
Array.prototype.forEach.call(buttons, function (button) {
|
||||||
|
if (button.dataset.themeBound === "1") return;
|
||||||
|
button.dataset.themeBound = "1";
|
||||||
|
button.addEventListener("click", function () {
|
||||||
|
toggleTheme();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 声明式复制按钮:
|
||||||
|
// data-copy-text="要复制的文本"
|
||||||
|
// data-copy-target="#elementId" (复制该元素 textContent)
|
||||||
|
function initCopyButtons() {
|
||||||
|
if (document.body.dataset.copyBound === "1") return;
|
||||||
|
document.body.dataset.copyBound = "1";
|
||||||
|
document.addEventListener("click", function (event) {
|
||||||
|
var button = event.target.closest("[data-copy-text],[data-copy-target]");
|
||||||
|
if (!button) return;
|
||||||
|
var text = button.dataset.copyText;
|
||||||
|
if (text == null && button.dataset.copyTarget) {
|
||||||
|
var target = document.querySelector(button.dataset.copyTarget);
|
||||||
|
text = target ? target.textContent : "";
|
||||||
|
}
|
||||||
|
if (!text) return;
|
||||||
|
event.preventDefault();
|
||||||
|
copyWithToast(text, button.dataset.copyMessage);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
initThemeButtons();
|
||||||
|
initCopyButtons();
|
||||||
|
});
|
||||||
|
|
||||||
|
window.Toolbox = {
|
||||||
|
theme: currentTheme,
|
||||||
|
setTheme: function (theme) {
|
||||||
|
applyTheme(theme, true);
|
||||||
|
},
|
||||||
|
toggleTheme: toggleTheme,
|
||||||
|
onThemeChange: function (callback) {
|
||||||
|
window.addEventListener("toolbox:themechange", function (event) {
|
||||||
|
callback(event.detail.theme);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toast: toast,
|
||||||
|
copy: copyText,
|
||||||
|
copyWithToast: copyWithToast,
|
||||||
|
formatBytes: formatBytes,
|
||||||
|
escapeHtml: escapeHtml,
|
||||||
|
debounce: debounce,
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
|
||||||
|
<stop offset="0" stop-color="#6366f1" />
|
||||||
|
<stop offset="1" stop-color="#a855f7" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<rect width="24" height="24" rx="6" fill="url(#g)" />
|
||||||
|
<path
|
||||||
|
d="M12 4.5 14 10l5.5 2L14 14l-2 5.5L10 14l-5.5-2L10 10Z"
|
||||||
|
fill="#ffffff"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 408 B |
+1945
File diff suppressed because it is too large.
Load diff
+732
-768
File diff suppressed because it is too large.
Load diff
+596
-412
File diff suppressed because it is too large.
Load diff
+1115
-1043
File diff suppressed because it is too large.
Load diff
+791
-1246
File diff suppressed because it is too large.
Load diff
+1555
-645
File diff suppressed because it is too large.
Load diff
+387
-544
File diff suppressed because it is too large.
Load diff
+411
-180
@@ -3,231 +3,462 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>程序员进制计算器</title>
|
<title>程序员计算器 · 功能工具箱</title>
|
||||||
|
<link rel="icon" href="assets/favicon.svg" type="image/svg+xml" />
|
||||||
|
<link rel="stylesheet" href="assets/styles.css" />
|
||||||
|
<script src="assets/common.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body {
|
.input-toolbar {
|
||||||
font-family: sans-serif;
|
|
||||||
margin: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-section {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-toolbar .field {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-toolbar input {
|
||||||
|
height: 44px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 1rem;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-toolbar .btn {
|
||||||
|
height: 44px;
|
||||||
|
padding-inline: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"] {
|
.base-row .field-label {
|
||||||
width: 100%;
|
font-size: 0.8rem;
|
||||||
padding: 8px;
|
font-weight: 600;
|
||||||
margin-bottom: 10px;
|
color: var(--text-secondary);
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-sizing: border-box; /* 确保 padding 不会增加元素宽度 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.radio-group {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.radio-group label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
background-color: #4caf50;
|
|
||||||
color: white;
|
|
||||||
padding: 10px 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: #3e8e41;
|
|
||||||
}
|
|
||||||
|
|
||||||
#results {
|
|
||||||
margin-top: 20px;
|
|
||||||
border-top: 1px solid #ccc;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-list {
|
.history-list {
|
||||||
list-style-type: none;
|
display: flex;
|
||||||
padding: 0;
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-list li {
|
.history-chip {
|
||||||
padding: 10px;
|
display: inline-flex;
|
||||||
border: 1px solid #ccc;
|
align-items: center;
|
||||||
border-radius: 4px;
|
gap: 8px;
|
||||||
margin-bottom: 5px;
|
max-width: 100%;
|
||||||
|
padding: 6px 11px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--surface-2);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 0.76rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 14px;
|
transition: all var(--rate) ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-section h2 {
|
.history-chip:hover {
|
||||||
font-size: 18px;
|
border-color: var(--accent);
|
||||||
color: #333;
|
color: var(--accent);
|
||||||
margin-bottom: 15px;
|
background: var(--accent-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-list li:hover {
|
.history-chip .chip-base {
|
||||||
background-color: #f0f0f0;
|
font-size: 0.62rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-chip code {
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-row code {
|
||||||
|
font-size: 0.92rem;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-row .row-label {
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 560px) {
|
||||||
|
.input-toolbar {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-toolbar .btn {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="tool-page tool-page--narrow">
|
||||||
<h1>程序员进制计算器</h1>
|
<header class="tool-header">
|
||||||
|
<div class="tool-icon">
|
||||||
<label for="number-input">请输入数字:</label>
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<input type="text" id="number-input" placeholder="例如: 100" required />
|
<path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18" />
|
||||||
|
</svg>
|
||||||
<button onclick="convertNumber()">转换</button>
|
|
||||||
<div class="radio-group">
|
|
||||||
<label
|
|
||||||
><input type="radio" name="base" value="10" checked /> 十进制</label
|
|
||||||
>
|
|
||||||
<label><input type="radio" name="base" value="2" /> 二进制</label>
|
|
||||||
<label><input type="radio" name="base" value="8" /> 八进制</label>
|
|
||||||
<label><input type="radio" name="base" value="16" /> 十六进制</label>
|
|
||||||
</div>
|
|
||||||
<div id="results">
|
|
||||||
<h2>转换结果</h2>
|
|
||||||
<div id="result-section">
|
|
||||||
<!-- 计算结果将显示在这里 -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div class="history-section">
|
<h1>程序员计算器</h1>
|
||||||
<h2>历史记录</h2>
|
<p>二进制、八进制、十进制、十六进制即时互转,支持任意精度整数。</p>
|
||||||
<ul class="history-list" id="history-list">
|
</div>
|
||||||
<!-- 历史记录将显示在这里 -->
|
<div class="header-actions">
|
||||||
</ul>
|
<button
|
||||||
</div>
|
class="btn btn--icon btn--ghost"
|
||||||
|
data-theme-toggle
|
||||||
|
title="切换主题"
|
||||||
|
aria-label="切换主题"
|
||||||
|
>
|
||||||
|
<svg class="icon-moon" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path d="M21 12.8A8.5 8.5 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z" />
|
||||||
|
</svg>
|
||||||
|
<svg class="icon-sun" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="4" />
|
||||||
|
<path
|
||||||
|
d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
<script>
|
<section class="card">
|
||||||
const historyList = [];
|
<div class="base-row">
|
||||||
|
<span class="field-label">输入进制</span>
|
||||||
|
<div class="segmented" role="radiogroup" aria-label="输入进制">
|
||||||
|
<label class="seg">
|
||||||
|
<input type="radio" name="base" value="10" checked />
|
||||||
|
<span>十进制</span>
|
||||||
|
</label>
|
||||||
|
<label class="seg">
|
||||||
|
<input type="radio" name="base" value="2" />
|
||||||
|
<span>二进制</span>
|
||||||
|
</label>
|
||||||
|
<label class="seg">
|
||||||
|
<input type="radio" name="base" value="8" />
|
||||||
|
<span>八进制</span>
|
||||||
|
</label>
|
||||||
|
<label class="seg">
|
||||||
|
<input type="radio" name="base" value="16" />
|
||||||
|
<span>十六进制</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
function convertNumber() {
|
<div class="input-toolbar">
|
||||||
const numberInput = document.getElementById("number-input").value;
|
<div class="field">
|
||||||
const base = document.querySelector(
|
<label for="numberInput">输入数字</label>
|
||||||
'input[name="base"]:checked',
|
<input
|
||||||
).value;
|
type="text"
|
||||||
|
id="numberInput"
|
||||||
|
value="100"
|
||||||
|
placeholder="例如:100,或 0x1f"
|
||||||
|
autocomplete="off"
|
||||||
|
spellcheck="false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn--primary" id="convertBtn">转换</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
let decimal;
|
<div class="alert alert--error hidden" id="errorBox" style="margin-top: 12px">
|
||||||
if (base === "10") {
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
decimal = parseInt(numberInput, 10);
|
<circle cx="12" cy="12" r="9" />
|
||||||
} else if (base === "2") {
|
<path d="M12 8v5M12 16.5v.01" />
|
||||||
decimal = parseInt(numberInput, 2);
|
</svg>
|
||||||
} else if (base === "8") {
|
<span id="errorText"></span>
|
||||||
decimal = parseInt(numberInput, 8);
|
</div>
|
||||||
} else if (base === "16") {
|
</section>
|
||||||
decimal = parseInt(numberInput, 16);
|
|
||||||
|
<section class="card" aria-live="polite">
|
||||||
|
<div class="card-head">
|
||||||
|
<h2>转换结果</h2>
|
||||||
|
<span class="spacer"></span>
|
||||||
|
<span class="badge badge--accent">任意精度</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="result-list">
|
||||||
|
<div class="result-row">
|
||||||
|
<span class="row-label">DEC</span>
|
||||||
|
<code id="resultDecimal">100</code>
|
||||||
|
<button
|
||||||
|
class="copy-btn"
|
||||||
|
data-copy-target="#resultDecimal"
|
||||||
|
data-copy-message="十进制已复制"
|
||||||
|
aria-label="复制十进制"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="result-row">
|
||||||
|
<span class="row-label">BIN</span>
|
||||||
|
<code id="resultBinary">0110 0100</code>
|
||||||
|
<button
|
||||||
|
class="copy-btn"
|
||||||
|
data-copy-target="#resultBinary"
|
||||||
|
data-copy-message="二进制已复制"
|
||||||
|
aria-label="复制二进制"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="result-row">
|
||||||
|
<span class="row-label">OCT</span>
|
||||||
|
<code id="resultOctal">144</code>
|
||||||
|
<button
|
||||||
|
class="copy-btn"
|
||||||
|
data-copy-target="#resultOctal"
|
||||||
|
data-copy-message="八进制已复制"
|
||||||
|
aria-label="复制八进制"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="result-row">
|
||||||
|
<span class="row-label">HEX</span>
|
||||||
|
<code id="resultHex">64</code>
|
||||||
|
<button
|
||||||
|
class="copy-btn"
|
||||||
|
data-copy-target="#resultHex"
|
||||||
|
data-copy-message="十六进制已复制"
|
||||||
|
aria-label="复制十六进制"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="hint" style="margin-top: 12px">
|
||||||
|
二进制结果每 4 位以空格分组,方便阅读;点击“复制”即可粘贴到代码中。
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="card">
|
||||||
|
<div class="card-head">
|
||||||
|
<h2>历史记录</h2>
|
||||||
|
<span class="spacer"></span>
|
||||||
|
<button class="btn btn--ghost btn--sm" id="clearHistoryBtn">清空</button>
|
||||||
|
</div>
|
||||||
|
<div class="history-list" id="historyList"></div>
|
||||||
|
<div class="empty-state" id="historyEmpty" style="padding: 18px 10px">
|
||||||
|
<span>按 Enter 或点击“转换”后会记录到这里</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var BASE_NAMES = { 2: "BIN", 8: "OCT", 10: "DEC", 16: "HEX" };
|
||||||
|
var history = [];
|
||||||
|
var MAX_HISTORY = 20;
|
||||||
|
|
||||||
|
var input = document.getElementById("numberInput");
|
||||||
|
var errorBox = document.getElementById("errorBox");
|
||||||
|
var errorText = document.getElementById("errorText");
|
||||||
|
var historyList = document.getElementById("historyList");
|
||||||
|
var historyEmpty = document.getElementById("historyEmpty");
|
||||||
|
|
||||||
|
function currentBase() {
|
||||||
|
return parseInt(
|
||||||
|
document.querySelector('input[name="base"]:checked').value,
|
||||||
|
10,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanInput(raw, base) {
|
||||||
|
var value = String(raw).trim().replace(/[\s_]/g, "");
|
||||||
|
if (base === 16) value = value.replace(/^0x/i, "");
|
||||||
|
if (base === 2) value = value.replace(/^0b/i, "");
|
||||||
|
if (base === 8) value = value.replace(/^0o/i, "");
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validPattern(base) {
|
||||||
|
return {
|
||||||
|
2: /^-?[01]+$/,
|
||||||
|
8: /^-?[0-7]+$/,
|
||||||
|
10: /^-?[0-9]+$/,
|
||||||
|
16: /^-?[0-9a-f]+$/i,
|
||||||
|
}[base];
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseValue(raw, base) {
|
||||||
|
var text = cleanInput(raw, base);
|
||||||
|
if (!text || !validPattern(base).test(text)) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNaN(decimal)) {
|
var negative = text.charAt(0) === "-";
|
||||||
alert("请输入有效的数字!");
|
var digits = negative ? text.slice(1) : text;
|
||||||
return;
|
var bigBase = BigInt(base);
|
||||||
|
var value = 0n;
|
||||||
|
|
||||||
|
for (var i = 0; i < digits.length; i += 1) {
|
||||||
|
var digit = parseInt(digits.charAt(i), base);
|
||||||
|
if (isNaN(digit)) return null;
|
||||||
|
value = value * bigBase + BigInt(digit);
|
||||||
}
|
}
|
||||||
|
|
||||||
const binary = formatBinary(decimal.toString(2)); // 格式化二进制
|
return negative ? -value : value;
|
||||||
const hexadecimal = decimal.toString(16).toUpperCase();
|
}
|
||||||
const octal = decimal.toString(8);
|
|
||||||
|
|
||||||
const resultSection = document.getElementById("result-section");
|
function groupBinary(binary) {
|
||||||
|
var negative = binary.charAt(0) === "-";
|
||||||
|
var digits = negative ? binary.slice(1) : binary;
|
||||||
|
var grouped = digits.replace(/\B(?=(.{4})+$)/g, " ");
|
||||||
|
return (negative ? "-" : "") + grouped;
|
||||||
|
}
|
||||||
|
|
||||||
resultSection.innerHTML = `
|
function setError(message) {
|
||||||
<p>十进制: <span id="decimal"></span></p>
|
errorText.textContent = message;
|
||||||
<p>二进制: <span id="binary"></span></p>
|
errorBox.classList.remove("hidden");
|
||||||
<p>十六进制: <span id="hexadecimal"></span></p>
|
}
|
||||||
<p>八进制: <span id="octal"></span></p>
|
|
||||||
`;
|
|
||||||
|
|
||||||
document.getElementById("decimal").textContent = decimal;
|
function clearError() {
|
||||||
document.getElementById("binary").textContent = binary;
|
errorBox.classList.add("hidden");
|
||||||
document.getElementById("hexadecimal").textContent = hexadecimal;
|
}
|
||||||
document.getElementById("octal").textContent = octal;
|
|
||||||
|
|
||||||
const historyItem = {
|
function setResults(values) {
|
||||||
input: numberInput,
|
document.getElementById("resultDecimal").textContent =
|
||||||
|
values ? values.decimal : "—";
|
||||||
|
document.getElementById("resultBinary").textContent =
|
||||||
|
values ? values.binary : "—";
|
||||||
|
document.getElementById("resultOctal").textContent =
|
||||||
|
values ? values.octal : "—";
|
||||||
|
document.getElementById("resultHex").textContent =
|
||||||
|
values ? values.hex : "—";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回解析结果,失败时返回 null
|
||||||
|
function convert() {
|
||||||
|
var base = currentBase();
|
||||||
|
var raw = input.value;
|
||||||
|
var value = parseValue(raw, base);
|
||||||
|
|
||||||
|
if (value === null) {
|
||||||
|
setError(
|
||||||
|
"请输入有效的" +
|
||||||
|
({ 2: "二进制", 8: "八进制", 10: "十进制", 16: "十六进制" }[
|
||||||
|
base
|
||||||
|
] || "") +
|
||||||
|
"数字。",
|
||||||
|
);
|
||||||
|
setResults(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearError();
|
||||||
|
var result = {
|
||||||
|
input: cleanInput(raw, base),
|
||||||
base: base,
|
base: base,
|
||||||
decimal: decimal,
|
decimal: value.toString(10),
|
||||||
binary: binary,
|
binary: groupBinary(value.toString(2)),
|
||||||
hexadecimal: hexadecimal,
|
octal: value.toString(8),
|
||||||
octal: octal,
|
hex: value.toString(16).toUpperCase(),
|
||||||
};
|
};
|
||||||
|
|
||||||
historyList.unshift(historyItem); // 将最新记录添加到最前面
|
setResults(result);
|
||||||
updateHistoryList();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatBinary(binary) {
|
function renderHistory() {
|
||||||
// 从右往左每隔4位加一个空格
|
historyList.innerHTML = "";
|
||||||
return binary
|
historyEmpty.style.display = history.length ? "none" : "block";
|
||||||
.split("") // 将字符串转为数组
|
|
||||||
.reverse() // 反转数组,从右往左处理
|
|
||||||
|
|
||||||
.join("") // 重新拼接为字符串
|
history.forEach(function (item) {
|
||||||
.replace(/(\d{4})/g, "\$1 ") // 每隔4位加一个空格
|
var chip = document.createElement("button");
|
||||||
.split("") // 再次转为数组
|
chip.className = "history-chip";
|
||||||
.reverse() // 反转回原始顺序
|
chip.type = "button";
|
||||||
|
chip.title = "点击重新转换";
|
||||||
|
chip.innerHTML =
|
||||||
|
'<span class="chip-base">' +
|
||||||
|
BASE_NAMES[item.base] +
|
||||||
|
"</span><code></code>";
|
||||||
|
|
||||||
.join("") // 重新拼接为字符串
|
chip.querySelector("code").textContent = item.input;
|
||||||
.trim(); // 去除首尾多余的空格
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateHistoryList() {
|
chip.addEventListener("click", function () {
|
||||||
const historyListElement = document.getElementById("history-list");
|
input.value = item.input;
|
||||||
historyListElement.innerHTML = "";
|
document.querySelector(
|
||||||
|
'input[name="base"][value="' + item.base + '"]',
|
||||||
|
).checked = true;
|
||||||
|
convert();
|
||||||
|
input.focus();
|
||||||
|
});
|
||||||
|
|
||||||
historyList.forEach((item, index) => {
|
historyList.appendChild(chip);
|
||||||
const listItem = document.createElement("li");
|
|
||||||
let displayText = "";
|
|
||||||
if (item.base === "10") {
|
|
||||||
displayText = `十进制: ${item.input}`;
|
|
||||||
} else if (item.base === "2") {
|
|
||||||
displayText = `二进制: ${item.input}`;
|
|
||||||
} else if (item.base === "8") {
|
|
||||||
displayText = `八进制: ${item.input}`;
|
|
||||||
} else if (item.base === "16") {
|
|
||||||
displayText = `十六进制: ${item.input}`;
|
|
||||||
}
|
|
||||||
listItem.textContent = displayText;
|
|
||||||
listItem.addEventListener("click", () => showHistoryResult(index));
|
|
||||||
historyListElement.appendChild(listItem);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showHistoryResult(index) {
|
function commit() {
|
||||||
const item = historyList[index];
|
var result = convert();
|
||||||
const resultSection = document.getElementById("result-section");
|
if (!result) return;
|
||||||
resultSection.innerHTML = `
|
|
||||||
<p>十进制: <span id="decimal"></span></p>
|
|
||||||
<p>二进制: <span id="binary"></span></p>
|
|
||||||
<p>十六进制: <span id="hexadecimal"></span></p>
|
|
||||||
<p>八进制: <span id="octal"></span></p>
|
|
||||||
`;
|
|
||||||
|
|
||||||
document.getElementById("decimal").textContent = item.decimal;
|
// 相同记录不重复
|
||||||
document.getElementById("binary").textContent = item.binary;
|
var duplicate = history.some(function (item) {
|
||||||
document.getElementById("hexadecimal").textContent = item.hexadecimal;
|
return (
|
||||||
document.getElementById("octal").textContent = item.octal;
|
item.input === result.input && item.base === result.base
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!duplicate) {
|
||||||
|
history.unshift(result);
|
||||||
|
history = history.slice(0, MAX_HISTORY);
|
||||||
|
renderHistory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
</div>
|
var liveConvert = Toolbox.debounce(convert, 160);
|
||||||
|
|
||||||
|
input.addEventListener("input", function () {
|
||||||
|
liveConvert();
|
||||||
|
});
|
||||||
|
|
||||||
|
input.addEventListener("keydown", function (event) {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
event.preventDefault();
|
||||||
|
commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document
|
||||||
|
.querySelectorAll('input[name="base"]')
|
||||||
|
.forEach(function (radio) {
|
||||||
|
radio.addEventListener("change", convert);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById("convertBtn").addEventListener("click", commit);
|
||||||
|
|
||||||
|
document
|
||||||
|
.getElementById("clearHistoryBtn")
|
||||||
|
.addEventListener("click", function () {
|
||||||
|
if (!history.length) return;
|
||||||
|
history = [];
|
||||||
|
renderHistory();
|
||||||
|
Toolbox.toast("历史记录已清空", "success");
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
convert();
|
||||||
|
renderHistory();
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+320
-310
@@ -3,356 +3,366 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>其他功能 - 功能工具箱</title>
|
<title>其他功能 · 功能工具箱</title>
|
||||||
|
<link rel="icon" href="assets/favicon.svg" type="image/svg+xml" />
|
||||||
|
<link rel="stylesheet" href="assets/styles.css" />
|
||||||
|
<script src="assets/common.js"></script>
|
||||||
<style>
|
<style>
|
||||||
* {
|
.hero-card {
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family:
|
|
||||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
||||||
"Helvetica Neue", Arial, sans-serif;
|
|
||||||
background: radial-gradient(
|
|
||||||
circle at center,
|
|
||||||
#ff9a9e 0%,
|
|
||||||
#fad0c4 25%,
|
|
||||||
#fad0c4 50%,
|
|
||||||
#ff9a9e 75%,
|
|
||||||
#fad0c4 100%
|
|
||||||
);
|
|
||||||
background-size: 400% 400%;
|
|
||||||
animation: pinkGlow 10s ease-in-out infinite;
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes pinkGlow {
|
|
||||||
0%,
|
|
||||||
100% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
background: white;
|
|
||||||
border-radius: 20px;
|
|
||||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
||||||
padding: 60px 40px;
|
|
||||||
text-align: center;
|
|
||||||
max-width: 600px;
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
padding: clamp(26px, 4vw, 44px);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-lg);
|
||||||
|
background:
|
||||||
|
radial-gradient(
|
||||||
|
560px 260px at 0% 0%,
|
||||||
|
rgba(99, 102, 241, 0.15),
|
||||||
|
transparent 65%
|
||||||
|
),
|
||||||
|
radial-gradient(
|
||||||
|
480px 240px at 100% 100%,
|
||||||
|
rgba(168, 85, 247, 0.12),
|
||||||
|
transparent 65%
|
||||||
|
),
|
||||||
|
var(--surface);
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
.container::before {
|
.hero-card .hero-badge {
|
||||||
content: "";
|
display: inline-flex;
|
||||||
position: absolute;
|
align-items: center;
|
||||||
top: -50%;
|
gap: 6px;
|
||||||
left: -50%;
|
padding: 4px 10px;
|
||||||
width: 200%;
|
border-radius: 999px;
|
||||||
height: 200%;
|
background: var(--warning-soft);
|
||||||
background: linear-gradient(45deg, #ff9a9e, #fad0c4, #fecfef, #fecfef);
|
color: var(--warning);
|
||||||
opacity: 0.15;
|
font-size: 0.72rem;
|
||||||
animation: rotate 10s linear infinite;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rotate {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.construction-icon {
|
|
||||||
font-size: 80px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
animation: bounce 2s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes bounce {
|
|
||||||
0%,
|
|
||||||
20%,
|
|
||||||
50%,
|
|
||||||
80%,
|
|
||||||
100% {
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
40% {
|
|
||||||
transform: translateY(-30px);
|
|
||||||
}
|
|
||||||
60% {
|
|
||||||
transform: translateY(-15px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: #2c3e50;
|
|
||||||
font-size: 32px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-badge {
|
.hero-card h2 {
|
||||||
display: inline-block;
|
margin: 14px 0 8px;
|
||||||
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
|
font-size: clamp(1.4rem, 3vw, 1.9rem);
|
||||||
color: white;
|
letter-spacing: -0.03em;
|
||||||
padding: 8px 20px;
|
|
||||||
border-radius: 25px;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 25px;
|
|
||||||
animation: pulse 2s infinite;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse {
|
.hero-card p {
|
||||||
0% {
|
max-width: 40em;
|
||||||
box-shadow: 0 0 0 0 rgba(238, 90, 36, 0.7);
|
color: var(--text-secondary);
|
||||||
}
|
font-size: 0.92rem;
|
||||||
70% {
|
|
||||||
box-shadow: 0 0 0 15px rgba(238, 90, 36, 0);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
box-shadow: 0 0 0 0 rgba(238, 90, 36, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.progress-inline {
|
||||||
color: #5a6c7d;
|
max-width: 420px;
|
||||||
font-size: 18px;
|
margin-top: 22px;
|
||||||
line-height: 1.6;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.features-coming {
|
.progress-inline .progress-head {
|
||||||
background: #f8f9fa;
|
|
||||||
border-radius: 15px;
|
|
||||||
padding: 30px;
|
|
||||||
margin: 30px 0;
|
|
||||||
border-left: 5px solid #3498db;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.features-coming h3 {
|
|
||||||
color: #2c3e50;
|
|
||||||
font-size: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feature-list {
|
|
||||||
list-style: none;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feature-list li {
|
|
||||||
padding: 10px 0;
|
|
||||||
color: #5a6c7d;
|
|
||||||
font-size: 16px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
justify-content: space-between;
|
||||||
|
font-size: 0.76rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin-bottom: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-list li::before {
|
.roadmap-grid {
|
||||||
content: "🚧";
|
display: grid;
|
||||||
margin-right: 10px;
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||||
font-size: 18px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar {
|
.roadmap-card {
|
||||||
width: 100%;
|
display: flex;
|
||||||
height: 8px;
|
gap: 12px;
|
||||||
background: #ecf0f1;
|
align-items: flex-start;
|
||||||
border-radius: 4px;
|
padding: 16px;
|
||||||
overflow: hidden;
|
border: 1px solid var(--border);
|
||||||
margin: 20px 0;
|
border-radius: 14px;
|
||||||
position: relative;
|
background: var(--surface);
|
||||||
z-index: 1;
|
transition:
|
||||||
|
border-color var(--rate) ease,
|
||||||
|
transform var(--rate) ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-fill {
|
.roadmap-card:hover {
|
||||||
height: 100%;
|
border-color: var(--border-strong);
|
||||||
background: linear-gradient(90deg, #3498db, #2ecc71);
|
transform: translateY(-1px);
|
||||||
border-radius: 4px;
|
|
||||||
width: 30%;
|
|
||||||
animation: progressAnimation 3s ease-in-out infinite alternate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes progressAnimation {
|
.roadmap-card .rm-icon {
|
||||||
from {
|
width: 36px;
|
||||||
width: 30%;
|
height: 36px;
|
||||||
}
|
flex: none;
|
||||||
to {
|
display: grid;
|
||||||
width: 65%;
|
place-items: center;
|
||||||
}
|
border-radius: 10px;
|
||||||
|
background: var(--accent-soft);
|
||||||
|
color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-text {
|
.roadmap-card .rm-icon svg {
|
||||||
color: #7f8c8d;
|
|
||||||
font-size: 14px;
|
|
||||||
margin-top: 10px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.particles {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.particle {
|
|
||||||
position: absolute;
|
|
||||||
background: #ff9a9e;
|
|
||||||
border-radius: 50%;
|
|
||||||
opacity: 0.15;
|
|
||||||
animation: float 6s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.particle:nth-child(1) {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
left: 10%;
|
|
||||||
animation-delay: 0s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.particle:nth-child(2) {
|
|
||||||
width: 15px;
|
|
||||||
height: 15px;
|
|
||||||
left: 30%;
|
|
||||||
animation-delay: 1s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.particle:nth-child(3) {
|
|
||||||
width: 25px;
|
|
||||||
height: 25px;
|
|
||||||
left: 60%;
|
|
||||||
animation-delay: 2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.particle:nth-child(4) {
|
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
left: 80%;
|
|
||||||
animation-delay: 3s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes float {
|
.roadmap-card h3 {
|
||||||
0%,
|
font-size: 0.86rem;
|
||||||
100% {
|
font-weight: 650;
|
||||||
transform: translateY(0) rotate(0deg);
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
50% {
|
|
||||||
transform: translateY(-20px) rotate(180deg);
|
.roadmap-card p {
|
||||||
}
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roadmap-card .badge {
|
||||||
|
font-size: 0.64rem;
|
||||||
|
padding: 1px 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-card {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 18px 20px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-card .contact-body {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-card h3 {
|
||||||
|
font-size: 0.88rem;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-card p {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 26px 2px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-head h2 {
|
||||||
|
font-size: 1.02rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-head span {
|
||||||
|
font-size: 0.76rem;
|
||||||
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="tool-page">
|
||||||
<div class="particles">
|
<header class="tool-header">
|
||||||
<div class="particle"></div>
|
<div class="tool-icon">
|
||||||
<div class="particle"></div>
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<div class="particle"></div>
|
<rect x="3" y="3" width="7" height="7" rx="1.6" />
|
||||||
<div class="particle"></div>
|
<rect x="14" y="3" width="7" height="7" rx="1.6" />
|
||||||
|
<rect x="3" y="14" width="7" height="7" rx="1.6" />
|
||||||
|
<rect x="14" y="14" width="7" height="7" rx="1.6" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1>其他功能</h1>
|
||||||
|
<p>更多实用工具正在规划与开发中,欢迎告诉我们你最想要什么。</p>
|
||||||
|
</div>
|
||||||
|
<div class="header-actions">
|
||||||
|
<button
|
||||||
|
class="btn btn--icon btn--ghost"
|
||||||
|
data-theme-toggle
|
||||||
|
title="切换主题"
|
||||||
|
aria-label="切换主题"
|
||||||
|
>
|
||||||
|
<svg class="icon-moon" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path d="M21 12.8A8.5 8.5 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z" />
|
||||||
|
</svg>
|
||||||
|
<svg class="icon-sun" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="4" />
|
||||||
|
<path
|
||||||
|
d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="hero-card">
|
||||||
|
<span class="hero-badge">● 持续更新中</span>
|
||||||
|
<h2>工具箱还在长大</h2>
|
||||||
|
<p>
|
||||||
|
现有工具已经覆盖日常计算、编码、图片处理等场景。接下来会继续补充轻量、实用、完全本地运行的
|
||||||
|
小工具,让这个页面成为你收藏夹里真正用得上的那一页。
|
||||||
|
</p>
|
||||||
|
<div class="progress-inline">
|
||||||
|
<div class="progress-head">
|
||||||
|
<span>本期规划进度</span>
|
||||||
|
<span>55%</span>
|
||||||
|
</div>
|
||||||
|
<div class="progress-track">
|
||||||
|
<div class="progress-bar" style="width: 55%"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="section-head">
|
||||||
|
<h2>候选功能</h2>
|
||||||
|
<span>按优先级陆续上线</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="construction-icon">🚧</div>
|
<div class="roadmap-grid">
|
||||||
<h1>其他功能</h1>
|
<div class="roadmap-card">
|
||||||
<div class="status-badge">正在开发中</div>
|
<span class="rm-icon">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<rect x="3" y="3" width="7" height="7" rx="1" />
|
||||||
|
<rect x="14" y="3" width="7" height="7" rx="1" />
|
||||||
|
<rect x="3" y="14" width="7" height="7" rx="1" />
|
||||||
|
<path d="M14 14h3v3h-3zM20 14h1M14 20h1M17 20h4v1" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>二维码生成器</h3>
|
||||||
|
<p>把文本、链接或 Wi-Fi 信息生成可下载的二维码。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="description">
|
<div class="roadmap-card">
|
||||||
更多实用功能正在紧张开发中,敬请期待!我们正在为您打造更加完善的工具集合。
|
<span class="rm-icon">
|
||||||
</p>
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<rect x="5" y="10" width="14" height="10" rx="2" />
|
||||||
|
<path d="M8 10V7a4 4 0 0 1 8 0v3M12 14v2" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>密码生成器</h3>
|
||||||
|
<p>按长度与字符规则生成高强度随机密码。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="features-coming">
|
<div class="roadmap-card">
|
||||||
<h3>🔮 即将推出的功能</h3>
|
<span class="rm-icon">
|
||||||
<ul class="feature-list">
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<li>文本处理工具</li>
|
<path d="M4 7h6M7 4v6M14 17h6M17 14v6" />
|
||||||
<li>图片压缩工具</li>
|
<path d="m13 5 6 6M5 13l6 6" />
|
||||||
<li>二维码生成器</li>
|
</svg>
|
||||||
<li>密码生成器</li>
|
</span>
|
||||||
<li>单位转换工具</li>
|
<div>
|
||||||
<li>时间戳转换器</li>
|
<h3>单位换算</h3>
|
||||||
<li>JSON格式化工具</li>
|
<p>长度、重量、温度、面积等常用单位快速换算。</p>
|
||||||
<li>Base64编码工具</li>
|
<span class="badge">计划中</span>
|
||||||
</ul>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="roadmap-card">
|
||||||
|
<span class="rm-icon">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="9" />
|
||||||
|
<path d="M12 7v5l3 2" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>时间戳转换</h3>
|
||||||
|
<p>Unix 时间戳与本地日期时间双向转换。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="roadmap-card">
|
||||||
|
<span class="rm-icon">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path d="M8 3H5a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2Z" />
|
||||||
|
<path d="M19 13h-3a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2Z" />
|
||||||
|
<path d="M8 13H5a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2Z" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>文本对比</h3>
|
||||||
|
<p>逐行比较两段文本,高亮新增与删除内容。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="roadmap-card">
|
||||||
|
<span class="rm-icon">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path d="M4 5a2 2 0 0 1 2-2h8l6 6v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5Z" />
|
||||||
|
<path d="M14 3v6h6M8 14h8M8 17h5" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>Markdown 预览</h3>
|
||||||
|
<p>边写边渲染 Markdown,适合整理笔记与文档。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="roadmap-card">
|
||||||
|
<span class="rm-icon">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<rect x="3" y="5" width="18" height="14" rx="2" />
|
||||||
|
<circle cx="9" cy="11" r="2" />
|
||||||
|
<path d="m5 17 4-4 3 3 2-2 5 5" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>图片加水印</h3>
|
||||||
|
<p>为图片批量添加文字或图片水印,本地完成。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="roadmap-card">
|
||||||
|
<span class="rm-icon">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="9" />
|
||||||
|
<path d="M12 3a9 9 0 0 1 0 18 9 9 0 0 1 0-18ZM3 12h18" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h3>颜色渐变生成</h3>
|
||||||
|
<p>生成和谐的 CSS 渐变并复制代码。</p>
|
||||||
|
<span class="badge">计划中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="progress-bar">
|
<div class="contact-card">
|
||||||
<div class="progress-fill"></div>
|
<span class="rm-icon" style="
|
||||||
|
width: 42px; height: 42px; display: grid; place-items: center;
|
||||||
|
border-radius: 12px; background: var(--accent-soft); color: var(--accent);
|
||||||
|
">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true" style="width: 20px; height: 20px">
|
||||||
|
<rect x="3" y="5" width="18" height="14" rx="2" />
|
||||||
|
<path d="m3 7 9 6 9-6" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div class="contact-body">
|
||||||
|
<h3>想要某个工具?</h3>
|
||||||
|
<p>告诉我们你的使用场景,我们会优先安排实现。</p>
|
||||||
|
</div>
|
||||||
|
<a class="btn btn--soft" href="mailto:gogongxt@163.com">
|
||||||
|
联系 gogongxt@163.com
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress-text">开发进度:约 40% 完成</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
// 添加一些动态交互效果
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
// 随机改变粒子的动画时间
|
|
||||||
const particles = document.querySelectorAll(".particle");
|
|
||||||
particles.forEach((particle, index) => {
|
|
||||||
const randomDelay = Math.random() * 3;
|
|
||||||
const randomDuration = 4 + Math.random() * 4;
|
|
||||||
particle.style.animationDelay = `${randomDelay}s`;
|
|
||||||
particle.style.animationDuration = `${randomDuration}s`;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加点击效果
|
|
||||||
const container = document.querySelector(".container");
|
|
||||||
container.addEventListener("click", function (e) {
|
|
||||||
const ripple = document.createElement("div");
|
|
||||||
ripple.style.position = "absolute";
|
|
||||||
ripple.style.width = "20px";
|
|
||||||
ripple.style.height = "20px";
|
|
||||||
ripple.style.background = "rgba(255, 154, 158, 0.5)";
|
|
||||||
ripple.style.borderRadius = "50%";
|
|
||||||
ripple.style.transform = "translate(-50%, -50%)";
|
|
||||||
ripple.style.pointerEvents = "none";
|
|
||||||
ripple.style.left = e.clientX - container.offsetLeft + "px";
|
|
||||||
ripple.style.top = e.clientY - container.offsetTop + "px";
|
|
||||||
ripple.style.animation = "rippleEffect 0.6s ease-out";
|
|
||||||
|
|
||||||
container.appendChild(ripple);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
ripple.remove();
|
|
||||||
}, 600);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加涟漪动画
|
|
||||||
const style = document.createElement("style");
|
|
||||||
style.textContent = `
|
|
||||||
@keyframes rippleEffect {
|
|
||||||
to {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
document.head.appendChild(style);
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+338
-616
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user