MCPcopy Create free account
hub / github.com/ChinaGodMan/UserScripts / updateMenuCommands

Function updateMenuCommands

popup-window/popup-window.user.js:749–777  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() })

Callers 13

openSettingsFunction · 0.85
toggleActionModeFunction · 0.85
setLongPressDurationFunction · 0.85
setLongPressEffectiveFunction · 0.85
setdragTimeOutFunction · 0.85
toggleBlurEffectFunction · 0.85
setBlurIntensityFunction · 0.85
toggleCloseOnMouseClickFunction · 0.85
toggleCloseOnScrollFunction · 0.85
setWindowSizeFunction · 0.85
saveWindowConfigFunction · 0.85
toggleSwitchFunction · 0.85

Calls 2

toggleSwitchFunction · 0.85
registerMenuCommandFunction · 0.70

Tested by

no test coverage detected