weblib: do not allow click on last image
authorNiki Roo <niki@nikiroo.be>
Thu, 21 May 2020 08:35:14 +0000 (10:35 +0200)
committerNiki Roo <niki@nikiroo.be>
Thu, 21 May 2020 08:35:14 +0000 (10:35 +0200)
src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java
src/be/nikiroo/fanfix/library/web/templates/WebLibraryServerTemplates.java
src/be/nikiroo/fanfix/library/web/templates/viewer.image.nolink.html [new file with mode: 0644]

index 5310c7c104953fdf90ed9ee97b2c4a6cd8c222a6..524fea36182ed1874c3f7946e6d86fd3578e9801 100644 (file)
@@ -648,8 +648,10 @@ abstract class WebLibraryServerHtml implements Runnable {
                                        }
 
                                        viewerItem = templates.viewerImage(WebLibraryUrls
-                                                       .getStoryUrl(luid, chapter, paragraph), next,
-                                                       zoomStyle);
+                                                       .getStoryUrl(luid, chapter, paragraph), //
+                                                       disabledRight ? null : next, //
+                                                       zoomStyle //
+                                                       );
                                } else {
                                        viewerItem = templates.viewerText(null,
                                                        new TextOutput(false).convert(para));
index 59e7020c62fa6254ff3c20da3e0a4aa939031b22..cdc936ab6ce72a921233b9061d3579235795a1cf 100644 (file)
@@ -137,11 +137,13 @@ public class WebLibraryServerTemplates {
                ;
        }
 
+       // href NULL means no forward link
        public Template viewerImage(String src, String href, String zoomStyle) {
-               return new Template(getClass(), "viewer.image.html") //
-                               .set("src", src) //
-                               .set("href", href) //
-                               .set("zoomStyle", zoomStyle) //
+               return new Template(getClass(),
+                               href == null ? "viewer.image.nolink.html" : "viewer.image.html") //
+                                               .set("src", src) //
+                                               .set("href", href) //
+                                               .set("zoomStyle", zoomStyle) //
                ;
        }
 
diff --git a/src/be/nikiroo/fanfix/library/web/templates/viewer.image.nolink.html b/src/be/nikiroo/fanfix/library/web/templates/viewer.image.nolink.html
new file mode 100644 (file)
index 0000000..64483c9
--- /dev/null
@@ -0,0 +1,5 @@
+               <div 
+                 class='viewer' 
+                 oncontextmenu='document.getElementById("previous").click(); return false;'>
+                       <img class='viewer img' style='${zoomStyle}' src='${src}'/>
+               </div>