This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bowser.html
212 lines (152 loc) · 4.98 KB
/
bowser.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="/static/js/ICanHaz.min.js"></script>
<script src="/static/js/bootstrap-alerts.js"></script>
<link href='http://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<!--<link href='/static/css/pygments.css' rel='stylesheet' type='text/css'>-->
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap-custom.css">
<title>Bowser</title>
<style type="text/css">
body{
/* background-image: url("/static/img/grad1.jpg"), url("/static/img/grad2.jpg");
background-repeat: repeat-x, repeat;
*/
font-family: 'Montserrat', sans-serif;
}
.page-header{
}
#filebrowser-container {
font-family: 'Questrial', sans-serif;
font-style: bold;
}
a, a:hover{
color: #46a546;
}
#curdir {
margin-right: 20px;
/*background-color:rgba(5,5,5,0.2);*/
}
#files, #dirs {
border-radius: 10px;
padding: 10px;
margin-bottom: 10px;
margin-left: 2em;
}
#files {
}
#nav-up {
margin-top: 3px;
float:right;
clear:both;
}
</style>
</head>
<body>
<div id="alerts-container"></div>
<script id="alerts" type="text/html">
<div class="alert alert-{{severity}}">
<a class="close" data-dismiss="alert" href="#">×</a>
<p><strong>{{severity}}:</strong> {{message}}</p>
</div>
</script>
<script id="filebrowser" type="text/html">
<ul class="breadcrumb" id="curdir">
Current Directory:
{{#breadcrumbs}}
<li> <a href="#" class="dirlink" id="/dir/{{0}}/">{{1}} </a><span class="divider">/</span></li>
{{/breadcrumbs}}
</ul>
<div class="row">
<div class="span3 hero-unit" id="dirs">
<div id="nav-up">
<a href="#" class="dirlink btn small" id="/dir{{parentdir}}"> Go up [..] </a>
</div>
<h2>Directories:</h2>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr><th>Name</th><th>#Dirs</th><th>#Files</th></tr>
</thead>
<tbody>
{{#dirs}}
<tr>
{{#curdir}}
<td>
<a class="dirlink" id="/dir/{{curdir}}/{{name}}/" href="#">{{name}}</a>
</td>
<td>{{numdirs}}</td>
<td>{{numfiles}}</td>
{{/curdir}}
{{^curdir}}
<td>
<a class="dirlink" id="/dir/{{name}}/" href="#">{{name}}</div></a>
</td>
<td>{{numdirs}}</td>
<td>{{numfiles}}</td>
{{/curdir}}
</tr>
{{/dirs}}
</tbody>
</table>
</div>
<div class="hero-unit span12" id="files">
<h2>Files:</h2>
<table id="xfiletable" class="table table-striped table-bordered table-condensed">
<thead>
<tr><th><h4>Filename</h4></th><th><h4>Modification Date</h4></th><th><h4>Size<h4></th></tr>
</thead>
<tbody>
{{#files}}
<tr>
<td><a href="/preview/{{curdir}}{{filename}}">{{filename}} </a></td> <td>{{modtime}}</td><td>{{size}}M</td>
</tr>
{{/files}}
</tbody>
</table>
</div>
</div>
</script>
<script>
$(function() {
$(".alert").alert();
$(window).bind('hashchange', function () {
//console.log(window.location.hash);
update_filebrowser(window.location.hash.replace('#', ''));
});
function update_filebrowser(path){
var path = path || '/dir/';
$.getJSON(path, function(data) {
var html = ich.filebrowser(data);
$('#filebrowser-container').html(html);
}).error(function() {
var msg = "Could not retrieve the directory: " + path
$('#alerts-container').html(ich.alerts({severity: 'error', message: msg }));
$(".alert-message").alert()
});
};
update_filebrowser('/dir/');
$('#filebrowser-container').click(function(e){
console.log($(e));
if( $(e.target).is('a') && $(e.target).hasClass("dirlink") ) {
update_filebrowser(e.target.id);
window.location.hash = e.target.id.replace('//', '/');
return false;
}
});
});
</script>
<div class="container-fluid">
<div class="page-header" >
<a href="/">
<h1>Bowser
<small>Doggedly simple file browser</small>
</h1>
</a>
</div>
</div>
<br/>
<div class="container-fluid" id="filebrowser-container"></div>
</body>
</html>