fix txt and worker-urls so far

pull/34/head
GeorgLegato 2023-04-20 01:13:56 +02:00
parent adb9ae9d37
commit c8a049e0ea
1 changed files with 16 additions and 5 deletions

View File

@ -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);
}