@@ -484,6 +484,7 @@ let pageBarTop = -1;
484484let pageBarTop2 = - 1 ;
485485let pageBarMid = - 1 ;
486486let midForceToBottom = localStorage . getItem ( 'barspot_midForceToBottom' ) == 'true' ;
487+ let leftShut = localStorage . getItem ( 'barspot_leftShut' ) == 'true' ;
487488
488489let setPageBarsFunc ;
489490
@@ -496,7 +497,10 @@ function resetPageSizer() {
496497 pageBarTop = - 1 ;
497498 pageBarTop2 = - 1 ;
498499 pageBarMid = - 1 ;
500+ midForceToBottom = false ;
501+ leftShut = false ;
499502 localStorage . removeItem ( 'barspot_midForceToBottom' ) ;
503+ localStorage . removeItem ( 'barspot_leftShut' ) ;
500504 setPageBarsFunc ( ) ;
501505 for ( let runnable of layoutResets ) {
502506 runnable ( ) ;
@@ -515,20 +519,23 @@ function pageSizer() {
515519 let currentImage = getRequiredElementById ( 'current_image' ) ;
516520 let currentImageBatch = getRequiredElementById ( 'current_image_batch' ) ;
517521 let midSplitButton = getRequiredElementById ( 't2i-mid-split-quickbutton' ) ;
522+ let topSplitButton = getRequiredElementById ( 't2i-top-split-quickbutton' ) ;
518523 let topDrag = false ;
519524 let topDrag2 = false ;
520525 let midDrag = false ;
521526 function setPageBars ( ) {
522527 setCookie ( 'barspot_pageBarTop' , pageBarTop , 365 ) ;
523528 setCookie ( 'barspot_pageBarTop2' , pageBarTop2 , 365 ) ;
524529 setCookie ( 'barspot_pageBarMidPx' , pageBarMid , 365 ) ;
525- let barTopLeft = pageBarTop == - 1 ? `28rem` : `${ pageBarTop } px` ;
530+ let barTopLeft = leftShut ? `0px` : pageBarTop == - 1 ? `28rem` : `${ pageBarTop } px` ;
526531 let barTopRight = pageBarTop2 == - 1 ? `21rem` : `${ pageBarTop2 } px` ;
527532 inputSidebar . style . width = `${ barTopLeft } ` ;
528533 mainInputsAreaWrapper . style . width = `${ barTopLeft } ` ;
534+ inputSidebar . style . display = leftShut ? 'none' : '' ;
529535 mainImageArea . style . width = `calc(100vw - ${ barTopLeft } )` ;
530536 currentImage . style . width = `calc(100vw - ${ barTopLeft } - ${ barTopRight } - 10px)` ;
531537 currentImageBatch . style . width = `${ barTopRight } ` ;
538+ topSplitButton . innerHTML = leftShut ? '⇛' : '⇚' ;
532539 midSplitButton . innerHTML = midForceToBottom ? '⤊' : '⤋' ;
533540 if ( pageBarMid != - 1 || midForceToBottom ) {
534541 let fixed = midForceToBottom ? `9rem` : `${ pageBarMid } px` ;
@@ -592,11 +599,20 @@ function pageSizer() {
592599 setPageBars ( ) ;
593600 e . preventDefault ( ) ;
594601 } , true ) ;
602+ topSplitButton . addEventListener ( 'click' , ( e ) => {
603+ topDrag = false ;
604+ leftShut = ! leftShut ;
605+ localStorage . setItem ( 'barspot_leftShut' , leftShut ) ;
606+ pageBarTop = Math . max ( pageBarTop , 400 ) ;
607+ setPageBars ( ) ;
608+ e . preventDefault ( ) ;
609+ } , true ) ;
595610 document . addEventListener ( 'mousemove' , ( e ) => {
596611 let offX = e . pageX ;
597612 offX = Math . min ( Math . max ( offX , 100 ) , window . innerWidth - 100 ) ;
598613 if ( topDrag ) {
599614 pageBarTop = offX - 5 ;
615+ leftShut = pageBarTop < 280 ;
600616 setPageBars ( ) ;
601617 }
602618 if ( topDrag2 ) {
0 commit comments