diff options
| author | Michael Peter Christen <mc@yacy.net> | 2026-01-03 02:55:13 +0100 |
|---|---|---|
| committer | Michael Peter Christen <mc@yacy.net> | 2026-01-03 02:55:13 +0100 |
| commit | e2d0050a1c15df8fda56edb5bc559d84149e6633 (patch) | |
| tree | 86c90e82408efad8993108c1b5bcb2028b51514e /htroot/js | |
| parent | 5645c3c55deba7a15033ee3d13c173eac44877d8 (diff) | |
Fix image preview licensing and show 20 images per page, fixes
https://github.com/yacy/yacy_search_server/issues/438
Use separate one‑time licenses for image thumbnails and full previews to
prevent preview failures after thumbnail loads, and set the Images tab
to request 20 results by default via the content‑domain switch form.
Diffstat (limited to 'htroot/js')
| -rw-r--r-- | htroot/js/yacysearch.js | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js index dc9a19868..aaf317ff2 100644 --- a/htroot/js/yacysearch.js +++ b/htroot/js/yacysearch.js @@ -294,10 +294,32 @@ function toggleMoreTags(button, moreTagsId) { * {HTMLImageElement} the html img element that could not be rendered */ function handleResultThumbError(imgElem) { + if (imgElem == null) { + return; + } + var stage = imgElem.getAttribute("data-error-stage") || "0"; + if (stage === "0") { + var original = imgElem.getAttribute("data-original"); + if (original && imgElem.src !== original) { + imgElem.setAttribute("data-error-stage", "1"); + imgElem.src = original; + return; + } + } + if (stage === "1") { + var fallback = imgElem.getAttribute("data-fallback"); + if (fallback && imgElem.src.indexOf(fallback) < 0) { + imgElem.setAttribute("data-error-stage", "2"); + imgElem.src = fallback; + return; + } + } if (imgElem.parentNode != null && imgElem.parentNode.parentNode != null - && imgElem.parentNode.parentNode.className == "thumbcontainer") { - /* Hide the thumbnail container */ - imgElem.parentNode.parentNode.className = "thumbcontainer thumbError hidden"; + && imgElem.parentNode.parentNode.className.indexOf("thumbcontainer") >= 0) { + /* Keep the thumbnail container visible, but mark it as failed */ + if (imgElem.parentNode.parentNode.className.indexOf("thumbError") < 0) { + imgElem.parentNode.parentNode.className += " thumbError"; + } var errorsInfoElem = document.getElementById("imageErrorsInfo"); if (errorsInfoElem != null && errorsInfoElem.className.indexOf("hidden") >= 0) { /* Show the image errors information block */ @@ -348,4 +370,4 @@ function hideErrThumbnails() { if(hideBtn != null) { hideBtn.className = hideBtn.className + " hidden"; } -}
\ No newline at end of file +} |
