Steven Smith revised this gist . Go to revision
1 file changed, 43 insertions
mediaserverindex.html(file created)
| @@ -0,0 +1,43 @@ | |||
| 1 | + | <html> | |
| 2 | + | <head> | |
| 3 | + | <script src="jquery.js"></script> | |
| 4 | + | </head> | |
| 5 | + | <body> | |
| 6 | + | <span id="VideoList"></span> | |
| 7 | + | <script> | |
| 8 | + | var videosPath = "/Videos/"; | |
| 9 | + | var curdir = ""; | |
| 10 | + | function 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> | |
    
    
                            
                            Newer
    
    
    Older