MCPcopy Create free account
hub / github.com/Eltaurus-Lt/CourseDump2022 / toSettings

Method toSettings

menu.js:63–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 }
62
63 async toSettings() {
64 let current_settings = {
65 "download_media": this.DownloadMedia.checked,
66 "extra_fields": this.ExtraFields.checked,
67 "level_tags": this.LevelTags.checked,
68 "anki_import_prompt": this.AnkiPrompt.checked,
69
70 "learning_progress": this.LearningProgress.checked,
71 "alternative_answers": this.AlternativeAnswers.checked,
72 "learnable_meta": this.LearnableMeta.checked,
73 "learnable_ids": this.LearnableIds.checked,
74 "skip_media_download": this.SkipMedia.checked,
75 "course_metadata": this.CourseMeta.checked,
76
77 "videofiles_limit": this.Video.checked ? 'Infinity' : 0
78 };
79
80 for (const [setting, default_value] of Object.entries(default_settings)) {
81 if (!(setting in current_settings && current_settings[setting] !== 'undefined')) {
82 current_settings[setting] = default_value;
83 }
84 }
85
86 saveToStorage({ 'settings': current_settings });
87 }
88
89 async fromSettings() {
90 const settings = await loadSettings();

Callers 1

menu.jsFile · 0.80

Calls 1

saveToStorageFunction · 0.85

Tested by

no test coverage detected