Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject Game Review button on chess.com #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

makaroni4
Copy link

Original issue: #14

It's a sample PR that adds a Lichess Game Review button on chess.com.

Since chess.com is a Vue app, we need to listen to DOM Mutations to inject the review button properly. PR adds a Lichess icon and correspondent manifest changes.

The review button triggers PGN copy via the sendMessage mechanism (same as the extension icon), that's why the handling logic is extracted into a function.

Here's how it looks like for small screens:

Screenshot 2024-08-14 at 22 07 26

And big screens:

Screenshot 2024-08-14 at 22 07 34

Happy to get any feedback, in the meantime anyone can use this version manually:

  1. Download the forked repo https://github.com/makaroni4/Chess.com_Analysis_Chrome_extension
  2. Go to chrome://extensions/
  3. Click "Load unpacked" and select the ext folder from a downloaded repo.
  4. 🍻

@@ -11,7 +11,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
.then(sendResponse);
return true;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Sorry about these changes, it's VS Code cleaning up trailing spaces 🧹

{
var logDebugMessages = false;
if (logDebugMessages) {
console.log(message);
}
}

function injectButton(buttonsContainer) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Does this logic deserver its own file?

@@ -1,13 +1,3 @@
function isChessComVersion2(url) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 An obsolete function 🧹

@@ -67,5 +67,20 @@
},
"permissions": [
"activeTab"
],
"web_accessible_resources": [
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shamp00
Copy link
Member

shamp00 commented Sep 10, 2024

This is amazing @makaroni4. Thanks so much! Sorry it's taken a while to look at your changes. I was in Iceland on holiday but I'll try to find some time this week to review and merge.

@makaroni4
Copy link
Author

Hey @shamp00 👋

The PR is just a PoC that injects the button on one game review page (only with people, not with bots, for example).

Wdyt about adding the fixed position button (in the bottom of the screen, for example) vs injecting a button in the sidebar menu? Let's align on this and I'll add this to all pages. Thank you for this extension, I use it every time I play chess now 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants