Fossil SCM

Cleanup and fix for Firefox 3.6.

joel 2014-01-16 20:49 tree-view-work
Commit cffecc776b92c9179d84e22d8f458596c0bcf11a
1 file changed +14 -8
+14 -8
--- src/browse.c
+++ src/browse.c
@@ -645,13 +645,11 @@
645645
@ }
646646
@
647647
@ function toggleDir(ul, useInitValue){
648648
@ if( !useInitValue ){
649649
@ expandMap[ul.id] = !isExpanded(ul);
650
- @ if( history && history.replaceState ){
651
- @ history.replaceState(expandMap, '');
652
- @ }
650
+ @ history.replaceState(expandMap, '');
653651
@ }
654652
@ ul.style.display = expandMap[ul.id] ? 'block' : 'none';
655653
@ }
656654
@
657655
@ function toggleAll(tree, useInitValue){
@@ -663,28 +661,36 @@
663661
@ expand = false; /* Any already visible - make them all hidden */
664662
@ break;
665663
@ }
666664
@ }
667665
@ expandMap = {'*': expand};
668
- @ if( history && history.replaceState ){
669
- @ history.replaceState(expandMap, '');
670
- @ }
666
+ @ history.replaceState(expandMap, '');
671667
@ }
672668
@ var display = expandMap['*'] ? 'block' : 'none';
673669
@ for( var i=0; lists[i]; i++ ){
674670
@ lists[i].style.display = display;
675671
@ }
676672
@ }
677673
@
678674
@ function checkState(){
679
- @ expandMap = (history && history.state) || {};
675
+ @ expandMap = history.state || {};
680676
@ if( expandMap['*'] ) toggleAll(outer_ul, true);
681677
@ for( var id in expandMap ){
682678
@ if( id!=='*' ) toggleDir(gebi(id), true);
683679
@ }
684680
@ }
685681
@
682
+ @ function belowSubdir(node){
683
+ @ do{
684
+ @ node = node.parentNode;
685
+ @ if( node==subdir ) return true;
686
+ @ } while( node && node!=outer_ul );
687
+ @ return false;
688
+ @ }
689
+ @
690
+ @ var history = window.history || {};
691
+ @ if( !history.replaceState ) history.replaceState = function(){};
686692
@ var outer_ul = document.querySelector('.filetree > ul');
687693
@ var subdir = outer_ul.querySelector('.subdir');
688694
@ var expandMap = {};
689695
@ checkState();
690696
@ outer_ul.onclick = function(e){
@@ -692,11 +698,11 @@
692698
@ if( a.nodeName!='A' ) return true;
693699
@ if( a.parentNode==subdir ){
694700
@ toggleAll(outer_ul);
695701
@ return false;
696702
@ }
697
- @ if( !subdir || !subdir.contains || !subdir.contains(a) ) return true;
703
+ @ if( !belowSubdir(a) ) return true;
698704
@ var ul = a.nextSibling;
699705
@ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
700706
@ if( !ul ) return true; /* This is a file link, not a directory */
701707
@ toggleDir(ul);
702708
@ return false;
703709
--- src/browse.c
+++ src/browse.c
@@ -645,13 +645,11 @@
645 @ }
646 @
647 @ function toggleDir(ul, useInitValue){
648 @ if( !useInitValue ){
649 @ expandMap[ul.id] = !isExpanded(ul);
650 @ if( history && history.replaceState ){
651 @ history.replaceState(expandMap, '');
652 @ }
653 @ }
654 @ ul.style.display = expandMap[ul.id] ? 'block' : 'none';
655 @ }
656 @
657 @ function toggleAll(tree, useInitValue){
@@ -663,28 +661,36 @@
663 @ expand = false; /* Any already visible - make them all hidden */
664 @ break;
665 @ }
666 @ }
667 @ expandMap = {'*': expand};
668 @ if( history && history.replaceState ){
669 @ history.replaceState(expandMap, '');
670 @ }
671 @ }
672 @ var display = expandMap['*'] ? 'block' : 'none';
673 @ for( var i=0; lists[i]; i++ ){
674 @ lists[i].style.display = display;
675 @ }
676 @ }
677 @
678 @ function checkState(){
679 @ expandMap = (history && history.state) || {};
680 @ if( expandMap['*'] ) toggleAll(outer_ul, true);
681 @ for( var id in expandMap ){
682 @ if( id!=='*' ) toggleDir(gebi(id), true);
683 @ }
684 @ }
685 @
 
 
 
 
 
 
 
 
 
 
686 @ var outer_ul = document.querySelector('.filetree > ul');
687 @ var subdir = outer_ul.querySelector('.subdir');
688 @ var expandMap = {};
689 @ checkState();
690 @ outer_ul.onclick = function(e){
@@ -692,11 +698,11 @@
692 @ if( a.nodeName!='A' ) return true;
693 @ if( a.parentNode==subdir ){
694 @ toggleAll(outer_ul);
695 @ return false;
696 @ }
697 @ if( !subdir || !subdir.contains || !subdir.contains(a) ) return true;
698 @ var ul = a.nextSibling;
699 @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
700 @ if( !ul ) return true; /* This is a file link, not a directory */
701 @ toggleDir(ul);
702 @ return false;
703
--- src/browse.c
+++ src/browse.c
@@ -645,13 +645,11 @@
645 @ }
646 @
647 @ function toggleDir(ul, useInitValue){
648 @ if( !useInitValue ){
649 @ expandMap[ul.id] = !isExpanded(ul);
650 @ history.replaceState(expandMap, '');
 
 
651 @ }
652 @ ul.style.display = expandMap[ul.id] ? 'block' : 'none';
653 @ }
654 @
655 @ function toggleAll(tree, useInitValue){
@@ -663,28 +661,36 @@
661 @ expand = false; /* Any already visible - make them all hidden */
662 @ break;
663 @ }
664 @ }
665 @ expandMap = {'*': expand};
666 @ history.replaceState(expandMap, '');
 
 
667 @ }
668 @ var display = expandMap['*'] ? 'block' : 'none';
669 @ for( var i=0; lists[i]; i++ ){
670 @ lists[i].style.display = display;
671 @ }
672 @ }
673 @
674 @ function checkState(){
675 @ expandMap = history.state || {};
676 @ if( expandMap['*'] ) toggleAll(outer_ul, true);
677 @ for( var id in expandMap ){
678 @ if( id!=='*' ) toggleDir(gebi(id), true);
679 @ }
680 @ }
681 @
682 @ function belowSubdir(node){
683 @ do{
684 @ node = node.parentNode;
685 @ if( node==subdir ) return true;
686 @ } while( node && node!=outer_ul );
687 @ return false;
688 @ }
689 @
690 @ var history = window.history || {};
691 @ if( !history.replaceState ) history.replaceState = function(){};
692 @ var outer_ul = document.querySelector('.filetree > ul');
693 @ var subdir = outer_ul.querySelector('.subdir');
694 @ var expandMap = {};
695 @ checkState();
696 @ outer_ul.onclick = function(e){
@@ -692,11 +698,11 @@
698 @ if( a.nodeName!='A' ) return true;
699 @ if( a.parentNode==subdir ){
700 @ toggleAll(outer_ul);
701 @ return false;
702 @ }
703 @ if( !belowSubdir(a) ) return true;
704 @ var ul = a.nextSibling;
705 @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
706 @ if( !ul ) return true; /* This is a file link, not a directory */
707 @ toggleDir(ul);
708 @ return false;
709

Keyboard Shortcuts

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