一个简洁、美观、全平台可用的计算器。单 HTML 文件,零依赖部署。
🖥️ 演示站点:https://js.p55.top
- 基础四则运算:
+−×÷ %百分比、±正负切换- 退格
←、全部清除C - 键盘快捷键支持(数字、运算符、Enter、Backspace、Esc)
- 历史记录(自动保存至浏览器本地
localStorage)- 点击条目回填结果
- ✏️ 编辑表达式并自动重算
- 🗑 单条删除 / 清空全部
- 千分位逗号格式化(结果和记录)
- 超长数字自适应字号缩放(最大 40 位有效数字)
- 任意精度计算(基于
decimal.js):- 精确处理
0.1 + 0.2 = 0.3等浮点运算 - 40 位以内整数运算无精度损失
- 精确处理
- 响应式布局
- 移动端:全屏计算器 + 侧滑历史面板
- 桌面端:计算器与历史并排
- 深色主题
| 框架 | 无(纯静态 HTML) |
| 响应式 | Alpine.js |
| 样式 | Tailwind CSS (CDN) |
| 计算引擎 | decimal.js |
| 持久化 | localStorage |
所有依赖均通过 CDN 加载,无需构建步骤。
直接在浏览器中打开 index.html,或部署到任意静态托管服务。
| 按键 | 功能 |
|---|---|
0 – 9 |
输入数字 |
. |
小数点 |
+ - * / |
运算符 |
Enter / = |
计算结果 |
Backspace |
退格 |
Escape / Delete |
全部清除 |
% |
百分比 |
- 在 GitHub 创建仓库
- 将
index.html和README.md推送到仓库 - 进入 Settings → Pages → Source 选择
main分支 - (可选)绑定自定义域名
- 登录 Cloudflare Dashboard → Pages
- 创建项目 → 连接到 Git 仓库
- 构建设置:框架预设选 None,构建命令留空,输出目录填
. - (可选)绑定自定义域名
任何支持静态文件的托管服务均可,直接将 index.html 上传即可。
关于多人使用的历史数据隔离:
localStorage按域名隔离。你用自己的域名访问,别人用 fork 后的域名访问,数据完全独立,互不干扰。
- 所有计算均在浏览器本地执行
- 历史记录仅存储在浏览器
localStorage中 - 不发送任何网络请求(除加载 CDN 脚本外)
- 无后端、无数据库、无追踪
A clean, responsive calculator that works everywhere. Single HTML file, zero dependencies.
🖥️ Live demo: https://js.p55.top
- Basic arithmetic:
+−×÷ %percent,±negate- Backspace
←, ClearC - Keyboard shortcuts (digits, operators, Enter, Backspace, Escape)
- Calculation history (persisted in
localStorage)- Click to reload result
- ✏️ Edit expression & auto-recalculate
- 🗑 Delete single / Clear all
- Thousands separator formatting
- Dynamic font scaling for long numbers (up to 40 significant digits)
- Arbitrary precision arithmetic (powered by
decimal.js):- Accurate
0.1 + 0.2 = 0.3 - Exact integer operations up to 40 digits
- Accurate
- Responsive layout
- Mobile: full-width calculator + slide-in history panel
- Desktop: side-by-side calculator & history
- Dark theme
| Framework | None (vanilla HTML) |
| Reactive UI | Alpine.js |
| Styling | Tailwind CSS (CDN) |
| Math Engine | decimal.js |
| Persistence | localStorage |
All dependencies loaded via CDN — no build step required.
Open index.html in a browser, or deploy to any static hosting service.
| Key | Function |
|---|---|
0 – 9 |
Digit input |
. |
Decimal point |
+ - * / |
Operator |
Enter / = |
Calculate |
Backspace |
Backspace |
Escape / Delete |
Clear all |
% |
Percent |
- Create a repository on GitHub
- Push
index.htmlandREADME.md - Settings → Pages → Source →
mainbranch - (Optional) Bind a custom domain
- Cloudflare Dashboard → Pages
- Create project → Connect Git repo
- Build settings: Framework None, build command empty, output directory
. - (Optional) Bind a custom domain
Any service that serves static files works — just upload index.html.
History data isolation:
localStorageis scoped per domain. Your data stays on your domain; fork users' data stays on theirs.
- All computation happens locally in the browser
- History stored only in browser
localStorage - No network requests (except CDN scripts on first load)
- No backend, no database, no tracking