X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FWebLibraryServerHtml.java;fp=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FWebLibraryServerHtml.java;h=93fec59a8a06eba81f51d5033c9021d45df5cee4;hp=524fea36182ed1874c3f7946e6d86fd3578e9801;hb=a1ddc9821aaf046b10914a57b0a806cfb3b0648a;hpb=b8b60b3217e62f1896cc3a57763bddd147474695 diff --git a/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java b/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java index 524fea3..93fec59 100644 --- a/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java +++ b/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java @@ -332,7 +332,8 @@ abstract class WebLibraryServerHtml implements Runnable { content.add(templates.login(uri)); return NanoHTTPD.newChunkedResponse(Status.FORBIDDEN, - NanoHTTPD.MIME_HTML, templates.index(true, content).read()); + NanoHTTPD.MIME_HTML, + templates.index(true, false, content).read()); } private Response root(IHTTPSession session, Map cookies, @@ -475,7 +476,7 @@ abstract class WebLibraryServerHtml implements Runnable { booklines.add(0, templates.browser(browser, filter, selects)); return newInputStreamResponse(NanoHTTPD.MIME_HTML, - templates.index(true, booklines).read()); + templates.index(true, false, booklines).read()); } private Response getViewer(Map cookies, String uri, @@ -552,6 +553,7 @@ abstract class WebLibraryServerHtml implements Runnable { boolean disabledRight = false; boolean disabledZoomReal = false; boolean disabledZoomWidth = false; + boolean disabledZoomWidthLimited = false; boolean disabledZoomHeight = false; Template viewerItem = null; @@ -629,29 +631,36 @@ abstract class WebLibraryServerHtml implements Runnable { } if (para.getType() == ParagraphType.IMAGE) { - String zoomStyle = "max-width: 100%;"; - disabledZoomWidth = true; + // default values: + String zoomStyle = "max-width: 800px;"; + disabledZoomWidthLimited = true; + String zoomOption = cookies.get("zoom"); if (zoomOption != null && !zoomOption.isEmpty()) { if (zoomOption.equals("real")) { zoomStyle = ""; - disabledZoomWidth = false; + disabledZoomWidthLimited = false; disabledZoomReal = true; + } else if (zoomOption.equals("widthlimited")) { + // default } else if (zoomOption.equals("width")) { - zoomStyle = "max-width: 100%;"; + zoomStyle = "width: 100%;"; + disabledZoomWidthLimited = false; + disabledZoomWidth = true; } else if (zoomOption.equals("height")) { // see height of navbar + optionbar zoomStyle = "max-height: calc(100% - 128px);"; - disabledZoomWidth = false; + disabledZoomWidthLimited = false; disabledZoomHeight = true; } } - viewerItem = templates.viewerImage(WebLibraryUrls - .getStoryUrl(luid, chapter, paragraph), // + viewerItem = templates.viewerImage( + WebLibraryUrls.getStoryUrl(luid, chapter, + paragraph), // disabledRight ? null : next, // zoomStyle // - ); + ); } else { viewerItem = templates.viewerText(null, new TextOutput(false).convert(para)); @@ -716,25 +725,29 @@ abstract class WebLibraryServerHtml implements Runnable { buttons.add(templates.viewerOptionbarButton( // "1:1", uri + "?optionName=zoom&optionValue=real", "zoomreal", disabledZoomReal)); + buttons.add(templates.viewerOptionbarButton( // + "]width[", + uri + "?optionName=zoom&optionValue=widthlimited", + "zoomwidthlimited", disabledZoomWidthLimited)); buttons.add(templates.viewerOptionbarButton( // "Width", uri + "?optionName=zoom&optionValue=width", "zoomwidth", disabledZoomWidth)); buttons.add(templates.viewerOptionbarButton( // "Height", uri + "?optionName=zoom&optionValue=height", - "zoomHeight", disabledZoomHeight)); + "zoomheight", disabledZoomHeight)); } // Optionbar Template optionbar = templates.viewerOptionbar( // - (paragraph > 0) ? 4 : 1, // + (paragraph > 0) ? 5 : 1, // buttons // ); // Full content return newInputStreamResponse(NanoHTTPD.MIME_HTML, // - templates.index(false, Arrays.asList( // + templates.index(false, (paragraph > 0), Arrays.asList( // navbar, // viewerItem, // optionbar //