From 44da5835e6cfec368a7ae9f11574e23181869bad Mon Sep 17 00:00:00 2001 From: Arnaud CHESNAY Date: Wed, 27 Sep 2017 12:24:46 +0200 Subject: collapse --- app.js | 2 +- public/css/style.css | 7 +++++++ public/js/script.js | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 684cbfd..28c16ea 100644 --- a/app.js +++ b/app.js @@ -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); }); -- cgit v1.2.3