X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=files%2Fpr0n-fullscreen.js;h=ecabed06e0e60a6dad8d1b2b48ee65dc785db935;hb=7f954ef5ec86c9ab790a89a9c153190bedfea54c;hp=b431a3c33a1a9f42adadb79545b6d29a8fca6150;hpb=c8c8d4ba8a2e5a3c8b6a6b787a354f72c29964e2;p=pr0n diff --git a/files/pr0n-fullscreen.js b/files/pr0n-fullscreen.js index b431a3c..ecabed0 100644 --- a/files/pr0n-fullscreen.js +++ b/files/pr0n-fullscreen.js @@ -135,8 +135,8 @@ function display_image(url, backend_width, backend_height, elem_id, offset) // scroll offset completely off. img.style.display = 'none'; setTimeout(function() { + img.style.display = null; // Must be done before position_image(), for measurement. position_image(img, backend_width, backend_height, offset, false); - img.style.display = null; }, 1); } } @@ -164,8 +164,8 @@ function display_infobox(html, backend_width, backend_height, elem_id, offset) // scroll offset completely off. box.style.display = 'none'; setTimeout(function() { + box.style.display = null; // Must be done before position_image(), for measurement. position_image(box, backend_width, backend_height, offset, true); - box.style.display = null; }, 1); } } @@ -274,9 +274,13 @@ function position_image(img, backend_width, backend_height, offset, box) img.style.transform = "translate(" + extra_x_offset + "px,0px)"; if (box) { - img.style.top = Math.min(top + height, screen_size[1] - 24) / dpr + "px"; - img.style.width = (width / dpr) + "px"; + img.style.top = Math.min(top + height, screen_size[1] - 24 * dpr) / dpr + "px"; img.style.height = "24px"; + img.style.width = null; + img.style.whiteSpace = 'nowrap'; + // 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"; @@ -311,7 +315,7 @@ function update_shown_images() // inum !== global_image_num + 1) { // to_remove.push(child); //} - if (inum !== global_image_num) { + if (inum !== global_image_num || (child.className === "fsbox" && !global_infobox)) { to_remove.push(child); } }