Rev 1549 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log
Rev 1549 | Rev 1672 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | s866+=str[i]; |
17 | s866+=str[i]; |
18 | } |
18 | } |
19 | } |
19 | } |
20 | return s866; |
20 | return s866; |
21 | } |
21 | } |
22 | function myGet(u) { |
22 | function myGet(up, us) { |
23 | var r = new XMLHttpRequest(); |
23 | var r = new XMLHttpRequest(); |
- | 24 | us = to866(us) |
|
- | 25 | if (up=='?d='){ |
|
- | 26 | us = encodeURIComponent(us) |
|
- | 27 | } |
|
24 | r.open("GET", to866(u)+"&r="+Math.random(), false); |
28 | r.open("GET", up+us+"&r="+Math.random(), false); |
25 | r.send(null); |
29 | r.send(null); |
26 | return r.responseText; |
30 | return r.responseText; |
27 | } |
31 | } |
28 | 32 | ||
29 | function mkdir(){ |
33 | function mkdir(){ |
30 | var ss = '?m='+window.curDir+'/'+document.getElementById('dirName').value; |
34 | var ss = window.curDir+'/'+document.getElementById('dirName').value; |
31 | document.getElementById('log').innerHTML=myGet(ss); |
35 | document.getElementById('log').innerHTML=myGet('?m=', ss); |
32 | rddir(window.curDir); |
36 | rddir(window.curDir); |
33 | } |
37 | } |
34 | 38 | ||
35 | function unlink(dirPath){ |
39 | function unlink(dirPath){ |
36 | var ss = '?u='+window.curDir+'/'+dirPath; |
40 | var ss = window.curDir+'/'+dirPath; |
37 | document.getElementById('log').innerHTML=myGet(ss); |
41 | document.getElementById('log').innerHTML=myGet('?u=', ss); |
38 | rddir(window.curDir); |
42 | rddir(window.curDir); |
39 | } |
43 | } |
40 | function runprog(dirPath){ |
44 | function runprog(dirPath){ |
41 | var ss = '?s='+dirPath; |
45 | var ss = dirPath; |
42 | document.getElementById('log').innerHTML=myGet(ss); |
46 | document.getElementById('log').innerHTML=myGet('?s=', ss); |
43 | } |
47 | } |
44 | function compareFileInfo(finfoA, finfoB) { |
48 | function compareFileInfo(finfoA, finfoB) { |
45 | if(finfoA.isdir==3 || finfoB.isdir==3) return 0; |
49 | if(finfoA.isdir==3 || finfoB.isdir==3) return 0; |
46 | return finfoA.fn.localeCompare(finfoB.fn); |
50 | return finfoA.fn.localeCompare(finfoB.fn); |
47 | } |
51 | } |
Line 52... | Line 56... | ||
52 | window.curDir=dirPath; |
56 | window.curDir=dirPath; |
53 | window.s+='Current dir: <a href="javascript:rddir(\'\')">0:</a>'; |
57 | window.s+='Current dir: <a href="javascript:rddir(\'\')">0:</a>'; |
54 | if(dirPath!=''){ |
58 | if(dirPath!=''){ |
55 | while((k=dirPath.indexOf('/',i))!=-1){ |
59 | while((k=dirPath.indexOf('/',i))!=-1){ |
56 | window.s+='<a href="javascript:rddir(\''+dirPath.substring(0,k)+'\')">'+ |
60 | window.s+='<a href="javascript:rddir(\''+dirPath.substring(0,k)+'\')">'+ |
57 | dirPath.substring(i,k-i)+'</a>/'; |
61 | dirPath.substring(i,k)+'</a>/'; |
58 | i=k+1; |
62 | i=k+1; |
59 | } |
63 | } |
60 | window.s+=dirPath.substring(i); |
64 | window.s+=dirPath.substring(i); |
61 | } |
65 | } |
62 | window.s+='<br><table>'; |
66 | window.s+='<br><table>'; |
63 | j=JSON.parse(myGet('?d='+dirPath)); |
67 | j=JSON.parse(myGet('?d=', dirPath)); |
64 | j.fno.sort(compareFileInfo); |
68 | j.fno.sort(compareFileInfo); |
65 | j.fno.forEach(function(item, i, arr) { |
69 | j.fno.forEach(function(item, i, arr) { |
66 | var n,pn; |
70 | var n,pn; |
67 | if(item.isdir==1){ |
71 | if(item.isdir==1){ |
68 | n=item.fn; |
72 | n=item.fn; |
Line 83... | Line 87... | ||
83 | if(item.isdir==0){ |
87 | if(item.isdir==0){ |
84 | n=item.fn; |
88 | n=item.fn; |
85 | pn=((dirPath=='/')?(''):(dirPath+'/'))+n; |
89 | pn=((dirPath=='/')?(''):(dirPath+'/'))+n; |
86 | window.s+='<tr>'; |
90 | window.s+='<tr>'; |
87 | 91 | ||
88 | window.s+='<td>'+n+'</td><td>'+item.sz+'B </td><td>'+'<a href="?g='+pn+'">Download</a></td>'; |
92 | window.s+='<td>'+n+'</td><td>'+item.sz+'B </td><td>'+'<a href="?g='+encodeURIComponent(pn)+'">Download</a></td>'; |
89 | iof=n.lastIndexOf('.'); |
93 | iof=n.lastIndexOf('.'); |
90 | if(iof != -1){ |
94 | if(iof != -1){ |
91 | switch(n.toLowerCase().substring(iof)){ |
95 | switch(n.toLowerCase().substring(iof)){ |
92 | case '.com': |
96 | case '.com': |
93 | window.s+='<td><a href="javascript:runprog(\''+pn+'\')">Run</a></td>'; |
97 | window.s+='<td><a href="javascript:runprog(\''+pn+'\')">Run</a></td>'; |
94 | break; |
98 | break; |
95 | case '.pt3': |
99 | case '.pt3': |
96 | case '.pt2': |
100 | case '.pt2': |
97 | case '.tfc': |
101 | case '.tfc': |
98 | case '.m': |
102 | case '.m': |
- | 103 | case '.mt3': |
|
- | 104 | case '.et': |
|
- | 105 | case '.etc': |
|
- | 106 | case '.cmp': |
|
- | 107 | case '.tfd': |
|
- | 108 | case '.tfm': |
|
99 | window.s+='<td><a href="javascript:runprog(\'bin/player.com%20/'+pn+'\')">Play</a></td>'; |
109 | window.s+='<td><a href="javascript:runprog(\'bin/player.com%20/'+pn+'\')">Play</a></td>'; |
100 | break; |
110 | break; |
- | 111 | case '.mod': |
|
- | 112 | window.s+='<td><a href="javascript:runprog(\'bin/modplay.com%20/'+pn+'\')">Play</a></td>'; |
|
- | 113 | break; |
|
- | 114 | case '.mp3': |
|
- | 115 | case '.mid': |
|
- | 116 | case '.ogg': |
|
- | 117 | case '.aac': |
|
- | 118 | case '.mdr': |
|
- | 119 | case '.mwm': |
|
- | 120 | window.s+='<td><a href="javascript:runprog(\'bin/gp.com%20/'+pn+'\')">Play</a></td>'; |
|
- | 121 | break; |
|
- | 122 | case '.16c': |
|
- | 123 | case '.fnt': |
|
- | 124 | case '.img': |
|
- | 125 | case '.3': |
|
- | 126 | case '.888': |
|
- | 127 | case '.y': |
|
- | 128 | case '.+': |
|
- | 129 | case '.-': |
|
- | 130 | case '.plc': |
|
- | 131 | case '.mc ': |
|
- | 132 | case '.mcx': |
|
- | 133 | case '.grf': |
|
- | 134 | case '.ch$': |
|
- | 135 | case '.mg1': |
|
- | 136 | case '.mg2': |
|
- | 137 | case '.mg4': |
|
- | 138 | case '.mg8': |
|
- | 139 | case '.rm': |
|
- | 140 | case '.mlt': |
|
- | 141 | case '.53c': |
|
101 | case '.zxs': |
142 | case '.zxs': |
102 | case '.atr': |
143 | case '.atr': |
103 | case '.scr': |
144 | case '.scr': |
104 | window.s+='<td><a href="javascript:runprog(\'bin/view.com%20/'+pn+'\')">View</a></td>'; |
145 | window.s+='<td><a href="javascript:runprog(\'bin/view.com%20/'+pn+'\')">View</a></td>'; |
105 | break; |
146 | break; |
- | 147 | case '.gif': |
|
- | 148 | case '.jpg': |
|
- | 149 | case '.png': |
|
- | 150 | case '.htm': |
|
- | 151 | case '.svg': |
|
- | 152 | window.s+='<td><a href="javascript:runprog(\'bin/browser.com%20/'+pn+'\')">View</a></td>'; |
|
- | 153 | break; |
|
- | 154 | case '.bmp': |
|
- | 155 | window.s+='<td><a href="javascript:runprog(\'bin/scratch.com%20/'+pn+'\')">View</a></td>'; |
|
- | 156 | break; |
|
106 | default: |
157 | default: |
107 | window.s+='<td></td>'; |
158 | window.s+='<td></td>'; |
108 | break; |
159 | break; |
109 | } |
160 | } |
110 | }else |
161 | }else |