@@ -203,6 +203,7 @@ function updateCurrentStatusDirect(data) {
203203 }
204204 let total = num_current_gens + num_models_loading + num_live_gens + num_backends_waiting ;
205205 getRequiredElementById ( 'interrupt_button' ) . classList . toggle ( 'interrupt-button-none' , total == 0 ) ;
206+ getRequiredElementById ( 'alt_interrupt_button' ) . classList . toggle ( 'interrupt-button-none' , total == 0 ) ;
206207 let elem = getRequiredElementById ( 'num_jobs_span' ) ;
207208 function autoBlock ( num , text ) {
208209 if ( num == 0 ) {
@@ -443,6 +444,9 @@ function genToolsList() {
443444 let generateButton = getRequiredElementById ( 'generate_button' ) ;
444445 let generateButtonRawText = generateButton . innerText ;
445446 let generateButtonRawOnClick = generateButton . onclick ;
447+ let altGenerateButton = getRequiredElementById ( 'alt_generate_button' ) ;
448+ let altGenerateButtonRawText = generateButton . innerText ;
449+ let altGenerateButtonRawOnClick = generateButton . onclick ;
446450 toolSelector . value = '' ;
447451 // TODO: Dynamic-from-server option list generation
448452 toolSelector . addEventListener ( 'change' , ( ) => {
@@ -451,6 +455,8 @@ function genToolsList() {
451455 }
452456 generateButton . innerText = generateButtonRawText ;
453457 generateButton . onclick = generateButtonRawOnClick ;
458+ altGenerateButton . innerText = altGenerateButtonRawText ;
459+ altGenerateButton . onclick = altGenerateButtonRawOnClick ;
454460 let tool = toolSelector . value ;
455461 if ( tool == '' ) {
456462 return ;
@@ -461,6 +467,8 @@ function genToolsList() {
461467 if ( override ) {
462468 generateButton . innerText = override . text ;
463469 generateButton . onclick = override . run ;
470+ altGenerateButton . innerText = override . text ;
471+ altGenerateButton . onclick = override . run ;
464472 }
465473 } ) ;
466474}
@@ -520,6 +528,8 @@ function pageSizer() {
520528 let currentImageBatch = getRequiredElementById ( 'current_image_batch' ) ;
521529 let midSplitButton = getRequiredElementById ( 't2i-mid-split-quickbutton' ) ;
522530 let topSplitButton = getRequiredElementById ( 't2i-top-split-quickbutton' ) ;
531+ let altRegion = getRequiredElementById ( 'alt_prompt_region' ) ;
532+ let altText = getRequiredElementById ( 'alt_prompt_textbox' ) ;
523533 let topDrag = false ;
524534 let topDrag2 = false ;
525535 let midDrag = false ;
@@ -532,19 +542,23 @@ function pageSizer() {
532542 inputSidebar . style . width = `${ barTopLeft } ` ;
533543 mainInputsAreaWrapper . style . width = `${ barTopLeft } ` ;
534544 inputSidebar . style . display = leftShut ? 'none' : '' ;
545+ altRegion . style . display = leftShut ? 'block' : 'none' ;
546+ altRegion . style . width = `calc(100vw - ${ barTopLeft } - ${ barTopRight } - 10px)` ;
535547 mainImageArea . style . width = `calc(100vw - ${ barTopLeft } )` ;
548+ altText . style . width = `calc(100vw - ${ barTopLeft } - ${ barTopRight } - 15rem)` ;
536549 currentImage . style . width = `calc(100vw - ${ barTopLeft } - ${ barTopRight } - 10px)` ;
537550 currentImageBatch . style . width = `${ barTopRight } ` ;
538551 topSplitButton . innerHTML = leftShut ? '⇛' : '⇚' ;
539552 midSplitButton . innerHTML = midForceToBottom ? '⤊' : '⤋' ;
553+ let altHeight = leftShut ? `(${ altText . offsetHeight } px + 2rem)` :'0px' ;
540554 if ( pageBarMid != - 1 || midForceToBottom ) {
541555 let fixed = midForceToBottom ? `9rem` : `${ pageBarMid } px` ;
542556 topSplit . style . height = `calc(100vh - ${ fixed } )` ;
543557 topSplit2 . style . height = `calc(100vh - ${ fixed } )` ;
544558 inputSidebar . style . height = `calc(100vh - ${ fixed } )` ;
545559 mainInputsAreaWrapper . style . height = `calc(100vh - ${ fixed } - 7rem)` ;
546560 mainImageArea . style . height = `calc(100vh - ${ fixed } )` ;
547- currentImage . style . height = `calc(100vh - ${ fixed } )` ;
561+ currentImage . style . height = `calc(100vh - ${ fixed } - ${ altHeight } )` ;
548562 currentImageBatch . style . height = `calc(100vh - ${ fixed } - 2rem)` ;
549563 topBar . style . height = `calc(100vh - ${ fixed } )` ;
550564 bottomBarContent . style . height = `calc(${ fixed } - 2rem)` ;
@@ -555,7 +569,7 @@ function pageSizer() {
555569 inputSidebar . style . height = '' ;
556570 mainInputsAreaWrapper . style . height = '' ;
557571 mainImageArea . style . height = '' ;
558- currentImage . style . height = '' ;
572+ currentImage . style . height = `calc(49vh - ${ altHeight } )` ;
559573 currentImageBatch . style . height = '' ;
560574 topBar . style . height = '' ;
561575 bottomBarContent . style . height = '' ;
@@ -606,6 +620,7 @@ function pageSizer() {
606620 pageBarTop = Math . max ( pageBarTop , 400 ) ;
607621 setPageBars ( ) ;
608622 e . preventDefault ( ) ;
623+ altText . dispatchEvent ( new Event ( 'input' ) ) ;
609624 } , true ) ;
610625 document . addEventListener ( 'mousemove' , ( e ) => {
611626 let offX = e . pageX ;
@@ -637,6 +652,39 @@ function pageSizer() {
637652 setPageBars ( ) ;
638653 } ) ;
639654 }
655+ altText . addEventListener ( 'keydown' , ( e ) => {
656+ if ( e . key == 'Enter' && ! e . shiftKey ) {
657+ altText . dispatchEvent ( new Event ( 'change' ) ) ;
658+ getRequiredElementById ( 'alt_generate_button' ) . click ( ) ;
659+ e . preventDefault ( ) ;
660+ e . stopPropagation ( ) ;
661+ return false ;
662+ }
663+ } ) ;
664+ altText . addEventListener ( 'change' , ( e ) => {
665+ let inputPrompt = document . getElementById ( 'input_prompt' ) ;
666+ if ( inputPrompt ) {
667+ inputPrompt . value = altText . value ;
668+ }
669+ setCookie ( `lastparam_input_prompt` , altText . value , 0.25 ) ;
670+ } ) ;
671+ function altTextSize ( ) {
672+ altText . style . height = 'auto' ;
673+ altText . style . height = `${ altText . scrollHeight + 5 } px` ;
674+ altRegion . style . top = `calc(-${ altText . offsetHeight } px - 2rem)` ;
675+ }
676+ altText . addEventListener ( 'input' , ( ) => {
677+ altTextSize ( ) ;
678+ setCookie ( `lastparam_input_prompt` , altText . value , 0.25 ) ;
679+ setPageBars ( ) ;
680+ } ) ;
681+ altTextSize ( ) ;
682+ function altPromptSizeHandle ( ) {
683+ altRegion . style . top = `calc(-${ altText . offsetHeight } px - 2rem)` ;
684+ setPageBars ( ) ;
685+ }
686+ altPromptSizeHandle ( ) ;
687+ new ResizeObserver ( altPromptSizeHandle ) . observe ( altText ) ;
640688}
641689
642690function show_t2i_quicktools ( ) {
0 commit comments