diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-01-18 10:20:47 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-01-18 10:20:47 +0000 |
commit | d8f8bcb821fa62e943eb95ee05b8a949317326fe (patch) | |
tree | 575c30c5de3be7f3337782cb007b077fc4ff17d6 /javascript | |
parent | dac59b9b073f86508d3ec787ff731af2e101fbcc (diff) | |
download | stable-diffusion-webui-gfx803-d8f8bcb821fa62e943eb95ee05b8a949317326fe.tar.gz stable-diffusion-webui-gfx803-d8f8bcb821fa62e943eb95ee05b8a949317326fe.tar.bz2 stable-diffusion-webui-gfx803-d8f8bcb821fa62e943eb95ee05b8a949317326fe.zip |
enable progressbar without gallery
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/progressbar.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js index b8473ebf..18c771a2 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -130,7 +130,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre var dateStart = new Date() var wasEverActive = false var parentProgressbar = progressbarContainer.parentNode - var parentGallery = gallery.parentNode + var parentGallery = gallery ? gallery.parentNode : null var divProgress = document.createElement('div') divProgress.className='progressDiv' @@ -141,14 +141,16 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre divProgress.appendChild(divInner) parentProgressbar.insertBefore(divProgress, progressbarContainer) - var livePreview = document.createElement('div') - livePreview.className='livePreview' - parentGallery.insertBefore(livePreview, gallery) + if(parentGallery){ + var livePreview = document.createElement('div') + livePreview.className='livePreview' + parentGallery.insertBefore(livePreview, gallery) + } var removeProgressBar = function(){ setTitle("") parentProgressbar.removeChild(divProgress) - parentGallery.removeChild(livePreview) + if(parentGallery) parentGallery.removeChild(livePreview) atEnd() } @@ -168,6 +170,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre progressText = "" divInner.style.width = ((res.progress || 0) * 100.0) + '%' + divInner.style.background = res.progress ? "" : "transparent" if(res.progress > 0){ progressText = ((res.progress || 0) * 100.0).toFixed(0) + '%' @@ -175,11 +178,15 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre if(res.eta){ progressText += " ETA: " + formatTime(res.eta) - } else if(res.textinfo){ - progressText += " " + res.textinfo } + setTitle(progressText) + + if(res.textinfo && res.textinfo.indexOf("\n") == -1){ + progressText = res.textinfo + " " + progressText + } + divInner.textContent = progressText var elapsedFromStart = (new Date() - dateStart) / 1000 @@ -197,8 +204,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre } - if(res.live_preview){ - + if(res.live_preview && gallery){ var rect = gallery.getBoundingClientRect() if(rect.width){ livePreview.style.width = rect.width + "px" |