Skip to content

Commit

Permalink
Ctrl+E for viewing post engagements
Browse files Browse the repository at this point in the history
  • Loading branch information
mkobayashime committed Sep 13, 2023
1 parent f43168d commit a7f48c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion dist/twitter-shortcuts.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Twitter - Shortcuts
// @namespace mkobayashime
// @version 0.2.0
// @version 0.3.0
// @description Refined shortcuts in Twitter for web
// @author mkobayashime
// @homepage https://github.com/mkobayashime/userscripts
Expand Down Expand Up @@ -63,5 +63,12 @@ const config = {};
tabs[indexOfTabToClick].click();
}
}
if (e.ctrlKey && e.key === "e") {
const normalizedURL = `${window.location.origin}${window.location.pathname}`;
if (/^https:\/\/twitter\.com\/\S+\/status\/\d+$/.test(normalizedURL)) {
e.preventDefault();
window.location.href = `${normalizedURL}/likes`;
}
}
});
})(config);
2 changes: 1 addition & 1 deletion src/userscripts/meta/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const meta: { [name: string]: UserScriptMeta | undefined } = {
icon: "https://www.google.com/s2/favicons?domain=twitter.com",
match: "https://twitter.com/*",
name: "Twitter - Shortcuts",
version: "0.2.0",
version: "0.3.0",
},
"zoom-web-shortcuts": {
description: "Google Meet-like Ctrl-d/e shortcuts in Zoom",
Expand Down
8 changes: 8 additions & 0 deletions src/userscripts/twitter-shortcuts.user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ const config = {};
tabs[indexOfTabToClick].click();
}
}

if (e.ctrlKey && e.key === "e") {
const normalizedURL = `${window.location.origin}${window.location.pathname}`;
if (/^https:\/\/twitter\.com\/\S+\/status\/\d+$/.test(normalizedURL)) {
e.preventDefault();
window.location.href = `${normalizedURL}/likes`;
}
}
});
})(config);

Expand Down

0 comments on commit a7f48c5

Please sign in to comment.