@@ -76,6 +76,10 @@ async function renderSidebarHTML() {
7676
7777 // show repo name in sidebar
7878 sidebarLogo . innerText = repoName ;
79+
80+ // scroll to start of repo name
81+ sidebarLogo . scrollTo ( 0 , 0 ) ;
82+ scrolledSidebarTitle ( ) ;
7983
8084 // change header options
8185 header . classList . remove ( 'out-of-repo' ) ;
@@ -163,9 +167,16 @@ async function renderSidebarHTML() {
163167 treeLoc [ 1 ] = '' ;
164168 treeLoc [ 2 ] = '' ;
165169 saveTreeLocLS ( treeLoc ) ;
166-
170+
171+ // change sidebar title
172+ sidebarLogo . innerText = 'Repositories' ;
173+
174+ // scroll to start of repo name
175+ sidebarLogo . scrollTo ( 0 , 0 ) ;
176+ scrolledSidebarTitle ( ) ;
177+
167178 renderSidebarHTML ( ) ;
168-
179+
169180 return ;
170181
171182 }
@@ -195,6 +206,10 @@ async function renderSidebarHTML() {
195206
196207 // show repo name in sidebar
197208 sidebarLogo . innerText = repoName ;
209+
210+ // scroll to start of repo name
211+ sidebarLogo . scrollTo ( 0 , 0 ) ;
212+ scrolledSidebarTitle ( ) ;
198213
199214 // change header options
200215 header . classList . remove ( 'out-of-repo' ) ;
@@ -316,8 +331,12 @@ async function renderSidebarHTML() {
316331
317332 }
318333
319- // animate title
320- if ( sidebarLogo . scrollLeft > 0 ) titleAnimation = 'smooth' ;
334+
335+ // scroll to end of title
336+ sidebarLogo . scrollTo ( {
337+ left : sidebarLogo . scrollWidth - sidebarLogo . offsetLeft ,
338+ behavior : 'smooth'
339+ } ) ;
321340
322341 } else if ( repo != '' ) {
323342
@@ -333,31 +352,34 @@ async function renderSidebarHTML() {
333352 sidebarLogo . innerText = user + '/' + repoName ;
334353
335354 }
355+
356+ // scroll to start of repo name
357+ sidebarLogo . scrollTo ( 0 , 0 ) ;
358+ sidebarLogo . classList . add ( 'notransition' ) ;
359+
360+ window . setTimeout ( ( ) => {
361+ sidebarLogo . classList . remove ( 'notransition' ) ;
362+ } , 180 ) ;
363+
364+ scrolledSidebarTitle ( ) ;
336365
337366 } else {
338367
339368 // show title
340369 sidebarLogo . innerText = 'Repositories' ;
341-
342- }
343-
344- // scroll to end of title
345-
346- if ( ! titleAnimation ) {
347-
370+
371+ // scroll to start of repo name
372+ sidebarLogo . scrollTo ( 0 , 0 ) ;
348373 sidebarLogo . classList . add ( 'notransition' ) ;
349-
374+
350375 window . setTimeout ( ( ) => {
351376 sidebarLogo . classList . remove ( 'notransition' ) ;
352377 } , 180 ) ;
378+
379+ scrolledSidebarTitle ( ) ;
353380
354381 }
355382
356- sidebarTitle . children [ 1 ] . scrollTo ( {
357- left : sidebarLogo . scrollWidth - sidebarLogo . offsetLeft ,
358- behavior : titleAnimation
359- } ) ;
360-
361383
362384 // if navigating in repository
363385 if ( repo != '' ) {
@@ -693,6 +715,10 @@ function addHTMLItemListeners() {
693715
694716 // show repo name in sidebar
695717 sidebarLogo . innerText = repoLoc [ 1 ] ;
718+
719+ // scroll to start of repo name
720+ sidebarLogo . scrollTo ( 0 , 0 ) ;
721+ scrolledSidebarTitle ( ) ;
696722
697723 // change header options
698724 header . classList . remove ( 'out-of-repo' ) ;
@@ -1413,8 +1439,10 @@ sidebarTitle.addEventListener('click', (e) => {
14131439// show gradients on edges of sidebar title
14141440// when scrolling long titles
14151441
1416- sidebarLogo . addEventListener ( 'scroll' , ( ) => {
1442+ sidebarLogo . addEventListener ( 'scroll' , scrolledSidebarTitle ) ;
14171443
1444+ function scrolledSidebarTitle ( ) {
1445+
14181446 if ( sidebarLogo . scrollLeft > 0 ) {
14191447
14201448 sidebarLogo . classList . add ( 'scrolled-start' ) ;
@@ -1435,8 +1463,8 @@ sidebarLogo.addEventListener('scroll', () => {
14351463 sidebarLogo . classList . remove ( 'scrolled-end' ) ;
14361464
14371465 }
1438-
1439- } )
1466+
1467+ }
14401468
14411469
14421470// if clicked on branch icon,
0 commit comments