diff --git a/CHANGELOG.md b/CHANGELOG.md index b003957..062f7ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,75 +1,80 @@ -### 1.2.5 - 2023-02-27 - The Reversion -- Revert previous change since it broke generic queries and item pulls (by weapon/energy type, etc.) - -### 1.2.4 - 2023-02-25 - The One Where IKELOS Weapons Maybe Work - -- Weapons with periods AND underscores (IKELOS weapons) are now parsed even better. -- If a weapon contains a shorthand for a weapon type (IKELOS SMG) is handled since the code no longer only performs one type of search or the other. It will do both types and if a weapon name was matched, it'll override any generic weapon search. - -### 1.2.3 - 2022-11-25 - Parsing Issues - -- Weapons with periods in their name (IKELOS weapons, a few others) are now parsed correctly -- Slight optimization for transferring weapons by name (no longer populates the search bar with `name:""`) - -### 1.2.2 - 2022-10-04 - Activation Phrase Fix - -- Added fix for capital letter in activation phrase by trimming/lowercasing everywhere - -### 1.2.1 - 2022-10-03 - Only in Inventory - -- Added fix for loading DIM on another tab. Previously required reloading the page on the inventory tab. Now Voice DIM will load no matter what page is started on -- Added fix for a user having the item popup sidebar being collapsed. - -### 1.2.0 - 2022-09-24 - Always Listening - -- Added a toggle-able `Always Listening` mode - - Each command must be prefixed with an activation phrase (defaulted to `okay ghost`) -- Added fix for `maxPower` command (didn't work in normal DIM, only in beta) -- Added fix for search already being populated when performing a command. - -### 1.1.3 - 2022-09-20 - Perk fix - -- Fixed perk matching - -### 1.1.2 - 2022-09-19 - Options page links - -- Added an `onInstalled` event for the extension. It'll direct users to the options page. -- Link to the options page from the `?` - -### 1.1.1 - 2022-09-16 - Better performance - -- Use a `waitForElement/waitForSearchToUpdate` function instead of arbitrarily sleeping in code - - Results in at least a 300% improvement in action duration - -### 1.1.0 - 2022-09-13 - The One with Custom Commands - -- Quite a few changes in this one -- Reworked how the extension waits for the search to update visible (not dimmed) items - - Really reworked how all UI interactions are performed -- Added the ability to customize the command words for particular actions - - Visit the options page (click the extension icon) to set these -- Added a `store` command for storing items in the vault -- Added an `equip` command for directly equipping an item on your current character (when possible) - - This works like how `transfer` previously did, and `transfer` has been updated to only transfer, not equip -- (from above) `Transfer` now only transfers instead of equipping -- Added mic icon on page with a link to the website - - When listening, there will be text next to the icon that updates as the user speaks their command -- Added link to the [Voice DIM website](https://www.voicedim.com) via the `?` icon. -- Fixed `Start Farming mode` command if a user has at least 10 loadouts saved - -### 1.0.1 - 2022-08-23 - Corrected Shortcut - -- Defaulted the shortcut correctly (set to `Ctrl+Shift+0`) - -### 1.0.0 - 2022-08-19 - Initial Release - -- See [Reddit post](https://www.reddit.com/r/DestinyTheGame/comments/wseigx/interact_with_dim_using_your_voice/) about the available commands with more info - - Commands are available to: - - Transfer a weapon by name - - Transfer a weapon with particular perks - - Transfer a weapon by attribute (energy type, slot, ammo type, etc) - - Collect from the postmaster - - Start/Stop farming mode - - Equip loadouts by name - - Equip max power -- Use global shortcut to activate listening +### 1.2.6 - 2023-04-10 - Query selector updates + +- Update query selectors for `store` and `transfer` + +### 1.2.5 - 2023-02-27 - The Reversion + +- Revert previous change since it broke generic queries and item pulls (by weapon/energy type, etc.) + +### 1.2.4 - 2023-02-25 - The One Where IKELOS Weapons Maybe Work + +- Weapons with periods AND underscores (IKELOS weapons) are now parsed even better. +- If a weapon contains a shorthand for a weapon type (IKELOS SMG) is handled since the code no longer only performs one type of search or the other. It will do both types and if a weapon name was matched, it'll override any generic weapon search. + +### 1.2.3 - 2022-11-25 - Parsing Issues + +- Weapons with periods in their name (IKELOS weapons, a few others) are now parsed correctly +- Slight optimization for transferring weapons by name (no longer populates the search bar with `name:""`) + +### 1.2.2 - 2022-10-04 - Activation Phrase Fix + +- Added fix for capital letter in activation phrase by trimming/lowercasing everywhere + +### 1.2.1 - 2022-10-03 - Only in Inventory + +- Added fix for loading DIM on another tab. Previously required reloading the page on the inventory tab. Now Voice DIM will load no matter what page is started on +- Added fix for a user having the item popup sidebar being collapsed. + +### 1.2.0 - 2022-09-24 - Always Listening + +- Added a toggle-able `Always Listening` mode + - Each command must be prefixed with an activation phrase (defaulted to `okay ghost`) +- Added fix for `maxPower` command (didn't work in normal DIM, only in beta) +- Added fix for search already being populated when performing a command. + +### 1.1.3 - 2022-09-20 - Perk fix + +- Fixed perk matching + +### 1.1.2 - 2022-09-19 - Options page links + +- Added an `onInstalled` event for the extension. It'll direct users to the options page. +- Link to the options page from the `?` + +### 1.1.1 - 2022-09-16 - Better performance + +- Use a `waitForElement/waitForSearchToUpdate` function instead of arbitrarily sleeping in code + - Results in at least a 300% improvement in action duration + +### 1.1.0 - 2022-09-13 - The One with Custom Commands + +- Quite a few changes in this one +- Reworked how the extension waits for the search to update visible (not dimmed) items + - Really reworked how all UI interactions are performed +- Added the ability to customize the command words for particular actions + - Visit the options page (click the extension icon) to set these +- Added a `store` command for storing items in the vault +- Added an `equip` command for directly equipping an item on your current character (when possible) + - This works like how `transfer` previously did, and `transfer` has been updated to only transfer, not equip +- (from above) `Transfer` now only transfers instead of equipping +- Added mic icon on page with a link to the website + - When listening, there will be text next to the icon that updates as the user speaks their command +- Added link to the [Voice DIM website](https://www.voicedim.com) via the `?` icon. +- Fixed `Start Farming mode` command if a user has at least 10 loadouts saved + +### 1.0.1 - 2022-08-23 - Corrected Shortcut + +- Defaulted the shortcut correctly (set to `Ctrl+Shift+0`) + +### 1.0.0 - 2022-08-19 - Initial Release + +- See [Reddit post](https://www.reddit.com/r/DestinyTheGame/comments/wseigx/interact_with_dim_using_your_voice/) about the available commands with more info + - Commands are available to: + - Transfer a weapon by name + - Transfer a weapon with particular perks + - Transfer a weapon by attribute (energy type, slot, ammo type, etc) + - Collect from the postmaster + - Start/Stop farming mode + - Equip loadouts by name + - Equip max power +- Use global shortcut to activate listening diff --git a/package.json b/package.json index b97495f..140a481 100644 --- a/package.json +++ b/package.json @@ -1,49 +1,49 @@ -{ - "name": "voice-dim", - "version": "1.2.5", - "description": "Perform common DIM actions by using speech recognition.", - "main": "dist/chrome/js/voice-dim.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "zip": "npm run build && python scripts/build.py", - "build": "rimraf dist/ && webpack --env mode=production --config webpack.config.js", - "watch": "webpack --env mode=development --config webpack.config.js --progress --watch", - "update-version": "python scripts/update_version.py" - }, - "repository": { - "type": "git", - "url": "https://github.com/mlsof21/voice-dim.git" - }, - "keywords": [ - "Voice DIM", - "DIM Voice", - "Destiny", - "2", - "speech", - "recognition", - "voice" - ], - "author": "mlsof21", - "license": "ISC", - "bugs": { - "url": "https://github.com/mlsof21/voice-dim/issues" - }, - "homepage": "https://github.com/mlsof21/voice-dim#readme", - "dependencies": { - "annyang": "^2.6.1", - "fuse.js": "^6.6.2" - }, - "devDependencies": { - "@types/annyang": "^2.6.2", - "@types/chrome": "^0.0.193", - "@types/web": "^0.0.1", - "@typescript/lib-dom": "npm:@types/web@^0.0.71", - "copy-webpack-plugin": "^11.0.0", - "rimraf": "^3.0.2", - "ts-loader": "^9.3.1", - "typescript": "^4.7.4", - "webpack": "^5.74.0", - "webpack-cli": "^4.10.0", - "webpack-visualizer-plugin2": "^1.0.0" - } -} +{ + "name": "voice-dim", + "version": "1.2.6", + "description": "Perform common DIM actions by using speech recognition.", + "main": "dist/chrome/js/voice-dim.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "zip": "npm run build && python scripts/build.py", + "build": "rimraf dist/ && webpack --env mode=production --config webpack.config.js", + "watch": "webpack --env mode=development --config webpack.config.js --progress --watch", + "update-version": "python scripts/update_version.py" + }, + "repository": { + "type": "git", + "url": "https://github.com/mlsof21/voice-dim.git" + }, + "keywords": [ + "Voice DIM", + "DIM Voice", + "Destiny", + "2", + "speech", + "recognition", + "voice" + ], + "author": "mlsof21", + "license": "ISC", + "bugs": { + "url": "https://github.com/mlsof21/voice-dim/issues" + }, + "homepage": "https://github.com/mlsof21/voice-dim#readme", + "dependencies": { + "annyang": "^2.6.1", + "fuse.js": "^6.6.2" + }, + "devDependencies": { + "@types/annyang": "^2.6.2", + "@types/chrome": "^0.0.193", + "@types/web": "^0.0.1", + "@typescript/lib-dom": "npm:@types/web@^0.0.71", + "copy-webpack-plugin": "^11.0.0", + "rimraf": "^3.0.2", + "ts-loader": "^9.3.1", + "typescript": "^4.7.4", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0", + "webpack-visualizer-plugin2": "^1.0.0" + } +} diff --git a/public/manifest.chrome.json b/public/manifest.chrome.json index 75f3a18..6bd0fc1 100644 --- a/public/manifest.chrome.json +++ b/public/manifest.chrome.json @@ -1,47 +1,47 @@ -{ - "name": "Voice DIM", - "description": "Control DIM with your voice.", - "version": "1.2.5", - "manifest_version": 3, - "background": { - "service_worker": "js/background.js" - }, - "content_scripts": [ - { - "matches": ["https://*.destinyitemmanager.com/*"], - "js": ["js/voiceDim.js"], - "css": ["css/voiceDim.css"] - } - ], - "commands": { - "dim-listen": { - "suggested_key": { - "default": "Ctrl+Shift+0" - }, - "description": "Start/Stop listening for DIM commands", - "global": true - } - }, - "action": { - "default_icon": "icons/icon_128.png", - "default_title": "Voice DIM" - }, - "icons": { - "16": "icons/icon_16.png", - "32": "icons/icon_32.png", - "48": "icons/icon_48.png", - "128": "icons/icon_128.png" - }, - "options_ui": { - "page": "html/options.html", - "open_in_tab": true - }, - "host_permissions": ["https://www.bungie.net/*"], - "permissions": ["tabs", "storage"], - "web_accessible_resources": [ - { - "resources": ["icons/icon_large.png"], - "matches": ["https://*.destinyitemmanager.com/*"] - } - ] -} +{ + "name": "Voice DIM", + "description": "Control DIM with your voice.", + "version": "1.2.6", + "manifest_version": 3, + "background": { + "service_worker": "js/background.js" + }, + "content_scripts": [ + { + "matches": ["https://*.destinyitemmanager.com/*"], + "js": ["js/voiceDim.js"], + "css": ["css/voiceDim.css"] + } + ], + "commands": { + "dim-listen": { + "suggested_key": { + "default": "Ctrl+Shift+0" + }, + "description": "Start/Stop listening for DIM commands", + "global": true + } + }, + "action": { + "default_icon": "icons/icon_128.png", + "default_title": "Voice DIM" + }, + "icons": { + "16": "icons/icon_16.png", + "32": "icons/icon_32.png", + "48": "icons/icon_48.png", + "128": "icons/icon_128.png" + }, + "options_ui": { + "page": "html/options.html", + "open_in_tab": true + }, + "host_permissions": ["https://www.bungie.net/*"], + "permissions": ["tabs", "storage"], + "web_accessible_resources": [ + { + "resources": ["icons/icon_large.png"], + "matches": ["https://*.destinyitemmanager.com/*"] + } + ] +} diff --git a/public/manifest.firefox.json b/public/manifest.firefox.json index 2c9dbed..eced172 100644 --- a/public/manifest.firefox.json +++ b/public/manifest.firefox.json @@ -1,46 +1,46 @@ -{ - "name": "Voice DIM", - "description": "Control DIM with your voice.", - "version": "1.2.5", - "manifest_version": 2, - "background": { - "scripts": ["js/background.js"] - }, - "content_scripts": [ - { - "matches": ["https://*.destinyitemmanager.com/*"], - "js": ["js/voiceDim.js"], - "css": ["css/voiceDim.css"] - } - ], - "commands": { - "dim-listen": { - "suggested_key": { - "default": "Ctrl+Shift+0" - }, - "description": "Start/Stop listening for DIM commands" - } - }, - "browser_action": { - "default_icon": "icons/icon_128.png", - "default_title": "Voice DIM" - }, - "icons": { - "16": "icons/icon_16.png", - "32": "icons/icon_32.png", - "48": "icons/icon_48.png", - "128": "icons/icon_128.png" - }, - "options_ui": { - "page": "html/options.html", - "open_in_tab": true - }, - "permissions": [ - "tabs", - "storage", - "https://www.bungie.net/Platform/Destiny2/Manifest", - "https://www.bungie.net/common/**", - "https://api.speechly.com/**" - ], - "web_accessible_resources": ["icons/icon_large.png"] -} +{ + "name": "Voice DIM", + "description": "Control DIM with your voice.", + "version": "1.2.6", + "manifest_version": 2, + "background": { + "scripts": ["js/background.js"] + }, + "content_scripts": [ + { + "matches": ["https://*.destinyitemmanager.com/*"], + "js": ["js/voiceDim.js"], + "css": ["css/voiceDim.css"] + } + ], + "commands": { + "dim-listen": { + "suggested_key": { + "default": "Ctrl+Shift+0" + }, + "description": "Start/Stop listening for DIM commands" + } + }, + "browser_action": { + "default_icon": "icons/icon_128.png", + "default_title": "Voice DIM" + }, + "icons": { + "16": "icons/icon_16.png", + "32": "icons/icon_32.png", + "48": "icons/icon_48.png", + "128": "icons/icon_128.png" + }, + "options_ui": { + "page": "html/options.html", + "open_in_tab": true + }, + "permissions": [ + "tabs", + "storage", + "https://www.bungie.net/Platform/Destiny2/Manifest", + "https://www.bungie.net/common/**", + "https://api.speechly.com/**" + ], + "web_accessible_resources": ["icons/icon_large.png"] +} diff --git a/src/ts/voiceDim.ts b/src/ts/voiceDim.ts index 5e99407..78b428d 100644 --- a/src/ts/voiceDim.ts +++ b/src/ts/voiceDim.ts @@ -221,11 +221,12 @@ async function handleStoreItem(query: string) { // await populateSearchBar(`name:"${itemToStore?.match}"`); const itemDiv = availableItems[itemToStore.match].item; itemDiv?.dispatchEvent(uiEvents.singleClick); - const vaultDiv = await waitForElementToDisplay('.item-popup [title^="Vault"]'); + const vaultDiv = await waitForElementToDisplay('.item-popup [title*="vault"]'); vaultDiv?.dispatchEvent(uiEvents.singleClick); await clearSearchBar(); } +// TODO: probably don't need this anymore function getCurrentCharacterClass(): string { const currentCharacter = document.querySelector('.character.current'); if (currentCharacter?.innerHTML.includes('Titan')) { @@ -293,12 +294,11 @@ async function getItemToMove(query: string): Promise { async function transferItem(item: Element) { item.dispatchEvent(uiEvents.singleClick); - const currentClass = getCurrentCharacterClass(); - const expandCollapseButton = await waitForElementToDisplay('div[title^="Expand or collapse"]'); - if (!document.querySelector('div[title^="Store"]')) { + const expandCollapseButton = await waitForElementToDisplay('.item-popup [title^="Expand or collapse"]'); + if (!document.querySelector(".item-popup [title*='[P]']")) { expandCollapseButton?.dispatchEvent(uiEvents.singleClick); } - const storeDiv = await waitForElementToDisplay(`[title^="Store"] [data-icon*="${currentClass}"]`, 500); + const storeDiv = await waitForElementToDisplay(".item-popup [title*='[P]']", 500); storeDiv?.dispatchEvent(uiEvents.singleClick); } @@ -400,8 +400,6 @@ async function handleCollectPostmaster() { null ).singleNodeValue; postmasterButton?.dispatchEvent(uiEvents.singleClick); - await sleep(500); - postmasterButton?.dispatchEvent(uiEvents.singleClick); } function checkForGenericTerms(queries: Record, query: string) {