mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 12:05:13 +01:00
Log user-added Scrips & Styles when they load in (#506)
This commit is contained in:
parent
cc50e05262
commit
2dd7a0a9c2
@ -203,8 +203,17 @@ public void setFrom(WebappConfig config) {
|
||||
}
|
||||
|
||||
public void addFrom(WebappConfig config) {
|
||||
this.scripts.addAll(config.getScripts());
|
||||
this.styles.addAll(config.getStyles());
|
||||
Set<String> scripts = config.getScripts();
|
||||
for (String script : scripts) {
|
||||
this.scripts.add(script);
|
||||
Logger.global.logDebug("Registering script from Webapp Config: " + script);
|
||||
}
|
||||
|
||||
Set<String> styles = config.getStyles();
|
||||
for (String style : styles) {
|
||||
this.styles.add(style);
|
||||
Logger.global.logDebug("Registering style from Webapp Config: " + style);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
import de.bluecolored.bluemap.api.WebApp;
|
||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.util.FileHelper;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@ -68,11 +69,13 @@ public boolean getPlayerVisibility(UUID player) {
|
||||
|
||||
@Override
|
||||
public void registerScript(String url) {
|
||||
Logger.global.logDebug("Registering script from API: " + url);
|
||||
plugin.getBlueMap().getWebFilesManager().getScripts().add(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStyle(String url) {
|
||||
Logger.global.logDebug("Registering style from API: " + url);
|
||||
plugin.getBlueMap().getWebFilesManager().getStyles().add(url);
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,7 @@ export class BlueMapApp {
|
||||
let styleElement = document.createElement("link");
|
||||
styleElement.rel = "stylesheet";
|
||||
styleElement.href = styleUrl;
|
||||
alert(this.events, "Loading style: " + styleUrl, "fine");
|
||||
document.head.appendChild(styleElement);
|
||||
}
|
||||
|
||||
@ -189,6 +190,7 @@ export class BlueMapApp {
|
||||
if (this.settings.scripts) for (let scriptUrl of this.settings.scripts) {
|
||||
let scriptElement = document.createElement("script");
|
||||
scriptElement.src = scriptUrl;
|
||||
alert(this.events, "Loading script: " + scriptUrl, "fine");
|
||||
document.body.appendChild(scriptElement);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user