@@ -930,10 +930,6 @@ async function clickedOnFileHTML(fileEl, event) {
930930
931931 if ( isMobile ) { // if on mobile device
932932
933- // close sidebar
934- toggleSidebar ( false ) ;
935- saveSidebarStateLS ( ) ;
936-
937933 // update bottom float
938934 updateFloat ( ) ;
939935
@@ -1353,7 +1349,7 @@ async function loadFileInHTML(fileEl, fileSha) {
13531349
13541350 // if previous file selection exists in HTML
13551351 if ( prevSelFileEl ) {
1356-
1352+
13571353 // load previous selected file
13581354 loadFileInHTML ( prevSelFileEl , selectedFile . sha ) ;
13591355
@@ -1434,10 +1430,6 @@ async function loadFileInHTML(fileEl, fileSha) {
14341430 onNextFrame ( ( ) => {
14351431
14361432 liveView . classList . remove ( 'notransition' ) ;
1437-
1438- // close sidebar
1439- toggleSidebar ( false ) ;
1440- saveSidebarStateLS ( ) ;
14411433
14421434 // update bottom float
14431435 bottomFloat . classList . add ( 'file-open' ) ;
@@ -1490,16 +1482,8 @@ async function loadFileInHTML(fileEl, fileSha) {
14901482 // change codeit lang
14911483 cd . lang = selectedFile . lang ;
14921484
1493- if ( isMobile ) {
1494-
1495- // close sidebar
1496- toggleSidebar ( false ) ;
1497- saveSidebarStateLS ( ) ;
1498-
1499- // update bottom float
1500- updateFloat ( ) ;
1501-
1502- }
1485+ // update bottom float
1486+ if ( isMobile ) updateFloat ( ) ;
15031487
15041488 } catch ( e ) { // if file is binary
15051489
@@ -1588,11 +1572,6 @@ function loadBinaryFileHTML(file, toggled) {
15881572
15891573 liveView . classList . remove ( 'notransition' ) ;
15901574
1591- // close sidebar
1592- toggleSidebar ( false ) ;
1593- saveSidebarStateLS ( ) ;
1594-
1595- // update bottom float
15961575 updateFloat ( ) ;
15971576
15981577 } )
@@ -2646,10 +2625,6 @@ function createNewFileInHTML() {
26462625 // then open new file
26472626 window . setTimeout ( ( ) => {
26482627
2649- // close sidebar
2650- toggleSidebar ( false ) ;
2651- saveSidebarStateLS ( ) ;
2652-
26532628 // update bottom float
26542629 updateFloat ( ) ;
26552630
@@ -3018,20 +2993,10 @@ async function deleteModFileInHTML(fileEl) {
30182993 fileEl . classList . remove ( 'modified' ) ;
30192994
30202995 if ( fileEl . classList . contains ( 'selected' ) ) {
3021-
3022- const sidebarOpen = body . classList . contains ( 'expanded' ) ;
30232996
30242997 const scrollPos = selectedFile . scrollPos ;
30252998
30262999 await loadFileInHTML ( fileEl , fileSha ) ;
3027-
3028- if ( ! sidebarOpen ) {
3029-
3030- // close sidebar
3031- toggleSidebar ( false ) ;
3032- saveSidebarStateLS ( ) ;
3033-
3034- }
30353000
30363001 // prevent bottom float disappearing on mobile
30373002 if ( isMobile ) lastScrollTop = scrollPos [ 1 ] ;
@@ -3162,21 +3127,11 @@ async function protectUnsavedCode() {
31623127 // if new version of selected file exists
31633128 if ( selectedElName !== null ) {
31643129
3165- const sidebarOpen = body . classList . contains ( 'expanded' ) ;
3166-
31673130 const scrollPos = selectedFile . scrollPos ;
31683131
31693132 // load file
31703133 await loadFileInHTML ( selectedElName , getAttr ( selectedElName , 'sha' ) ) ;
31713134
3172- if ( ! sidebarOpen ) {
3173-
3174- // close sidebar
3175- toggleSidebar ( false ) ;
3176- saveSidebarStateLS ( ) ;
3177-
3178- }
3179-
31803135 // prevent bottom float disappearing on mobile
31813136 if ( isMobile ) lastScrollTop = scrollPos [ 1 ] ;
31823137
@@ -3190,19 +3145,9 @@ async function protectUnsavedCode() {
31903145 // if selected file isn't loaded
31913146 if ( selectedFile . sha !== getAttr ( selectedElSha , 'sha' ) ) {
31923147
3193- const sidebarOpen = body . classList . contains ( 'expanded' ) ;
3194-
31953148 // load file
31963149 loadFileInHTML ( selectedElSha , getAttr ( selectedElSha , 'sha' ) ) ;
31973150
3198- if ( ! sidebarOpen ) {
3199-
3200- // close sidebar
3201- toggleSidebar ( false ) ;
3202- saveSidebarStateLS ( ) ;
3203-
3204- }
3205-
32063151 }
32073152
32083153 }
@@ -3543,14 +3488,13 @@ function setupSidebar() {
35433488 // render sidebar
35443489 renderSidebarHTML ( ) ;
35453490
3546- // if sidebar is open in local storage
3491+ // if sidebar is open
35473492 if ( getStorage ( 'sidebar' ) == 'true'
35483493 && ! isEmbed ) {
35493494
35503495 // don't transition
35513496 body . classList . add ( 'notransition' ) ;
35523497
3553- // open sidebar
35543498 toggleSidebar ( true ) ;
35553499
35563500 onNextFrame ( ( ) => {
@@ -3561,9 +3505,6 @@ function setupSidebar() {
35613505
35623506 } else if ( isMobile ) {
35633507
3564- // close sidebar
3565- toggleSidebar ( false ) ;
3566-
35673508 // update bottom float
35683509 updateFloat ( ) ;
35693510
0 commit comments