From 977f60a2bf84634a5343c8b244606ae9b4edda0b Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 20 May 2020 16:39:03 +0200 Subject: [PATCH] update from master --- library/Template.java | 9 +- library/WebLibraryServerHtml.java | 254 +++++++----------- library/web/WebLibraryServerIndex.java | 5 + library/web/package-info.java | 3 + .../templates/WebLibraryServerTemplates.java | 36 ++- library/web/templates/package-info.java | 3 + library/web/templates/viewer.html | 1 - 7 files changed, 139 insertions(+), 172 deletions(-) delete mode 100644 library/web/templates/viewer.html diff --git a/library/Template.java b/library/Template.java index 3536d5f..3ec9873 100644 --- a/library/Template.java +++ b/library/Template.java @@ -64,22 +64,27 @@ public class Template { i++; } - + InputStream in = IOUtils.openResource(location, name); return new ReplaceInputStream(in, from, to); } public synchronized Template set(String key, String value) { - values.put(key, value); + values.put(key, value == null ? "" : key); valuesTemplate.remove(key); valuesTemplateList.remove(key); return this; } public synchronized Template set(String key, Template value) { + if (value == null) { + return set(key, ""); + } + values.remove(key); valuesTemplate.put(key, value); valuesTemplateList.remove(key); + return this; } diff --git a/library/WebLibraryServerHtml.java b/library/WebLibraryServerHtml.java index 42ebead..d5ba533 100644 --- a/library/WebLibraryServerHtml.java +++ b/library/WebLibraryServerHtml.java @@ -16,7 +16,6 @@ import javax.net.ssl.SSLServerSocketFactory; import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.bundles.Config; -import be.nikiroo.fanfix.bundles.UiConfig; import be.nikiroo.fanfix.data.Chapter; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Paragraph; @@ -543,14 +542,13 @@ abstract class WebLibraryServerHtml implements Runnable { String first, previous, next, last; - String viewer = ""; - - String disabledLeft = ""; - String disabledRight = ""; - String disabledZoomReal = ""; - String disabledZoomWidth = ""; - String disabledZoomHeight = ""; + boolean disabledLeft = false; + boolean disabledRight = false; + boolean disabledZoomReal = false; + boolean disabledZoomWidth = false; + boolean disabledZoomHeight = false; + Template viewerItem = null; if (paragraph <= 0) { first = WebLibraryUrls.getViewUrl(luid, 0, null); previous = WebLibraryUrls.getViewUrl(luid, @@ -561,42 +559,37 @@ abstract class WebLibraryServerHtml implements Runnable { last = WebLibraryUrls.getViewUrl(luid, story.getChapters().size(), null); - String desc = ""; + Template desc = null; if (chapter <= 0) { - StringBuilder desclines = new StringBuilder(); + List