Update SpellCheck.plugin.js
This commit is contained in:
parent
ba7bc139f4
commit
8dc30b0bc9
|
@ -2,7 +2,7 @@
|
||||||
* @name SpellCheck
|
* @name SpellCheck
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.6.5
|
* @version 1.6.6
|
||||||
* @description Adds a Spell Check to all Message Inputs. Select a Word and Right Click it to add it to your Dictionary
|
* @description Adds a Spell Check to all Message Inputs. Select a Word and Right Click it to add it to your Dictionary
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -57,6 +57,8 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
} : (([Plugin, BDFDB]) => {
|
} : (([Plugin, BDFDB]) => {
|
||||||
var languages, dictionaries, langDictionaries, languageToasts, checkTimeout, currentText;
|
var languages, dictionaries, langDictionaries, languageToasts, checkTimeout, currentText;
|
||||||
|
|
||||||
|
const dictionaryLanguageIds = ["af", "bg", "cs", "da", "de", "el", "en", "es", "fr", "hr", "it", "nl", "pl", "pt-BR", "pt", "ru", "sv", "tr", "uk"];
|
||||||
|
|
||||||
return class SpellCheck extends Plugin {
|
return class SpellCheck extends Plugin {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
|
@ -95,22 +97,19 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStart () {
|
onStart () {
|
||||||
BDFDB.LibraryRequires.request("https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/SpellCheck/dic", (error, response, body) => {
|
languages = BDFDB.ObjectUtils.filter(BDFDB.LanguageUtils.languages, langId => dictionaryLanguageIds.includes(langId), true);
|
||||||
let dictionaryLanguageIds = Array.from(BDFDB.DOMUtils.create(body).querySelectorAll(`[href*="/mwittrien/BetterDiscordAddons/blob/master/Plugins/SpellCheck/dic/"]`)).map(n => n.innerText.split(".")[0]).filter(n => n);
|
|
||||||
languages = BDFDB.ObjectUtils.filter(BDFDB.LanguageUtils.languages, langId => dictionaryLanguageIds.includes(langId), true);
|
if (BDFDB.LibraryStores.SpellcheckStore && BDFDB.LibraryStores.SpellcheckStore.isEnabled()) BDFDB.LibraryModules.DispatchApiUtils.dispatch({type: "SPELLCHECK_TOGGLE"});
|
||||||
|
|
||||||
if (BDFDB.LibraryStores.SpellcheckStore && BDFDB.LibraryStores.SpellcheckStore.isEnabled()) BDFDB.LibraryModules.DispatchApiUtils.dispatch({type: "SPELLCHECK_TOGGLE"});
|
|
||||||
|
|
||||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||||
|
|
||||||
for (let key in this.settings.choices) {
|
for (let key in this.settings.choices) {
|
||||||
if (key == "dictionaryLanguage" && !languages[this.settings.choices[key]]) {
|
if (key == "dictionaryLanguage" && !languages[this.settings.choices[key]]) {
|
||||||
this.settings.choices[key] = "en";
|
this.settings.choices[key] = "en";
|
||||||
BDFDB.DataUtils.save(this.settings.choices[key], this, "choices", key);
|
BDFDB.DataUtils.save(this.settings.choices[key], this, "choices", key);
|
||||||
}
|
|
||||||
this.setDictionary(key, this.settings.choices[key]);
|
|
||||||
}
|
}
|
||||||
});
|
this.setDictionary(key, this.settings.choices[key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onStop () {
|
onStop () {
|
||||||
|
|
Loading…
Reference in New Issue