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.
Commit
13c71a97feb26586f75f88ba897aa761fc450e30
Parent
273dd2c007dbab8…
1 file changed
+7
-6
+7
-6
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -414,10 +414,11 @@ | ||
| 414 | 414 | char *zREx = ""; /* Extra parameters for path hyperlinks */ |
| 415 | 415 | ReCompiled *pRE = 0; /* Compiled regular expression */ |
| 416 | 416 | FileTreeNode *p; /* One line of the tree */ |
| 417 | 417 | FileTree sTree; /* The complete tree of files */ |
| 418 | 418 | HQuery sURI; /* Hyperlink */ |
| 419 | + int startExpanded; /* True to start out with the tree expanded */ | |
| 419 | 420 | char *zProjectName = db_get("project-name", 0); |
| 420 | 421 | |
| 421 | 422 | if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; } |
| 422 | 423 | memset(&sTree, 0, sizeof(sTree)); |
| 423 | 424 | login_check_credentials(); |
| @@ -425,10 +426,11 @@ | ||
| 425 | 426 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 426 | 427 | style_header("File List"); |
| 427 | 428 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 428 | 429 | pathelementFunc, 0, 0); |
| 429 | 430 | url_initialize(&sURI, "tree"); |
| 431 | + startExpanded = P("expand")!=0; | |
| 430 | 432 | |
| 431 | 433 | /* If a regular expression is specified, compile it */ |
| 432 | 434 | zRE = P("re"); |
| 433 | 435 | if( zRE ){ |
| 434 | 436 | re_compile(&pRE, zRE, 0); |
| @@ -578,11 +580,15 @@ | ||
| 578 | 580 | @ <a>%h(p->zName)</a> |
| 579 | 581 | }else{ |
| 580 | 582 | char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0)); |
| 581 | 583 | @ %z(zLink)%h(p->zName)</a> |
| 582 | 584 | } |
| 583 | - @ <ul> | |
| 585 | + if( startExpanded ){ | |
| 586 | + @ <ul> | |
| 587 | + }else{ | |
| 588 | + @ <ul style='display:none;'> | |
| 589 | + } | |
| 584 | 590 | }else{ |
| 585 | 591 | char *zLink; |
| 586 | 592 | if( zCI ){ |
| 587 | 593 | zLink = href("%R/artifact/%s",p->zUuid); |
| 588 | 594 | }else{ |
| @@ -631,15 +637,10 @@ | ||
| 631 | 637 | @ var ul = a.nextSibling; |
| 632 | 638 | @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; |
| 633 | 639 | @ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none'; |
| 634 | 640 | @ return false; |
| 635 | 641 | @ } |
| 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 | 642 | @ }())</script> |
| 642 | 643 | style_footer(); |
| 643 | 644 | |
| 644 | 645 | /* We could free memory used by sTree here if we needed to. But |
| 645 | 646 | ** the process is about to exit, so doing so would not really accomplish |
| 646 | 647 |
| --- 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 |