diff options
author | Arnaud CHESNAY <arnaud.chesnay@etu.univ-nantes.fr> | 2017-09-27 12:24:46 +0200 |
---|---|---|
committer | Arnaud CHESNAY <arnaud.chesnay@etu.univ-nantes.fr> | 2017-09-27 12:24:46 +0200 |
commit | 44da5835e6cfec368a7ae9f11574e23181869bad (patch) | |
tree | 0863f76c6f26280c185033dc726d09ed36431b90 | |
parent | app (diff) |
collapse
-rw-r--r-- | app.js | 2 | ||||
-rw-r--r-- | public/css/style.css | 7 | ||||
-rw-r--r-- | public/js/script.js | 9 |
3 files changed, 17 insertions, 1 deletions
@@ -50,7 +50,7 @@ app.get('*', function(req, res) { }); }); -var server = app.listen(80, function() { +var server = app.listen(8080, function() { var host = server.address().address; var port = server.address().port; console.log("App listening at http://%s:%s", host, port); diff --git a/public/css/style.css b/public/css/style.css index f0a90e6..38ce883 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -636,3 +636,10 @@ color: currentColor; #tree { border-right: 1px solid rgb(238, 238, 238); } +.directory { + cursor: pointer; + list-style-type: disc; +} +.file { + list-style: circle; +} diff --git a/public/js/script.js b/public/js/script.js index 42367ef..432fcf5 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -4,10 +4,17 @@ $(document).ready(function() { $('a').click(function(e) { e.preventDefault(); + e.stopPropagation(); $.get(this.href, function(data) { $('#md').html(data); }); }); + + $('.directory').find('ul').hide(); + $('.directory').click(function(e) { + e.stopPropagation(); + $(this).children('ul').slideToggle(); + }); }); }); @@ -22,9 +29,11 @@ function addDirectory(data) { a.appendChild(text); a.href = item.path; li.appendChild(a); + li.classList.add("file"); } else { li.appendChild(text); li.appendChild(addDirectory(item)); + li.classList.add("directory"); } ul.appendChild(li); }); |