-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: master
Are you sure you want to change the base?
Conversation
@@ -11,7 +11,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { | |||
.then(sendResponse); | |||
return true; | |||
} | |||
|
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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 🙌 |
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:
And big screens:
Happy to get any feedback, in the meantime anyone can use this version manually:
ext
folder from a downloaded repo.