diff --git a/entrypoints/content.ts b/entrypoints/content.ts index 316cd1f..fda8e3f 100644 --- a/entrypoints/content.ts +++ b/entrypoints/content.ts @@ -70,14 +70,16 @@ export default defineContentScript({ let startPos = {x: 0, y: 0}; // startPos 记录鼠标按下时的位置 document.body.addEventListener('mouseup', () => clearTimeout(timer)); document.body.addEventListener('mousedown', event => { - clearTimeout(timer); // 清除之前的计时器 - startPos.x = event.clientX; // 记录鼠标按下时的初始位置 - startPos.y = event.clientY; - timer = setTimeout(() => { - let mouseX = event.clientX; - let mouseY = event.clientY; - handler(config, mouseX, mouseY); - }, 500) as unknown as number; + if (config.hotkey === constants.LongPress) { + clearTimeout(timer); // 清除之前的计时器 + startPos.x = event.clientX; // 记录鼠标按下时的初始位置 + startPos.y = event.clientY; + timer = setTimeout(() => { + let mouseX = event.clientX; + let mouseY = event.clientY; + handler(config, mouseX, mouseY); + }, 500) as unknown as number; + } }); document.body.addEventListener('mousemove', event => { // 如果鼠标移动超过10像素,取消长按事件 @@ -85,11 +87,11 @@ export default defineContentScript({ clearTimeout(timer); } }); - document.body.addEventListener('mousemove', event => { - // 检测鼠标是否移动 - if (Math.abs(event.clientX - startPos.x) > 10 || Math.abs(event.clientY - startPos.y) > 10) { - clearTimeout(timer); // 如果鼠标移动超过10像素,取消长按事件 + // 检测鼠标是否移动,如果鼠标移动超过10像素,取消长按事件 + if (config.hotkey === constants.LongPress + && Math.abs(event.clientX - startPos.x) > 10 || Math.abs(event.clientY - startPos.y) > 10) { + clearTimeout(timer); } }); diff --git a/entrypoints/popup/main.ts b/entrypoints/popup/main.ts index 11d6695..51597e0 100644 --- a/entrypoints/popup/main.ts +++ b/entrypoints/popup/main.ts @@ -7,9 +7,9 @@ import * as ElementPlusIconsVue from '@element-plus/icons-vue' const app = createApp(App); -app.use(ElementPlus) // 导入 element-plus ui -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { // 注册所有 element-plus 的图标 - app.component(key, component) -} + +// 导入 element-plus ui,注册所有 element-plus 的图标 +app.use(ElementPlus) +for (const [key, component] of Object.entries(ElementPlusIconsVue)) app.component(key, component) app.mount('#app'); diff --git a/entrypoints/popup/style.css b/entrypoints/popup/style.css index b58a21b..5ef2290 100644 --- a/entrypoints/popup/style.css +++ b/entrypoints/popup/style.css @@ -14,10 +14,6 @@ -webkit-text-size-adjust: 100%; } -.lightblue { - /*background-color: #f0f2f5;*/ -} - .rounded-corner { border-radius: 5px; /* 或者您期望的圆角大小 */ } @@ -25,7 +21,7 @@ /*popup选项框文字*/ .popup-text { font-size: 15px; - color: #000000; + /*color: #000000;*/ } .popup-vertical-left { diff --git a/entrypoints/utils/option.ts b/entrypoints/utils/option.ts index da3d3d7..99ff493 100644 --- a/entrypoints/utils/option.ts +++ b/entrypoints/utils/option.ts @@ -159,6 +159,11 @@ export const options = { label: 'OpenAI', model: "gpt-3.5-turbo", }, + { + value: services.moonshot, + label: 'Kimi(月之暗面)', + model: "moonshot-v1-8k", + }, { value: services.claude, label: 'Claude', @@ -169,11 +174,6 @@ export const options = { label: 'Gemini', model: "gemini-pro", }, - { - value: services.moonshot, - label: 'Moonshot', - model: "moonshot-v1-8k", - }, { value: services.zhipu, label: '智谱清言',