Last active 1440820958

A drop-in media server index for apache that uses directory indexing and adds a HTML5 video player. loads directory changes with ajax

Revision 399d33e2cf4cfd6f43df4e5da5d31615e369249d

mediaserverindex.html Raw
1<html>
2<head>
3<script src="jquery.js"></script>
4</head>
5<body>
6<span id="VideoList"></span>
7<script>
8var videosPath = "/Videos/";
9var curdir = "";
10function updateList(data) {
11 var directoryListing = $(data);
12
13 $("#VideoList").html(directoryListing);
14 $("#VideoList a").on("click", function(ev) {
15 ev.preventDefault();
16 if ($(this).attr("href") == "/") return false;
17 curdir = $("#VideoList").find('h1').text().slice(9) + "/";
18 document.location.hash = (curdir + $(this).attr("href")).replace(/.+\/\//g, "/");
19 if ($(this).attr("href").slice(-1) == "/") {
20 $.get((curdir + $(this).attr("href")).replace(/.+\/\//g, "/"), updateList);
21 document.location.hash = (curdir + $(this).attr("href")).replace(/.+\/\//g, "/");
22 } else {
23 video.setAttribute('src', curdir + $(this).attr("href"));
24 video.load();
25 video.play();
26 }
27 return false;
28 });
29}
30
31$(function() {
32
33 var video = document.createElement('video');
34 video.setAttribute('src', '');
35 video.setAttribute('controls', 'controls');
36 video.setAttribute('id', 'video');
37 $('body').prepend(video);
38
39 $.get(videosPath, updateList);
40});
41</script>
42</body>
43</html>