Fossil

Check-in [b66100d3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add JS for collapsing/expanding directories in tree-view.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b66100d3edd1be3d06c2b7a2a177a5071eb1f036
User & Date: joel 2014-01-06 23:42:39
Context
2014-01-07
02:20
On the tree-view display, add some comments to better explain what is happening and simplify the javascript slightly. check-in: cda3140d user: drh tags: trunk
2014-01-06
23:42
Add JS for collapsing/expanding directories in tree-view. check-in: b66100d3 user: joel tags: trunk
09:16
Cleanup tree-view CSS comments. No changes to code. check-in: 4ee58093 user: joel tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/browse.c.

586
587
588
589
590
591
592









































593
594
595
596
597
598
599
      while( nClose-- > 0 ){
        @ </ul>
      }
    }
  }
  @ </ul>
  @ </ul></div>









































  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
  ** anything useful. */
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
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
      while( nClose-- > 0 ){
        @ </ul>
      }
    }
  }
  @ </ul>
  @ </ul></div>
  @ <script>(function(){
  @ function style(elem, prop){
  @   return window.getComputedStyle(elem).getPropertyValue(prop);
  @ }
  @
  @ function toggleAll(tree){
  @   var lists = tree.querySelectorAll('.subdir > ul > li ul');
  @   var display = 'block';
  @   for( var i=0; lists[i]; i++ ){
  @     if( style(lists[i], 'display')!='none'){
  @       display = 'none';
  @       break;
  @     }
  @   }
  @   for( var i=0; lists[i]; i++ ){
  @     lists[i].style.display = display;
  @   }
  @ }
  @ 
  @ function initTree(tree){
  @   tree.onclick = function( e ){
  @     var a = e.target;
  @     if( a.nodeName!='A' ) return;
  @     if( a.parentNode.className.indexOf('subdir')>=0 ){
  @       toggleAll(tree);
  @       return false;
  @     }
  @     if( style(a.parentNode, 'display')=='inline' ) return;
  @     var ul = a.nextSibling;
  @     while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
  @     ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none';
  @     return false;
  @   }
  @   var subdirLink = tree.querySelectorAll('.subdir > a')[0];
  @   subdirLink.style.cursor = 'pointer';
  @   toggleAll(tree);
  @ }
  @ 
  @ var trees = document.querySelectorAll('.filetree > ul');
  @ for( var i=0; trees[i]; i++ ) initTree(trees[i]);
  @ }())</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
  ** anything useful. */
}