Skip to content

Commit

Permalink
Add navigateToLeftMenuItem function written by @mdbraber #239
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Jan 24, 2023
1 parent 235a59f commit aea6941
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/todoist-shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,21 @@
}
}

// Navigate to left menu item based on ID (`today`, `upcoming`, etc).
// eslint-disable-next-line no-unused-vars
function navigateToLeftMenuItem(itemId) {
return () => {
const sections = ['top', 'favorites', 'projects'];
withLeftMenuItems(sections, (menuItems, current) => {
for (const menuItem of menuItems) {
if (menuItem.href.indexOf(itemId) > 0) {
click(menuItem);
}
}
});
};
}

// Cycles down through menu items.
function nextLeftMenuItem() {
withLeftMenuItems((menuItems, current) => {
Expand Down

0 comments on commit aea6941

Please sign in to comment.