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<String, String> cookies,
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<String, String> cookies, String uri,
boolean disabledRight = false;
boolean disabledZoomReal = false;
boolean disabledZoomWidth = false;
+ boolean disabledZoomWidthLimited = false;
boolean disabledZoomHeight = false;
Template viewerItem = null;
}
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));
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 //
.bar.optionbar.s1 { padding-left: calc(50% - (1 * (64px + 5px) / 2)); }
.bar.optionbar.s4 { padding-left: calc(50% - (4 * (64px + 5px) / 2)); }
+.bar.optionbar.s5 { padding-left: calc(50% - (5 * (64px + 5px) / 2)); }
.bar.optionbar {
bottom: 0;
.bar .button.next { color: transparent; background-image: url('/arrow_right-32x32.png'); }
.bar .button.last { color: transparent; background-image: url('/arrow_double_right-32x32.png'); }
-.bar .button.back { color: transparent; background-image: url('/back-32x32.png'); }
-.bar .button.zoomreal { color: transparent; background-image: url('/actual_size-32x32.png'); }
-.bar .button.zoomwidth { color: transparent; background-image: url('/fit_to_width-32x32.png'); }
-.bar .button.zoomheight { color: transparent; background-image: url('/fit_to_height-32x32.png'); }
+.bar .button.back { color: transparent; background-image: url('/back-32x32.png'); }
+.bar .button.zoomreal { color: transparent; background-image: url('/actual_size-32x32.png'); }
+.bar .button.zoomwidth { color: transparent; background-image: url('/fit_to_width-32x32.png'); }
+.bar .button.zoomwidthlimited { color: transparent; background-image: url('/fit_to_width_limited-32x32.png'); }
+.bar .button.zoomheight { color: transparent; background-image: url('/fit_to_height-32x32.png'); }
.viewer {
padding-top: 64px;
color: #AAA391;
}
-@media(min-width: 800px) {
- .main {
+@media(min-width: 800px) {
+ .main:not(.fullscreen) {
max-width: 800px;
}
- .bar.navbar { padding-left: calc(400px - (5 * (64px + 5px) / 2)); }
+ .main:not(.fullscreen) .bar.navbar { padding-left: calc(400px - (5 * (64px + 5px) / 2)); }
- .bar.optionbar.s1 { padding-left: calc(400px - (1 * (64px + 5px) / 2)); }
- .bar.optionbar.s4 { padding-left: calc(400px - (4 * (64px + 5px) / 2)); }
+ .main:not(.fullscreen) .bar.optionbar.s1 { padding-left: calc(400px - (1 * (64px + 5px) / 2)); }
+ .main:not(.fullscreen) .bar.optionbar.s4 { padding-left: calc(400px - (4 * (64px + 5px) / 2)); }
+ .main:not(.fullscreen) .bar.optionbar.s5 { padding-left: calc(400px - (5 * (64px + 5px) / 2)); }
- .desc { flex-direction: row; }
- .desc .cover img {
+ .main:not(.fullscreen) .desc { flex-direction: row; }
+ .main:not(.fullscreen) .desc .cover img {
width: 200px;
padding-right: 10px;
}
;
}
- public Template index(boolean banner, List<Template> content) {
+ public Template index(boolean banner, boolean fullscreen,
+ List<Template> content) {
String favicon = "favicon.ico";
String icon = Instance.getInstance().getUiConfig()
.getString(UiConfig.PROGRAM_ICON);
Template index = new Template(getClass(), "index.html") //
.set("title", "Fanfix") //
.set("favicon", favicon) //
+ .set("mainClass", fullscreen ? "fullscreen" : "") //
.set("content", content) //
;
;
}
- // supported numberOfButtons = 4 or 1 or the moment
+ // supported numberOfButtons = 5 or 4 or 1 or the moment
public Template viewerOptionbar(int numberOfButtons,
List<Template> buttons) {
return new Template(getClass(), "viewer.optionbar.html") //
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
-<!--
- Copyright 2020 David ROULET
-
- This file is part of fanfix.
-
- fanfix is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- fanfix is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with fanfix. If not, see <https://www.gnu.org/licenses/>.
- ___________________________________________________________________________
-
- This website was coded by:
- A kangaroo.
- _ _
- (\\( \
- `.\-.)
- _...._ _,-" `-.
-\ ," `-._.- -.,-" . \
- \`. ," `.
- \ `-...__ / . .: y
- `._ ``-...__ / ,"```-._/
- `-._ ```-" | /_ //
- `.._ _ ; <_ \ //
- ``-.___ `. `-._ \ \ //
- `- < `. (\ _/)/ `.\/ //
- \ \ ` ^^^^^^^^^
- ___________________________________________________________________________
-
- -->
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>${title}</title>
- <link rel="stylesheet" type="text/css" href="/style.css" />
- <link rel="icon" type="image/x-icon" href="/${favicon}" />
-</head>
-<body>
- <div class='main'>