(toolName, menuList, parentId)
| 179 | * @private |
| 180 | */ |
| 181 | let _createItem = (toolName, menuList, parentId) => { |
| 182 | menuList && menuList.forEach && menuList.forEach(menu => { |
| 183 | |
| 184 | let menuItemId = 'fhm_c' + escape(menu.text).replace(/\W/g,'') + Date.now() + Math.floor(Math.random() * 1000); |
| 185 | |
| 186 | chrome.contextMenus.create({ |
| 187 | id: menuItemId, |
| 188 | title: menu.text, |
| 189 | contexts: menu.contexts || ['all'], |
| 190 | parentId: parentId || FeJson.contextMenuId |
| 191 | }, () => { |
| 192 | if (chrome.runtime.lastError) return; |
| 193 | FeJson.menuClickHandlers[menuItemId] = menu.onClick || (() => { |
| 194 | globalThis.FeHelperBg.DynamicToolRunner({ tool: toolName }); |
| 195 | }); |
| 196 | }); |
| 197 | }); |
| 198 | }; |
| 199 | |
| 200 | let _ensureToolMenuConfig = (tool, toolInfo) => { |
| 201 | if(!toolInfo.menuConfig) { |
no test coverage detected