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 5310c7c..524fea3 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 59e7020..cdc936a 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>