Fossil SCM
Cleanup and fix for Firefox 3.6.
Commit
cffecc776b92c9179d84e22d8f458596c0bcf11a
Parent
fb647963eac5cd8…
1 file changed
+14
-8
+14
-8
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -645,13 +645,11 @@ | ||
| 645 | 645 | @ } |
| 646 | 646 | @ |
| 647 | 647 | @ function toggleDir(ul, useInitValue){ |
| 648 | 648 | @ if( !useInitValue ){ |
| 649 | 649 | @ expandMap[ul.id] = !isExpanded(ul); |
| 650 | - @ if( history && history.replaceState ){ | |
| 651 | - @ history.replaceState(expandMap, ''); | |
| 652 | - @ } | |
| 650 | + @ history.replaceState(expandMap, ''); | |
| 653 | 651 | @ } |
| 654 | 652 | @ ul.style.display = expandMap[ul.id] ? 'block' : 'none'; |
| 655 | 653 | @ } |
| 656 | 654 | @ |
| 657 | 655 | @ function toggleAll(tree, useInitValue){ |
| @@ -663,28 +661,36 @@ | ||
| 663 | 661 | @ expand = false; /* Any already visible - make them all hidden */ |
| 664 | 662 | @ break; |
| 665 | 663 | @ } |
| 666 | 664 | @ } |
| 667 | 665 | @ expandMap = {'*': expand}; |
| 668 | - @ if( history && history.replaceState ){ | |
| 669 | - @ history.replaceState(expandMap, ''); | |
| 670 | - @ } | |
| 666 | + @ history.replaceState(expandMap, ''); | |
| 671 | 667 | @ } |
| 672 | 668 | @ var display = expandMap['*'] ? 'block' : 'none'; |
| 673 | 669 | @ for( var i=0; lists[i]; i++ ){ |
| 674 | 670 | @ lists[i].style.display = display; |
| 675 | 671 | @ } |
| 676 | 672 | @ } |
| 677 | 673 | @ |
| 678 | 674 | @ function checkState(){ |
| 679 | - @ expandMap = (history && history.state) || {}; | |
| 675 | + @ expandMap = history.state || {}; | |
| 680 | 676 | @ if( expandMap['*'] ) toggleAll(outer_ul, true); |
| 681 | 677 | @ for( var id in expandMap ){ |
| 682 | 678 | @ if( id!=='*' ) toggleDir(gebi(id), true); |
| 683 | 679 | @ } |
| 684 | 680 | @ } |
| 685 | 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(){}; | |
| 686 | 692 | @ var outer_ul = document.querySelector('.filetree > ul'); |
| 687 | 693 | @ var subdir = outer_ul.querySelector('.subdir'); |
| 688 | 694 | @ var expandMap = {}; |
| 689 | 695 | @ checkState(); |
| 690 | 696 | @ outer_ul.onclick = function(e){ |
| @@ -692,11 +698,11 @@ | ||
| 692 | 698 | @ if( a.nodeName!='A' ) return true; |
| 693 | 699 | @ if( a.parentNode==subdir ){ |
| 694 | 700 | @ toggleAll(outer_ul); |
| 695 | 701 | @ return false; |
| 696 | 702 | @ } |
| 697 | - @ if( !subdir || !subdir.contains || !subdir.contains(a) ) return true; | |
| 703 | + @ if( !belowSubdir(a) ) return true; | |
| 698 | 704 | @ var ul = a.nextSibling; |
| 699 | 705 | @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; |
| 700 | 706 | @ if( !ul ) return true; /* This is a file link, not a directory */ |
| 701 | 707 | @ toggleDir(ul); |
| 702 | 708 | @ return false; |
| 703 | 709 |
| --- 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 |