Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tree-view-enhancements Excluding Merge-Ins
This is equivalent to a diff from 6228efbb7c to cdd441f851
2014-01-15
| ||
02:54 | Make tree-view expansions and contractions persist on a "Back" in Chrome and IE. (Works without the extra javascript on Firefox and Safari.) check-in: ab00f2b007 user: drh tags: trunk | |
01:55 | Add missing "var". Closed-Leaf check-in: cdd441f851 user: joel tags: tree-view-enhancements | |
01:26 | Add ID attribute to subdirectory lists. check-in: 24fa1e6802 user: joel tags: tree-view-enhancements | |
2014-01-14
| ||
16:08 | Fix several issues with the TH1 unset command, including a memory leak. Add more tests. Keep the original branch open in case further changes are needed. check-in: 1aeb2726b0 user: drh tags: trunk | |
15:33 | Persist expand/collapse state of tree-view directories in all modern browsers. check-in: cd554eb63c user: joel tags: tree-view-enhancements | |
13:41 | Make a change to the test/utf16le.txt file as a test case to verify that the diff logic displays utf16 changes correctly. check-in: 6228efbb7c user: drh tags: trunk | |
13:39 | Handle utf16 text pages in the /doc webpage. check-in: 1c5b51e6bf user: drh tags: trunk | |
Changes to src/browse.c.
︙ | ︙ | |||
416 417 418 419 420 421 422 423 424 425 426 427 428 429 | char *zREx = ""; /* Extra parameters for path hyperlinks */ ReCompiled *pRE = 0; /* Compiled regular expression */ FileTreeNode *p; /* One line of the tree */ FileTree sTree; /* The complete tree of files */ HQuery sURI; /* Hyperlink */ int startExpanded; /* True to start out with the tree expanded */ int showDirOnly; /* Show directories only. Omit files */ char *zProjectName = db_get("project-name", 0); if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; } memset(&sTree, 0, sizeof(sTree)); login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } | > | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | char *zREx = ""; /* Extra parameters for path hyperlinks */ ReCompiled *pRE = 0; /* Compiled regular expression */ FileTreeNode *p; /* One line of the tree */ FileTree sTree; /* The complete tree of files */ HQuery sURI; /* Hyperlink */ int startExpanded; /* True to start out with the tree expanded */ int showDirOnly; /* Show directories only. Omit files */ int nDir = 0; /* Number of directories. Used for ID attributes */ char *zProjectName = db_get("project-name", 0); if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; } memset(&sTree, 0, sizeof(sTree)); login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
︙ | ︙ | |||
600 601 602 603 604 605 606 | if( nD ){ @ <li class="dir"> }else{ @ <li class="dir subdir"> } @ %z(href("%s",url_render(&sURI,"name",0,0,0)))%h(zProjectName)</a> @ <ul> | | | | > | | > > > > > > > > > | > | | | | > | > > > | > > > > > > > > > > > > | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | if( nD ){ @ <li class="dir"> }else{ @ <li class="dir subdir"> } @ %z(href("%s",url_render(&sURI,"name",0,0,0)))%h(zProjectName)</a> @ <ul> for(p=sTree.pFirst, nDir=0; p; p=p->pNext){ if( p->isDir ){ if( p->nFullName==nD-1 ){ @ <li class="dir subdir"> }else{ @ <li class="dir"> } @ %z(href("%s",url_render(&sURI,"name",p->zFullName,0,0)))%h(p->zName)</a> if( startExpanded || p->nFullName<=nD ){ @ <ul id="dir%d(nDir)"> }else{ @ <ul id="dir%d(nDir)" style='display:none;'> } nDir++; }else if( !showDirOnly ){ char *zLink; if( zCI ){ zLink = href("%R/artifact/%S",p->zUuid); }else{ zLink = href("%R/finfo?name=%T",p->zFullName); } @ <li class="%z(fileext_class(p->zName))">%z(zLink)%h(p->zName)</a> } if( p->isLast ){ int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0); while( nClose-- > 0 ){ @ </ul> } } } @ </ul> @ </ul></div> @ <script>(function(){ @ function isExpanded(ul){ @ var display = window.getComputedStyle(ul).getPropertyValue('display'); @ return display!='none'; @ } @ @ function toggleDir(ul, useInitValue){ @ if( !useInitValue ){ @ expandMap[ul.id] = !isExpanded(ul); @ history.replaceState(expandMap, ''); @ } @ ul.style.display = expandMap[ul.id] ? 'block' : 'none'; @ } @ @ function toggleAll(tree, useInitValue){ @ var lists = tree.querySelectorAll('.subdir > ul > li ul'); @ if( !useInitValue ){ @ var expand = true; /* Default action: make all sublists visible */ @ for( var i=0; lists[i]; i++ ){ @ if( isExpanded(lists[i]) ){ @ expand = false; /* Any already visible - make them all hidden */ @ break; @ } @ } @ expandMap = {'*': expand}; @ history.replaceState(expandMap, ''); @ } @ var display = expandMap['*'] ? 'block' : 'none'; @ for( var i=0; lists[i]; i++ ){ @ lists[i].style.display = display; @ } @ } @ @ function checkState(){ @ expandMap = history.state || {}; @ if( expandMap['*'] ) toggleAll(outer_ul, true); @ for( var id in expandMap ){ @ if( id!=='*' ) toggleDir(gebi(id), true); @ } @ } @ @ /* No-op shim for IE9 */ @ if( !history.replaceState ) history.replaceState = function(){}; @ var outer_ul = document.querySelector('.filetree > ul'); @ var subdir = outer_ul.querySelector('.subdir'); @ var expandMap = {}; @ checkState(); @ outer_ul.onclick = function(e){ @ var a = e.target; @ if( a.nodeName!='A' ) return true; @ if( a.parentNode==subdir ){ @ toggleAll(outer_ul); @ return false; @ } @ if( !subdir.contains(a) ) return true; @ var ul = a.nextSibling; @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; @ if( !ul ) return true; /* This is a file link, not a directory */ @ toggleDir(ul); @ return false; @ } @ }())</script> style_footer(); /* We could free memory used by sTree here if we needed to. But ** the process is about to exit, so doing so would not really accomplish |
︙ | ︙ |