()
| 747 | } |
| 748 | } |
| 749 | function updateMenuCommands() {//LINK - |
| 750 | let menuCommands = [ |
| 751 | { label: translate('settings'), action: openSettings }, |
| 752 | { label: translate('actionMode') + ` (${config.actionMode === 1 ? translate('actionMode1') : config.actionMode === 2 ? translate('actionMode2') : translate('actionMode0')})`, action: toggleActionMode }, |
| 753 | { label: translate('longPressEffective') + ` (${config.longPressEffective}ms)`, action: setLongPressEffective }, |
| 754 | { label: translate('longPressDuration') + ` (${config.longPressDuration}ms)`, action: setLongPressDuration }, |
| 755 | { label: translate('dragTimeOut') + ` (${config.dragTimeOut}ms)`, action: setdragTimeOut }, |
| 756 | { label: translate('blurEnabled') + ` (${config.blurEnabled ? '✅' : '❌'})`, action: toggleBlurEffect }, |
| 757 | { label: translate('blurIntensity') + ` (${config.blurIntensity})`, action: setBlurIntensity }, |
| 758 | { label: translate('closeOnMouseClick') + ` (${config.closeOnMouseClick ? '✅' : '❌'})`, action: toggleCloseOnMouseClick }, |
| 759 | { label: translate('closeOnScroll') + ` (${config.closeOnScroll ? '✅' : '❌'})`, action: toggleCloseOnScroll }, |
| 760 | /* { label: translate('windowWidth') + ` (${config.windowWidth})`, action: () => { setWindowSize('width') } },//!SECTION -已无实际意义,脚本不会使用 |
| 761 | { label: translate('windowHeight') + ` (${config.windowHeight})`, action: () => { setWindowSize('height') } },//!SECTION -已无实际意义,脚本不会使用 */ |
| 762 | { label: translate('showCountdown') + ` (${config.showCountdown ? '✅' : '❌'})`, action: () => { toggleSwitch('showCountdown') } }, |
| 763 | { label: translate('showCountdowndrag') + ` (${config.showCountdowndrag ? '✅' : '❌'})`, action: () => { toggleSwitch('showCountdowndrag') } }, |
| 764 | { label: translate('saveWindowConfig') + ` (${config.saveWindowConfig ? '✅' : '❌'})`, action: () => { toggleSwitch('saveWindowConfig') } } |
| 765 | ] |
| 766 | if (config.streamlinedmenu) { |
| 767 | menuCommands = [ |
| 768 | { label: translate('settings'), action: openSettings }] |
| 769 | } |
| 770 | for (const label in registeredMenuCommands) { |
| 771 | GM_unregisterMenuCommand(registeredMenuCommands[label]) |
| 772 | } |
| 773 | registeredMenuCommands = {} |
| 774 | menuCommands.forEach((command) => { |
| 775 | registerMenuCommand(command.label, command.action) |
| 776 | }) |
| 777 | } |
| 778 | updateMenuCommands() |
| 779 | function toTitleCase(str) { |
| 780 | return str.replace(/\w\S*/g, (txt) => { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase() }) |
no test coverage detected