mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-06-25 06:46:21 +09:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f05581f88a | |||
| d237a7f1c6 | |||
| 13cc7659ea | |||
| e9730b5839 | |||
| f2f1ff2c10 | |||
| 5fac00b5ce |
@@ -5,8 +5,10 @@ Chrome 应用商店:<https://chrome.google.com/webstore/detail/memos-bber/cbhj
|
||||
一个通过浏览器插件发布 [Memos](https://usememos.com/) 的插件。基于 iSpeak-bber 修改,原作者为 [DreamyTZK](https://www.antmoe.com/)。
|
||||
|
||||
## 更新日志
|
||||
- 20260322 适配移动端竖屏窗口
|
||||
- 20260310 记忆拖拽窗口大小,移除拖拽窗口动画
|
||||
- 20260309 右键发送选中文本保持原格式,增加全屏和窗口放大功能
|
||||
### 20260308 向前兼容到0.18.0,可能再往前也行,只测试到0.18.0
|
||||
### 20260308 向前兼容到0.15.0,可能再往前也行,只测试到0.15.0
|
||||
- 20260307 增加语言切换按钮以及韩语和日语支持,
|
||||
- 2026年03月06日 右键菜单发送选中文本附带原文链接
|
||||
- 2026年03月05日 向前兼容到0.24.0,可能再往前也行,因为只测试了0.24.0和0.25.0以及当前最新版本,如有更早版本需求,可issue反馈
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "Save"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "Compatible with Memos v0.18.0 - 0.26.x"
|
||||
"message": "Compatible with Memos v0.15.0 - 0.26.x"
|
||||
},
|
||||
"placeApiUrl":{
|
||||
"message": "Memos site URL"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "保存"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "Memos v0.18.0 - 0.26.x に対応"
|
||||
"message": "Memos v0.15.0 - 0.26.x に対応"
|
||||
},
|
||||
"placeApiUrl": {
|
||||
"message": "Memos サイトURL"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "저장"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "Memos v0.18.0 - 0.26.x 호환"
|
||||
"message": "Memos v0.15.0 - 0.26.x 호환"
|
||||
},
|
||||
"placeApiUrl": {
|
||||
"message": "Memos 사이트 URL"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "保存"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "兼容 Memos v0.18.0 - 0.26.x"
|
||||
"message": "兼容 Memos v0.15.0 - 0.26.x"
|
||||
},
|
||||
"placeApiUrl":{
|
||||
"message": "请填入 Memos 主页网址"
|
||||
|
||||
+3
-5
@@ -20,7 +20,7 @@ input:focus::placeholder ,.common-editor-inputer:focus::placeholder {
|
||||
}
|
||||
|
||||
.body{
|
||||
min-width:460px;
|
||||
min-width:360px;
|
||||
background-color: #f6f5f4;
|
||||
padding:0 1rem 1rem;
|
||||
font-family: eafont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,STHeiti,WenQuanYi Micro Hei,Helvetica,Arial,sans-serif;
|
||||
@@ -29,6 +29,7 @@ input:focus::placeholder ,.common-editor-inputer:focus::placeholder {
|
||||
line-height: 1.5;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
a{color: #555;}
|
||||
.title{
|
||||
width: 100px;
|
||||
@@ -44,9 +45,6 @@ a{color: #555;}
|
||||
background-color: rgb(255,255,255);
|
||||
margin-top:0.8rem;
|
||||
padding: 0.6rem;
|
||||
transition-property: all;
|
||||
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
||||
transition-duration: .15s;
|
||||
}
|
||||
.memo-editor{
|
||||
position: relative;
|
||||
@@ -538,4 +536,4 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;}
|
||||
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(156 163 175 / var(--tw-text-opacity))
|
||||
}
|
||||
}
|
||||
|
||||
+71
@@ -39,6 +39,8 @@ function initProportionalEditorResize() {
|
||||
editor.style.minWidth = `${baseW}px`
|
||||
editor.style.minHeight = `${baseH}px`
|
||||
|
||||
const storageKey = 'popupEditorScale'
|
||||
|
||||
let maxScale = 1
|
||||
const computeMaxScale = () => {
|
||||
// In popup mode, allow scaling up to Chrome's max popup size.
|
||||
@@ -69,6 +71,15 @@ function initProportionalEditorResize() {
|
||||
let rafId = 0
|
||||
let pendingScale = null
|
||||
|
||||
const parseScale = (raw) => {
|
||||
const s = typeof raw === 'number' && Number.isFinite(raw)
|
||||
? raw
|
||||
: typeof raw === 'string' && raw.trim() !== '' && !Number.isNaN(Number(raw))
|
||||
? Number(raw)
|
||||
: 1
|
||||
return s > 0 ? s : 1
|
||||
}
|
||||
|
||||
const readCurrentScale = () => {
|
||||
const w = parseFloat(editor.style.width || '')
|
||||
const h = parseFloat(editor.style.height || '')
|
||||
@@ -83,6 +94,47 @@ function initProportionalEditorResize() {
|
||||
editor.style.height = `${Math.round(baseH * s)}px`
|
||||
}
|
||||
|
||||
const applyScaleInstant = (scale) => {
|
||||
// In case CSS transitions exist (or get reintroduced), keep restores immediate.
|
||||
const prevTransition = editor.style.transition
|
||||
editor.style.transition = 'none'
|
||||
applyScale(scale)
|
||||
window.requestAnimationFrame(function () {
|
||||
editor.style.transition = prevTransition
|
||||
})
|
||||
}
|
||||
|
||||
// Restore previously saved scale synchronously (localStorage) first.
|
||||
// This makes the popup *feel* synchronous because it can apply before async chrome.storage returns.
|
||||
let restoredFromLocal = false
|
||||
let localScale = 1
|
||||
try {
|
||||
const raw = window.localStorage ? window.localStorage.getItem(storageKey) : null
|
||||
const s = parseScale(raw)
|
||||
if (s && s !== 1) {
|
||||
localScale = s
|
||||
restoredFromLocal = true
|
||||
applyScaleInstant(s)
|
||||
}
|
||||
} catch (_) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// Restore from chrome.storage.sync (best-effort) and keep localStorage in sync.
|
||||
try {
|
||||
chrome.storage.sync.get({ [storageKey]: 1 }, function (items) {
|
||||
const raw = items ? items[storageKey] : 1
|
||||
const s = parseScale(raw)
|
||||
const shouldApply = !restoredFromLocal || Math.abs(s - localScale) > 1e-6
|
||||
if (shouldApply) applyScaleInstant(s)
|
||||
try {
|
||||
if (window.localStorage) window.localStorage.setItem(storageKey, String(s))
|
||||
} catch (_) {}
|
||||
})
|
||||
} catch (_) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
const scheduleApply = () => {
|
||||
if (rafId) return
|
||||
rafId = window.requestAnimationFrame(() => {
|
||||
@@ -122,6 +174,25 @@ function initProportionalEditorResize() {
|
||||
|
||||
const endDrag = () => {
|
||||
dragging = false
|
||||
|
||||
// Flush any pending RAF update before persisting.
|
||||
if (pendingScale != null) {
|
||||
applyScale(pendingScale)
|
||||
pendingScale = null
|
||||
}
|
||||
|
||||
// Persist current scale (best-effort).
|
||||
try {
|
||||
const s = readCurrentScale()
|
||||
if (typeof s === 'number' && Number.isFinite(s)) {
|
||||
try {
|
||||
if (window.localStorage) window.localStorage.setItem(storageKey, String(s))
|
||||
} catch (_) {}
|
||||
chrome.storage.sync.set({ [storageKey]: s })
|
||||
}
|
||||
} catch (_) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
handle.addEventListener('pointerup', endDrag)
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"manifest_version": 3,
|
||||
"name": "__MSG_extName__",
|
||||
"default_locale": "en",
|
||||
"version": "2026.03.10",
|
||||
"version_name": "Supports 0.18.0 to the latest version",
|
||||
"version": "2026.03.22",
|
||||
"version_name": "Supports 0.15.0 - 0.26.x",
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": "assets/logo_24x24.png",
|
||||
|
||||
Reference in New Issue
Block a user