From 8e17e962264901d20ed8cb9861d49b693bae83fe Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 26 Jun 2021 14:31:52 +0100 Subject: [PATCH] fix thumbnails for direct loaded dicoms --- js/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/main.js b/js/main.js index 80ba29c..44ceb90 100644 --- a/js/main.js +++ b/js/main.js @@ -963,7 +963,8 @@ async function loadQuestion(n, section = 1, force_reload = false) { $("#figure-" + id).append(img); // otherwise try to load it as a dicom (if it starts with data) - } else if (based_img.startsWith("data:")) { + // or ends with dcm + } else if (based_img.startsWith("data:") || based_img.endsWith(".dcm") || /(?:\/|^)[^.\/]+$/.test(based_img)) { // convert the data url to a file viewer .urltoFile(based_img, "dicom", "application/dicom") @@ -975,9 +976,8 @@ async function loadQuestion(n, section = 1, force_reload = false) { const img = $("
").get(0); img.id = "thumb-" + id; img.class = "thumbnail"; - img.title = - //"Click on the thumbnail to view and manipulate the image."; - img.draggable = "false"; + img.title = "Click on the thumbnail to view and manipulate the image."; + img.draggable = "false"; img.style = "height: 100px; width: 100px"; $("#figure-" + id).append(img); const element = document.getElementById("thumb-" + id);