remove screenshot if screenshot not present

This commit is contained in:
WiredSpast 2021-08-20 19:53:00 +02:00 committed by GitHub
parent a2d65d01b9
commit a8e3ccd761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,8 +104,10 @@ public class StoreExtensionDetailsItem implements ContentItem {
contentBuilder.append("Warning: this extension has been marked unstable!\n");
}
contentBuilder.append("\n*Screenshot: *").append("\n")
.append("--img:").append(gExtensionStore.getRepository().getResourceUrl("store", "extensions", storeExtension.getTitle(), "screenshot.png"));
contentBuilder.append("<div>"
.append("\n*Screenshot: *").append("\n")
.append("--img:").append(gExtensionStore.getRepository().getResourceUrl("store", "extensions", storeExtension.getTitle(), "screenshot.png"))
.append("</div>");
return contentBuilder.toString();
}
@ -145,7 +147,7 @@ public class StoreExtensionDetailsItem implements ContentItem {
line = line.replaceAll("\\*([^*]*)\\*", "<b>$1</b>")
.replaceAll("_([^_<>]*)_", "<i>$1</i>")
.replaceAll("(^| |>)@([^ <>]*)($| |<)", "$1<u>$2</u>$3")
.replaceAll("--img:([^ ]*)", "<img src=\"$1\" alt=\"extension screenshot\">")
.replaceAll("--img:([^ ]*)", "<img src=\"$1\" alt=\"extension screenshot\" onerror=\"this.parentNode.remove()\">")
.replaceAll("--url:([^-]*)-(https?:[^ ]*)",
String.format("<a href=\"#\" onClick=\"%s.openUrl(&quot;$2&quot;)\">$1</a>", id));
// .replaceAll("([^\";])(https?:[^ ]*)",