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

Update for new babbel version #31

Merged
merged 5 commits into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/scripts/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ let button, helpLink;

//waits for DOM to load the review button and then injects `Sync with Anki` button into web page.
function injectSyncButton() {
const reviewButtonNodeList = document.querySelectorAll("button[href*='review?'][color='primary-emphasis']")
const buttonPrimaryEmphasis = "button[href*='review?'][color='primary-emphasis']"
const buttonSecondaryDefault = "button[href*='review?'][color='secondary-default']"

const reviewButtonNodeList = document.querySelectorAll(buttonPrimaryEmphasis + "," + buttonSecondaryDefault)

if (reviewButtonNodeList && reviewButtonNodeList.length === 1) {
const parent = reviewButtonNodeList[0].parentElement;
const sibling = reviewButtonNodeList[0];
Expand Down Expand Up @@ -59,7 +63,7 @@ async function syncHandler() {
}

const state = JSON.parse(sessionStorage.getItem('review_manager_state'))
const learnedItems = state.learnedItems.data
const learnedItems = Object.values(state.learnedItems.allItems)
console.log('Sending ', learnedItems.length, ' words to Anki. Might take a minute or two to load images and sounds for every word')
sendVocabularyToAnki(learnedItems)
}
Expand Down
Loading