| | @@ -843,80 +843,11 @@ |
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | 846 | @ </ul> |
| 847 | 847 | @ </ul></div> |
| 848 | | - @ <script>(function(){ |
| 849 | | - @ function isExpanded(ul){ |
| 850 | | - @ return ul.className==''; |
| 851 | | - @ } |
| 852 | | - @ |
| 853 | | - @ function toggleDir(ul, useInitValue){ |
| 854 | | - @ if( !useInitValue ){ |
| 855 | | - @ expandMap[ul.id] = !isExpanded(ul); |
| 856 | | - @ history.replaceState(expandMap, ''); |
| 857 | | - @ } |
| 858 | | - @ ul.className = expandMap[ul.id] ? '' : 'collapsed'; |
| 859 | | - @ } |
| 860 | | - @ |
| 861 | | - @ function toggleAll(tree, useInitValue){ |
| 862 | | - @ var lists = tree.querySelectorAll('.subdir > ul > li ul'); |
| 863 | | - @ if( !useInitValue ){ |
| 864 | | - @ var expand = true; /* Default action: make all sublists visible */ |
| 865 | | - @ for( var i=0; lists[i]; i++ ){ |
| 866 | | - @ if( isExpanded(lists[i]) ){ |
| 867 | | - @ expand = false; /* Any already visible - make them all hidden */ |
| 868 | | - @ break; |
| 869 | | - @ } |
| 870 | | - @ } |
| 871 | | - @ expandMap = {'*': expand}; |
| 872 | | - @ history.replaceState(expandMap, ''); |
| 873 | | - @ } |
| 874 | | - @ var className = expandMap['*'] ? '' : 'collapsed'; |
| 875 | | - @ for( var i=0; lists[i]; i++ ){ |
| 876 | | - @ lists[i].className = className; |
| 877 | | - @ } |
| 878 | | - @ } |
| 879 | | - @ |
| 880 | | - @ function checkState(){ |
| 881 | | - @ expandMap = history.state || {}; |
| 882 | | - @ if( '*' in expandMap ) toggleAll(outer_ul, true); |
| 883 | | - @ for( var id in expandMap ){ |
| 884 | | - @ if( id!=='*' ) toggleDir(gebi(id), true); |
| 885 | | - @ } |
| 886 | | - @ } |
| 887 | | - @ |
| 888 | | - @ function belowSubdir(node){ |
| 889 | | - @ do{ |
| 890 | | - @ node = node.parentNode; |
| 891 | | - @ if( node==subdir ) return true; |
| 892 | | - @ } while( node && node!=outer_ul ); |
| 893 | | - @ return false; |
| 894 | | - @ } |
| 895 | | - @ |
| 896 | | - @ var history = window.history || {}; |
| 897 | | - @ if( !history.replaceState ) history.replaceState = function(){}; |
| 898 | | - @ var outer_ul = document.querySelector('.filetree > ul'); |
| 899 | | - @ var subdir = outer_ul.querySelector('.subdir'); |
| 900 | | - @ var expandMap = {}; |
| 901 | | - @ checkState(); |
| 902 | | - @ outer_ul.onclick = function(e){ |
| 903 | | - @ e = e || window.event; |
| 904 | | - @ var a = e.target || e.srcElement; |
| 905 | | - @ if( a.nodeName!='A' ) return true; |
| 906 | | - @ if( a.parentNode.parentNode==subdir ){ |
| 907 | | - @ toggleAll(outer_ul); |
| 908 | | - @ return false; |
| 909 | | - @ } |
| 910 | | - @ if( !belowSubdir(a) ) return true; |
| 911 | | - @ var ul = a.parentNode.nextSibling; |
| 912 | | - @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; |
| 913 | | - @ if( !ul ) return true; /* This is a file link, not a directory */ |
| 914 | | - @ toggleDir(ul); |
| 915 | | - @ return false; |
| 916 | | - @ } |
| 917 | | - @ }())</script> |
| 848 | + style_load_one_js_file("tree.js"); |
| 918 | 849 | style_footer(); |
| 919 | 850 | |
| 920 | 851 | /* We could free memory used by sTree here if we needed to. But |
| 921 | 852 | ** the process is about to exit, so doing so would not really accomplish |
| 922 | 853 | ** anything useful. */ |
| 923 | 854 | |