Improve styleloader, fix clearing emotes. (#506)
* improve styleloader for local development. * fix clearing emotes
This commit is contained in:
parent
db84e73f50
commit
3ab655594b
|
@ -62,7 +62,7 @@ export default new class EmoteModule extends Builtin {
|
|||
}
|
||||
|
||||
async enabled() {
|
||||
Settings.registerCollection("emotes", "Emotes", EmoteConfig, {title: Strings.Emotes.clearEmotes, onClick: this.resetEmotes});
|
||||
Settings.registerCollection("emotes", "Emotes", EmoteConfig, {title: Strings.Emotes.clearEmotes, onClick: this.resetEmotes.bind(this)});
|
||||
await this.getBlocklist();
|
||||
await this.loadEmoteData();
|
||||
|
||||
|
|
|
@ -124,12 +124,17 @@ export default new class Core {
|
|||
|
||||
async loadDependencies() {
|
||||
for (const data of this.dependencies) {
|
||||
if (Config.local && Config.localPath && data.localPath) {
|
||||
if (fs.existsSync(path.resolve(Config.localPath, data.localPath))) {
|
||||
const css = fs.readFileSync(path.resolve(Config.localPath, data.localPath)).toString();
|
||||
if (Config.local && Config.localPath && data.localPath && data.type == "style") {
|
||||
const stylepath = path.resolve(Config.localPath, data.localPath);
|
||||
if (fs.existsSync(stylepath)) {
|
||||
Logger.log("Startup", `Loading local stylesheet from (${stylepath})`);
|
||||
const css = fs.readFileSync(stylepath).toString();
|
||||
DOMManager.injectStyle(data.name, css);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
Logger.warn("Startup", "Local stylesheet was not found, loading remote...");
|
||||
}
|
||||
}
|
||||
const url = Utilities.formatString(data.url, {hash: Config.hash});
|
||||
Logger.log(`Startup`, `Loading Resource (${url})`);
|
||||
|
|
Loading…
Reference in New Issue