diff --git a/javascript/panoramaviewer-ext.js b/javascript/panoramaviewer-ext.js index dae82db..c0d29aa 100644 --- a/javascript/panoramaviewer-ext.js +++ b/javascript/panoramaviewer-ext.js @@ -4,12 +4,23 @@ const openpanorama = { let galImageDisp - +function panoGetCurrentTabId() { + let tabid = gradioApp().querySelector('#tabs button.selected').innerText + + //support for Vladimic1111 fork + switch (tabid) + { + case "From Text": return "txt2img"; break; + case "From Image": return "img2img"; break; + case "Process Image": return "Extras"; break; + case "Image Browser": return "Extras"; break; + } +} function panorama_here(phtml, mode, buttonId) { return async () => { try { - let tabContext = get_uiCurrentTab().innerText + let tabContext = panoGetCurrentTabId() let containerName switch (tabContext) { case "txt2img": @@ -42,7 +53,7 @@ function panorama_here(phtml, mode, buttonId) { } } } - break; + break; default: { console.warn("PanoramaViewer: Unsupported gallery: " + tabContext) return @@ -165,7 +176,7 @@ function panorama_gototab(tabname = "Panorama Viewer", tabsId = "tabs") { async function panorama_get_image_from_gallery(warnOnNoSelect) { - const curGal = gradioApp().querySelector('#tabs button.selected').innerText // get_uiCurrentTab() + const curGal = panoGetCurrentTabId() // get_uiCurrentTab() if ("Extras" === curGal) curGal = "extras" const buttons = gradioApp().querySelectorAll("#" + curGal + '_gallery .grid-container button img:not([src*="grid-"][src$=".png"])') // skip grid-img let button = gradioApp().querySelector("#" + curGal + "_gallery .grid-container button.selected img") @@ -915,7 +926,7 @@ function convertto_cubemap() { const stack = error.stack; const match = stack.match(/file=.*javascript\//) if (match) { - const scriptPath = window.location.href + match; + const scriptPath = window.location.origin +"/"+ match; // Vladim111 has noise in href. const workerPath = new URL('e2c.js', scriptPath).href; worker = new Worker(workerPath); }