From 7aa3d6807f1e86b170f87295e45bbe65e85e0fe9 Mon Sep 17 00:00:00 2001
From: Rsl1122 404 Data was not found in cache
";
}
return HtmlUtils.replacePlaceholders(
- HtmlUtils.getHtmlStringFromResource("player.html"),
+ HtmlUtils.getStringFromResource("player.html"),
PlaceholderUtils.getInspectReplaceRules(data)
);
} catch (FileNotFoundException ex) {
@@ -71,7 +71,7 @@ public class DataRequestHandler {
return "404 Data was not found in cache
";
}
return HtmlUtils.replacePlaceholders(
- HtmlUtils.getHtmlStringFromResource("analysis.html"),
+ HtmlUtils.getStringFromResource("analysis.html"),
PlaceholderUtils.getAnalysisReplaceRules(analysisCache.getData())
);
} catch (FileNotFoundException ex) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/JavaScriptResponse.java b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/JavaScriptResponse.java
new file mode 100644
index 000000000..d5145e901
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/JavaScriptResponse.java
@@ -0,0 +1,25 @@
+package main.java.com.djrapitops.plan.ui.webserver.response;
+
+import main.java.com.djrapitops.plan.Log;
+import main.java.com.djrapitops.plan.utilities.HtmlUtils;
+
+import java.io.FileNotFoundException;
+import java.io.OutputStream;
+
+/**
+ * @author Rsl1122
+ * @since 3.5.2
+ */
+public class JavaScriptResponse extends Response {
+
+ public JavaScriptResponse(OutputStream output, String resource) {
+ super(output);
+ super.setHeader("HTTP/1.1 200 OK");
+ try {
+ super.setContent(HtmlUtils.getStringFromResource(resource));
+ } catch (FileNotFoundException e) {
+ Log.toLog(this.getClass().getName(), e);
+ super.setContent("");
+ }
+ }
+}
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java
index ca29dd44d..196bc866b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/HtmlUtils.java
@@ -21,7 +21,7 @@ public class HtmlUtils {
* @return
* @throws FileNotFoundException
*/
- public static String getHtmlStringFromResource(String fileName) throws FileNotFoundException {
+ public static String getStringFromResource(String fileName) throws FileNotFoundException {
InputStream resourceStream = null;
Scanner scanner = null;
try {
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java
index 2a71b03e8..ff057faa6 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java
@@ -90,7 +90,7 @@ public class ExportUtility {
if (!Settings.ANALYSIS_EXPORT.isTrue()) {
return;
}
- String inspectHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getHtmlStringFromResource("player.html"),
+ String inspectHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getStringFromResource("player.html"),
PlaceholderUtils.getInspectReplaceRules(userData));
File playerFolder = new File(playersFolder, userData.getName());
playerFolder.mkdir();
@@ -109,7 +109,7 @@ public class ExportUtility {
if (!Settings.ANALYSIS_EXPORT.isTrue()) {
return;
}
- String analysisHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getHtmlStringFromResource("analysis.html"),
+ String analysisHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getStringFromResource("analysis.html"),
PlaceholderUtils.getAnalysisReplaceRules(analysisData))
.replace(HtmlUtils.getInspectUrl(""), "../player/");
File analysisHtmlFile = new File(serverFolder, "index.html");
diff --git a/Plan/src/main/resources/analysis.html b/Plan/src/main/resources/analysis.html
index 78927aebe..dd115a49b 100644
--- a/Plan/src/main/resources/analysis.html
+++ b/Plan/src/main/resources/analysis.html
@@ -129,7 +129,7 @@
color: white;
background-color: #348e0f;
padding: 8px 14px;
- border-radius: 10px;
+ border-radius: 6px;
float: right;
}
.info-text {
@@ -155,7 +155,7 @@
border-style: solid;
border-color: #348e0f;
padding: 8px 14px;
- border-radius: 10px;
+ border-radius: 3px;
width: 95%;
}
.header-icon {
@@ -389,65 +389,8 @@
class="fa fa-crosshairs" aria-hidden="true"> Mob kills: %mobkills% | Deaths: %deaths%
Gamemode Usage
+ - - +