From: Steinar H. Gunderson Date: Sat, 18 Mar 2023 15:28:23 +0000 (+0100) Subject: Only show the infobox if there is room for all the text. X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=6de4bf1f755b62791d9721ee3a9cfcaed53e4571 Only show the infobox if there is room for all the text. --- diff --git a/files/pr0n-fullscreen.js b/files/pr0n-fullscreen.js index b431a3c..75ef1f8 100644 --- a/files/pr0n-fullscreen.js +++ b/files/pr0n-fullscreen.js @@ -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";