]> git.sesse.net Git - pr0n/commitdiff
Only show the infobox if there is room for all the text.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 18 Mar 2023 15:28:23 +0000 (16:28 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 18 Mar 2023 15:28:23 +0000 (16:28 +0100)
files/pr0n-fullscreen.js

index b431a3c33a1a9f42adadb79545b6d29a8fca6150..75ef1f81ac49895bcb9e14e8d65b24cc28bf825b 100644 (file)
@@ -275,8 +275,14 @@ function position_image(img, backend_width, backend_height, offset, box)
 
        if (box) {
                img.style.top = Math.min(top + height, screen_size[1] - 24) / dpr + "px";
-               img.style.width = (width / dpr) + "px";
                img.style.height = "24px";
+               img.style.width = null;
+               img.style.whiteSpace = 'nowrap';
+               if (offset == 0) {
+                       // Hide the box if there's no room for all the text.
+                       img.style.opacity = (img.clientWidth < width / dpr + 10) ? null : 0.0;
+               }
+               img.style.width = (width / dpr) + "px";
        } else {
                img.style.top = (top / dpr) + "px";
                img.style.lineHeight = (height / dpr) + "px";