Fossil SCM

Do not wait until the entire tree-view page has loaded before collapsing the tree, because that can cause flicker if the page is loaded incrementally over a slow wire. Collapse the tree using style= attributes as the page loads.

drh 2014-01-07 02:38 trunk
Commit 13c71a97feb26586f75f88ba897aa761fc450e30
1 file changed +7 -6
+7 -6
--- src/browse.c
+++ src/browse.c
@@ -414,10 +414,11 @@
414414
char *zREx = ""; /* Extra parameters for path hyperlinks */
415415
ReCompiled *pRE = 0; /* Compiled regular expression */
416416
FileTreeNode *p; /* One line of the tree */
417417
FileTree sTree; /* The complete tree of files */
418418
HQuery sURI; /* Hyperlink */
419
+ int startExpanded; /* True to start out with the tree expanded */
419420
char *zProjectName = db_get("project-name", 0);
420421
421422
if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
422423
memset(&sTree, 0, sizeof(sTree));
423424
login_check_credentials();
@@ -425,10 +426,11 @@
425426
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
426427
style_header("File List");
427428
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
428429
pathelementFunc, 0, 0);
429430
url_initialize(&sURI, "tree");
431
+ startExpanded = P("expand")!=0;
430432
431433
/* If a regular expression is specified, compile it */
432434
zRE = P("re");
433435
if( zRE ){
434436
re_compile(&pRE, zRE, 0);
@@ -578,11 +580,15 @@
578580
@ <a>%h(p->zName)</a>
579581
}else{
580582
char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
581583
@ %z(zLink)%h(p->zName)</a>
582584
}
583
- @ <ul>
585
+ if( startExpanded ){
586
+ @ <ul>
587
+ }else{
588
+ @ <ul style='display:none;'>
589
+ }
584590
}else{
585591
char *zLink;
586592
if( zCI ){
587593
zLink = href("%R/artifact/%s",p->zUuid);
588594
}else{
@@ -631,15 +637,10 @@
631637
@ var ul = a.nextSibling;
632638
@ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
633639
@ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none';
634640
@ return false;
635641
@ }
636
- if( P("expand")==0 ){
637
- /* Begin with the tree collapsed, unless the "expand" query parameter
638
- ** is present */
639
- @ toggleAll(outer_ul);
640
- }
641642
@ }())</script>
642643
style_footer();
643644
644645
/* We could free memory used by sTree here if we needed to. But
645646
** the process is about to exit, so doing so would not really accomplish
646647
--- src/browse.c
+++ src/browse.c
@@ -414,10 +414,11 @@
414 char *zREx = ""; /* Extra parameters for path hyperlinks */
415 ReCompiled *pRE = 0; /* Compiled regular expression */
416 FileTreeNode *p; /* One line of the tree */
417 FileTree sTree; /* The complete tree of files */
418 HQuery sURI; /* Hyperlink */
 
419 char *zProjectName = db_get("project-name", 0);
420
421 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
422 memset(&sTree, 0, sizeof(sTree));
423 login_check_credentials();
@@ -425,10 +426,11 @@
425 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
426 style_header("File List");
427 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
428 pathelementFunc, 0, 0);
429 url_initialize(&sURI, "tree");
 
430
431 /* If a regular expression is specified, compile it */
432 zRE = P("re");
433 if( zRE ){
434 re_compile(&pRE, zRE, 0);
@@ -578,11 +580,15 @@
578 @ <a>%h(p->zName)</a>
579 }else{
580 char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
581 @ %z(zLink)%h(p->zName)</a>
582 }
583 @ <ul>
 
 
 
 
584 }else{
585 char *zLink;
586 if( zCI ){
587 zLink = href("%R/artifact/%s",p->zUuid);
588 }else{
@@ -631,15 +637,10 @@
631 @ var ul = a.nextSibling;
632 @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
633 @ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none';
634 @ return false;
635 @ }
636 if( P("expand")==0 ){
637 /* Begin with the tree collapsed, unless the "expand" query parameter
638 ** is present */
639 @ toggleAll(outer_ul);
640 }
641 @ }())</script>
642 style_footer();
643
644 /* We could free memory used by sTree here if we needed to. But
645 ** the process is about to exit, so doing so would not really accomplish
646
--- src/browse.c
+++ src/browse.c
@@ -414,10 +414,11 @@
414 char *zREx = ""; /* Extra parameters for path hyperlinks */
415 ReCompiled *pRE = 0; /* Compiled regular expression */
416 FileTreeNode *p; /* One line of the tree */
417 FileTree sTree; /* The complete tree of files */
418 HQuery sURI; /* Hyperlink */
419 int startExpanded; /* True to start out with the tree expanded */
420 char *zProjectName = db_get("project-name", 0);
421
422 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
423 memset(&sTree, 0, sizeof(sTree));
424 login_check_credentials();
@@ -425,10 +426,11 @@
426 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
427 style_header("File List");
428 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
429 pathelementFunc, 0, 0);
430 url_initialize(&sURI, "tree");
431 startExpanded = P("expand")!=0;
432
433 /* If a regular expression is specified, compile it */
434 zRE = P("re");
435 if( zRE ){
436 re_compile(&pRE, zRE, 0);
@@ -578,11 +580,15 @@
580 @ <a>%h(p->zName)</a>
581 }else{
582 char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
583 @ %z(zLink)%h(p->zName)</a>
584 }
585 if( startExpanded ){
586 @ <ul>
587 }else{
588 @ <ul style='display:none;'>
589 }
590 }else{
591 char *zLink;
592 if( zCI ){
593 zLink = href("%R/artifact/%s",p->zUuid);
594 }else{
@@ -631,15 +637,10 @@
637 @ var ul = a.nextSibling;
638 @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
639 @ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none';
640 @ return false;
641 @ }
 
 
 
 
 
642 @ }())</script>
643 style_footer();
644
645 /* We could free memory used by sTree here if we needed to. But
646 ** the process is about to exit, so doing so would not really accomplish
647

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button