crimx / ext-saladict

🥗 All-in-one professional pop-up dictionary and page translator which supports multiple search modes, page translations, new word notebook and PDF selection searching.
https://saladict.crimx.com/
MIT License
12.06k stars 738 forks source link

悬浮取词 和 普通划词 显示不一样的查词面板(两个面板都可以单独设置“外观CSS 习惯 词典 发音”互不影响)让youtube字幕悬浮查词(短时间内只显示最精简的解释)和划词显示(划词显示详细解释)的内容不同 #1858

Open k22725 opened 2 years ago

k22725 commented 2 years ago

设备信息

请描述目前使用沙拉查词遇到什么不便

目前的悬浮取词 从属于 普通划词(得到的结果和划词一样) 划词(点划选中)和 取词(移动到词的位置) 是两种动作 理应分开 不在输入框划词还好说但是悬浮取词还是会影响输入框不知道技术上能不能实现让悬浮取词不影响输入框

让youtube字幕悬浮查词(短时间内只显示最精简的解释)和划词显示(划词显示详细解释)的内容不同 鄙人目前是 让沙拉专门悬浮查词用 至于详细解释就用 额外装的一个扩展https://github.com/oyyd/youdao-collins-chrome-extension 此扩展短小精悍 简洁的界面查词神速 就是功能稍少了点 沙拉的 必应词典 汉典 查询速度时快时慢 有时等半天才出结果 或者 啥也没有只能干瞪眼 不知道是不是墙在作祟 微软服务在West Korea经常性的龟速必应词典也不免受影响 汉典就搞不懂了 官网查速度不慢 但是调用沙拉的汉典词典查就碰运气了 查同样的汉字词在同一天同一个小时内 就是有时很快有时就不出结果 不知道是什么原因导致的

理想情况下,沙拉查词应该怎么做

悬浮取词、普通划词、右上弹窗、独立词典窗口 ——这4种显示方式可以单独设置(查词面板 查词习惯 词典 发音)互不影响

油土鳖 字幕实时翻译 ①

配合【YouTube™ 双字幕】扩展程序 https://www.dual-subtitles.com/zh-Hans/ 我的【YouTube™ 双字幕】设置是 字体:黑体(翻译字幕) Arial(视频字幕) 字号:20(翻译字幕、视频字幕) 颜色:FFFFFF80(翻译字幕、视频字幕) 背景:00000080(翻译字幕、视频字幕)

以下是鄙人在【暗黑模式】下【词典只选了 百度翻译,划词语言只选 英文】的CSS(可以实现 悬浮显示几秒后自动隐藏 便于在youtube中快速把选中的单词翻成中文并且弹出的内容少对观看视频影响小 节省宝贵时间)

.entryBox-Wrap {padding-top: unset;}
.entryBox {border: 0;    margin-bottom: 0;    padding: 0;}
.MachineTrans-Lines {padding-left: 0;    margin: 0;}
.MachineTrans-Lines p {margin: 0em;}
.dictItem-BodyMesure>:first-child{margin-top: 0px !important;}
.dictItem-BodyMesure>:last-child{margin-bottom: 0px !important;}
.dictPanel-Root.saladict-panel {width: fit-content !important;    height: fit-content !important;}
.dictItem-Body {line-height: 1;    padding: 0;    height: fit-content !important;}
.dictPanel-Root {box-shadow: none !important;    border-radius: unset;}
.bknr, .jnr, .wknr {margin: 0;}
.contentslot, .mpuslot_b {margin-top: 0;}
.darkMode .saladict-theme {--color-background: #00000000!important;}
p {
    padding-left: 0;
    width: fit-content!important;
    /* 几秒后隐藏 */
    animation: mymove 3s;
    animation-fill-mode: forwards;
}
@keyframes mymove {to {height: 0; width: 0;}}
/* 字体 */
.dictRoot {
    font: 29.375px SimHei;
} 
/* 颜色 */
.dictPanel-Root {
    --color-font: #FFFFFF80!important;
    background: #00000080!important;
}
/* 隐藏元素 */    
.menuBar,
.saladict-Speaker,
.dictItemHead,
.MachineTrans-lang-en  {display:none;}

油土鳖 字幕实时翻译 ②

https://addons.mozilla.org/zh-CN/firefox/addon/youtube-subtitle-position/ (这是一个可以记住Youtube字幕位置的Firefox扩展,安装成功后会在YouTube播放器控制条上多出个红色按钮 点开按钮会出现 有9个方框【分别对应“左上 上 右上 左 中 右 左下 下 右下”9个位置,可快速把字幕定到相应位置】5个白色矩形【分别对应“左对齐 居中对齐 右对齐(对齐对自动字幕生效)上移 下移”】 Chrome商店没找到类似功能的扩展) 下载文件 把 .xpi 后缀改为 .zip 拖到 chrome://extensions/ 页面安装扩展(如果没安装 应该是页面右上角“开发者模式”开关没开启 开启开关后 刷新下页面再拖一遍文件进去就能安装了)安装成功后 会提示两条错误(Unrecognized manifest key 'browser_specific_settings'. Manifest version 2 is deprecated, and support will be removed in 2023. See https://developer.chrome.com/blog/mv2-transition/ for more details.)不过没关系 不影响使用(如果有哪位大侠知道这俩错误啥意思 什么原因引起的 恳请不吝赐教)

https://saladict.crimx.com/tips.html#youtubehttps://greasyfork.org/en/scripts/402598-fixed-youtube-captions) 介绍的油猴脚本 在YouTube字幕上会显示 小手手 鄙人发现一个更完美的办法 在点开下面链接 https://stackoverflow.com/questions/40165879/how-make-youtube-subtitles-selectable 键盘 “ Ctrl + F ” 快捷键搜 Ilya 就可以找到代码了 把代码复制粘贴到 油猴子新建的用户脚本中保存就OK啦!(该脚本可以让字幕可选择 并且 不显示 小手手)

以下是 Ilya 分享的代码

// ==UserScript==
// @name         make youtube caption selectable
// @namespace    none
// @version      0.2
// @description  Use this script if you want be able to select youtube captions/subtitles!
// @author       You
// @match        https://www.youtube.com/watch?*
// @grant        none
// @require      none
// ==/UserScript==

!function() {
  setInterval(make_subtitles_selectable, 250);
  function make_subtitles_selectable(){
    elem=document.querySelector("div.caption-window");
    if(elem!=null){
        elem.addEventListener("mousedown", function (event) {
            event.stopPropagation();
        }, true);
        elem.setAttribute("draggable", "false");
        elem.style.userSelect="text";
        elem.style.cursor="text";
        elem.setAttribute("selectable", "true");
    }
    elem=document.querySelector("span.ytp-caption-segment:not([selectable='true']");
    if(elem!=null){
        elem.style.userSelect="text";
        elem.style.cursor="text";
        elem.setAttribute("selectable", "true");
    }
    elem=document.querySelector("#caption-window-1:not([selectable='true']");
    if(elem!=null){
        elem.addEventListener("mousedown", function (event) {
            event.stopPropagation();
        }, true);
        elem.setAttribute("selectable", "true");
        elem.setAttribute("draggable", "false");
    }
}
}()
k22725 commented 2 years ago

'Improve YouTube!' (Video & YouTube Tools)🎧可以自动全屏 并且隐藏播放器控制栏(鄙人配置了快捷键“D”反正在B站上的开关弹幕D键在youtube上用不着)实现在全屏状态下移动鼠标悬浮翻译字幕时不显示youtube上边的标题、阴影 以及 下边的操控条、操控栏、阴影 全都隐藏了 “好一似食尽鸟投林,落得个白茫茫大地真干净” 强迫症患者的福音 洁癖的好助手

Global Speed: 视频速度控制功能十分强大极度实用!可以自定义各种各样的快捷键 指定网站的速度 还有一些黑魔法 比如说伟大的神乐老师怒评十大经典动画(翻转)右上角🔺 → ⚡→ 元素 → 变换 → Z轴旋转 -135 就可把画面调正 以下是鄙人的【Global Speed: 视频速度控制】自定义设置 复制然后打开 chrome-extension://jpbjcnkcffbooppibceonlgknpkniiff/options.html 点右下角导入右边的“粘贴按钮”就可把我的配置给用上了

{"common":{"audioFx":{"delay":0,"eq":{"enabled":false,"factor":1,"values":[0,0,0,0,0,0,0,0,0,0]},"pitch":0,"volume":1},"backdropFx":{"filters":[{"name":"sepia","value":0},{"name":"hueRotate","value":0},{"name":"grayscale","value":0},{"name":"contrast","value":1},{"name":"brightness","value":1},{"name":"saturate","value":1},{"name":"invert","value":0},{"name":"blur","value":0},{"name":"opacity","value":1}],"transforms":[{"name":"scaleX","value":1},{"name":"scaleY","value":1},{"name":"translateX","value":0},{"name":"translateY","value":0},{"name":"rotateX","value":0},{"name":"rotateY","value":0},{"name":"rotateZ","value":0}]},"elementFx":{"enabled":false,"filters":[{"name":"sepia","value":0},{"name":"hueRotate","value":0},{"name":"grayscale","value":0},{"name":"contrast","value":1},{"name":"brightness","value":1},{"name":"saturate","value":1},{"name":"invert","value":0},{"name":"blur","value":0},{"name":"opacity","value":1}],"transforms":[{"name":"scaleX","value":1},{"name":"scaleY","value":1},{"name":"translateX","value":0},{"name":"translateY","value":0},{"name":"rotateX","value":0},{"name":"rotateY","value":0},{"name":"rotateZ","value":0}]},"enabled":true,"enabledLatestViaPopup":false,"lastSpeed":1,"speed":4},"darkTheme":false,"feedbackVolume":0,"firstUse":1628236759515,"freePitch":false,"ghostMode":false,"hideBadge":false,"hideIndicator":false,"hideMediaView":false,"indicatorInit":{"backgroundColor":null,"duration":1.9,"offset":4,"rounding":0,"scaling":1.5,"textColor":null},"inheritPreviousContext":true,"keybinds":[{"adjustMode":1,"command":"adjustSpeed","cycleIncrement":1206,"enabled":true,"greedy":true,"id":"1381613645","key":{"altKey":false,"code":"KeyQ","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueCycle":[1],"valueNumber":1},{"adjustMode":1,"command":"adjustSpeed","cycleIncrement":807,"enabled":true,"greedy":true,"id":"3777418808","key":{"altKey":false,"code":"KeyW","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueCycle":[1.5],"valueNumber":1.5,"valueNumberAlt":2},{"adjustMode":1,"command":"adjustSpeed","cycleIncrement":1762,"enabled":true,"greedy":true,"id":"292302471","key":{"altKey":false,"code":"KeyE","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueCycle":[2],"valueNumber":2,"valueNumberAlt":-0.5},{"adjustMode":1,"command":"adjustSpeed","enabled":true,"greedy":true,"id":"964357484","key":{"altKey":false,"code":"KeyR","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueNumber":3},{"adjustMode":1,"command":"adjustSpeed","enabled":true,"greedy":true,"id":"7339088359","key":{"altKey":false,"code":"KeyT","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueNumber":4},{"adjustMode":2,"command":"adjustSpeed","enabled":true,"greedy":true,"id":"1889965708","key":{"altKey":false,"code":"KeyA","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueNumberAlt":-0.5},{"adjustMode":2,"command":"adjustSpeed","enabled":true,"greedy":true,"id":"5334057460","key":{"altKey":false,"code":"KeyS","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueNumberAlt":1},{"adjustMode":1,"command":"adjustSpeed","enabled":true,"greedy":true,"id":"539139609","key":{"altKey":false,"code":"KeyG","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueNumber":8},{"id":"2422988388","command":"adjustSpeed","enabled":true,"greedy":true,"adjustMode":1,"key":{"ctrlKey":false,"altKey":false,"shiftKey":false,"metaKey":false,"code":"KeyH"},"valueNumber":16,"spacing":0},{"command":"PiP","enabled":true,"greedy":true,"id":"6090874147","key":{"altKey":false,"code":"KeyZ","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueState":"toggle"},{"command":"setState","enabled":true,"greedy":true,"id":"6547617039","key":{"altKey":false,"code":"KeyX","ctrlKey":false,"metaKey":false,"shiftKey":false},"valueState":"toggle"}],"keybindsUrlCondition":null,"pinByDefault":false,"rules":[{"condition":{"parts":[{"id":"2117804301","type":"CONTAINS","value":"youtube.com"},{"id":"8445467751","type":"CONTAINS","value":"ximalaya.com"},{"type":"CONTAINS","value":"163.com","id":"413232747"}]},"enabled":true,"id":"3784648174","overrideSpeed":1,"strict":true,"type":"SPEED"},{"condition":{"parts":[{"type":"CONTAINS","value":"bilibili.com","id":"9022488587"},{"type":"CONTAINS","value":"douyin.com","id":"4678138028"},{"type":"CONTAINS","value":"twitter.com","id":"8748491178"}]},"enabled":true,"id":"1875590483","overrideSpeed":2,"strict":true,"type":"SPEED"}],"showNetSeek":false,"speedBigStep":0.4,"speedPresetPadding":0,"speedPresetRows":1,"speedPresets":[1,2,3,0.9,1,1.1,1.25,1.5,1.75,2,2.5,16],"speedSlider":null,"speedSmallStep":0.2,"staticOverlay":false,"version":10}
k22725 commented 2 years ago

扩展管理器(Extension Manager)方便快速管理扩展 效率好能手

pakku 哔哩哔哩弹幕过滤器可合并b站重复弹幕让页面更整洁

AHA Music - 浏览器中的音乐雷达

以上3款是鄙人一个个试精挑细选的来自这位大侠贡献的

Dark Theme for Chrome可自定义让部分网站使用护眼方式 护眼的颜色可自由调整选择多样

f.lux快捷键"Alt + PageUp/Down"(用AutoHotkey可自定义快捷键(鄙人用的是不带小键盘的87键键盘“ScrollLock ” “Pause”在右上角方便点按))可快速调整屏幕亮度

以下是鄙人ahk脚本代码 在电脑中安装ahk 新建一个.ahk的文件把代码复制粘贴进去保存打开就OK啦

  F1::Volume_Down ;音量-
  F2::Volume_Up ;音量+
  F3::Run chrome.exe "chrome-extension://cdonnmffkdaoajfknoeeecmchibpmkmg/options.html?menuselected=DictPanel" "-new-window" ;沙拉设置查词面板页面
  F4::] ;b站 下一个视频
  F6::Run, "C:\Users\1\Downloads", , Max ;资源管理器的下载文件夹(“1”是鄙人的用户名 把这个改成你的用户名就OK啦)
  F7::
Send !{F4}{Space}
Sleep 111
Reload
Return ;保存并重新加载ahk脚本
  F8::Run,Notepad++.exe "C:\Users\1\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\key.ahk", , Max ;ahk脚本设置
  F9::Run chrome.exe "https://www.autohotkey.com/docs/KeyList.htm" "-new-window" ;ahk帮助     
  PrintScreen::DllCall("PowrProf\SetSuspendState", "Int", 0, "Int", 0, "Int", 0) ;win10睡眠(本人是简体中文专业版21H2)
  ScrollLock::!PgUp ;f.lux调亮
  Pause::!PgDn ;f.lux调暗
  `::
KeyWait, ``, T0.2
If ErrorLevel{              
Send ^+t
KeyWait, ``
}Else{
Send !{Left}
}Return ;按下超过0.2秒 → chrome按标签页的关闭顺序重新打开先前关闭的标签页 0.2秒内松开 → 网页后退
  Insert::suspend ;ahk暂停
  Tab::^PgUp ;chrome跳转到上一个打开的标签页    
  CapsLock::^PgDn ;chrome跳转到下一个打开的标签页
  SC027::Enter ;右手小指下的“;”键替换成“Enter”键
  RShift::Run chrome.exe ;chrome打开新窗口
  RAlt::
Send {AppsKey}t
Return ;chrome翻译当前页
  AppsKey::^w ;chrome关闭当前标签页
  RCtrl::Run chrome.exe ;chrome打开新窗口
  XButton1::!Tab ;鼠标拇指边上的键 切换窗口(有的鼠标没有这个键)
crimx commented 2 years ago

嗨,感谢反馈!Issue 用于问题反馈,建议保持简单直接,分享内容欢迎发到 Discussions 上。长篇代码已帮你调整了高亮。

沙拉查词中的必应词典和汉典都是访问官网同样的网页,速度应该是一样的,点击词典的标题可以跳转到官网。不稳定的问题因为是官方的网站这边没法控制。

悬浮取词、普通划词、右上弹窗、独立词典窗口 ——这4种显示方式可以单独设置(查词面板 查词习惯 词典 发音)互不影响

这个你可以尝试沙拉查词的情景模式功能。

k22725 commented 2 years ago

情景模式 不错(可以让一个人切换不同情景 也能让不同用户 [一台电脑有多人使用沙拉 每个人习惯不同] 使用不同情景)但是需要手动切换

如果每个情景模式 里面都可以实现【悬浮取词、普通划词、右上弹窗、独立词典窗口 ——这4种显示方式可以单独设置(查词面板 查词习惯 词典 发音)互不影响】就完美了

k22725 commented 2 years ago

感谢大神倾囊相授 为小白指点迷津 抱歉 鄙人萌新一枚 技术小白文化程度不高 如有冒犯或失礼的地方 请多多指教

k22725 commented 2 years ago

https://github.com/ouweiya/Dual-Caption-Blog/issues/3