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

[pull] master from ClearlyKyle:master #2

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
078d611
Added option to save both types of example sentences, and another opt…
ClearlyKyle May 28, 2024
4b5563a
only gather screenshot data if we are actually going to use it with t…
ClearlyKyle Dec 1, 2024
ac4d6fa
only gather data for fields we will be saving to
ClearlyKyle Dec 1, 2024
8f339d5
word will always be highlighted in subtitle, and fix bug image field …
ClearlyKyle Dec 1, 2024
26ebfa7
dont create duplicate screenshots
ClearlyKyle Dec 2, 2024
f0b09ea
toggle console logging
ClearlyKyle Dec 3, 2024
8fb9459
removed unused function, prefer let over var
ClearlyKyle Dec 3, 2024
9f958ae
buttons are made once, less query when setting buttons
ClearlyKyle Dec 4, 2024
08b62e6
removed file
ClearlyKyle Dec 4, 2024
874637e
if no anki connect url is set, we use the default one
ClearlyKyle Dec 4, 2024
092eeb8
updated popup code
ClearlyKyle Dec 6, 2024
30f1c66
updated popup loading and saving settings
ClearlyKyle Dec 6, 2024
e616cd7
updated README possible errors
ClearlyKyle Dec 7, 2024
1969811
simplified the setting up of element naming for easier adding more op…
ClearlyKyle Dec 9, 2024
84ee663
mapping the adding options to dropdowns
ClearlyKyle Dec 9, 2024
35b372d
Promise.all now working
ClearlyKyle Dec 9, 2024
d1acb13
recording audio from video
ClearlyKyle May 29, 2024
bf7386c
audio field option
ClearlyKyle May 30, 2024
da19d3c
capturing audio
ClearlyKyle Oct 30, 2024
baf0396
capturing audio and sending to anki
ClearlyKyle Dec 2, 2024
54202a0
url should be set without ankiFieldScreenshotSelected being used
ClearlyKyle Dec 11, 2024
ff0f624
save only one audio file for a given sub
ClearlyKyle Dec 11, 2024
def0129
Collecting audio from Yotube videos, audio will only collected once p…
ClearlyKyle Dec 12, 2024
bb24518
improved word highlighting
ClearlyKyle Dec 14, 2024
a950451
bug fix for audio/screenshot data not being recreated if user makes a…
ClearlyKyle Dec 15, 2024
9610ffe
added Init and more consistent globals naming
ClearlyKyle Dec 15, 2024
332a3ce
updated README
ClearlyKyle Dec 17, 2024
6d8d396
fix bug with example sentences starting with "undefined"
ClearlyKyle Dec 17, 2024
c506301
Fix not saving model and deck values #8
ClearlyKyle Jan 3, 2025
ac118cd
Fix initializing empty saved words list
ClearlyKyle Jan 4, 2025
f333ecb
#9 fix Get_Video_URL not selecting video element for Netflix, was ret…
ClearlyKyle Feb 11, 2025
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
Prev Previous commit
Next Next commit
Promise.all now working
ClearlyKyle committed Dec 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 35b372d17d8ecdbc74f2a0b80a50a34963521a5c
23 changes: 13 additions & 10 deletions popup/popup.js
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ if (!CONSOLE_LOGGING)
// GLOBALS
//
let anki_url = 'http://localhost:8765';
let anki_field_data = {};
let anki_field_promises = {};
const anki_field_elements = {}; // saved elements, to reduce calls to getElementById

// These are the names of the field elements in the html, they must match!
@@ -95,7 +97,13 @@ function init()
});
});


anki_field_promises = anki_field_names.map((field_name) =>
{
return () =>
{
return Add_Options_To_Field_Dropdown_Promise(field_name, anki_field_data, anki_storage_values[field_name]);
};
});

chrome.storage.local.get(["ankiConnectUrl"], ({ ankiConnectUrl }) =>
{
@@ -232,19 +240,14 @@ function Update_Field_Dropdown()
{
const note_names_element = anki_field_elements.ankiNoteNameSelected;

// NOTE : if we switch to another note type that has the same named field, they will not be reset

Fetch_From_Anki(`{"action": "modelFieldNames","params":{"modelName":"${note_names_element.value}"}}`)
.then(async (data) =>
.then((data) =>
{
// NOTE : if we switch to another note type that has the same named field, they will not be reset
if (data.length)
{
// NOTE : is there a way to only generate this map once?
const anki_field_promises = anki_field_names.map((field_name) =>
{
console.log(`Dropdown '${field_name}', with set value '${anki_storage_values[field_name]}'`);
Add_Options_To_Field_Dropdown_Promise(field_name, data, anki_storage_values[field_name]);
});
anki_field_data = data;
Promise.all(anki_field_promises.map((func) => func()));
}
})
.catch(error => console.error("Unable to model fields", error));