From 6de4bf1f755b62791d9721ee3a9cfcaed53e4571 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 18 Mar 2023 16:28:23 +0100 Subject: [PATCH] Only show the infobox if there is room for all the text. --- files/pr0n-fullscreen.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"; -- 2.39.2