Skip to content

Commit dac59b9

Browse files
committed
return progress percentage to title bar
1 parent 3a0d6b7 commit dac59b9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

javascript/progressbar.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ function formatTime(secs){
106106
}
107107
}
108108

109+
function setTitle(progress){
110+
var title = 'Stable Diffusion'
111+
112+
if(opts.show_progress_in_title && progress){
113+
title = '[' + progress.trim() + '] ' + title;
114+
}
115+
116+
if(document.title != title){
117+
document.title = title;
118+
}
119+
}
120+
121+
109122
function randomId(){
110123
return "task(" + Math.random().toString(36).slice(2, 7) + Math.random().toString(36).slice(2, 7) + Math.random().toString(36).slice(2, 7)+")"
111124
}
@@ -133,6 +146,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
133146
parentGallery.insertBefore(livePreview, gallery)
134147

135148
var removeProgressBar = function(){
149+
setTitle("")
136150
parentProgressbar.removeChild(divProgress)
137151
parentGallery.removeChild(livePreview)
138152
atEnd()
@@ -165,6 +179,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
165179
progressText += " " + res.textinfo
166180
}
167181

182+
setTitle(progressText)
168183
divInner.textContent = progressText
169184

170185
var elapsedFromStart = (new Date() - dateStart) / 1000

0 commit comments

Comments
 (0)