diff --git a/processing.js b/processing.js index ffe1b99..c5dffd3 100644 --- a/processing.js +++ b/processing.js @@ -1,16 +1,18 @@ const paths = require('path') module.exports.mergedir = (dirname,settings)=>{ - return paths.join(settings.dirname,dirname); + return paths.normalize(paths.join(settings.dirname,dirname)); } module.exports.dirprocess = (dirstream,settings)=>{ dirstream.forEach(element => { element.type = element.isDirectory() }); + dirstream.push({'name':'..','type':true}) + //dirstream.contents.push({'name':'..','type':true}) if(!settings.showHidden){ let fdirstream = dirstream.filter((ele)=>{ //ele.type=ele.isDirectory - return ele.name[0]!='.' + return ele.name[0]!='.'||ele.name=='..' }) return fdirstream } diff --git a/static/base.js b/static/base.js index 79f7e3b..5e74865 100644 --- a/static/base.js +++ b/static/base.js @@ -1,19 +1,33 @@ let currDir = {'loc':'','contents':null}; + +function doUpdate(ele){ + console.log(ele.attr('data-choice')); + if(ele.hasClass('file-isDir')){ + currDir.loc = currDir.loc+ "/"+ ele.attr('data-choice'); + populateContents(); + } + //$() + //$(this). +} + function updateContents(contents){ - console.log(contents) - $('#files-location').html(contents.loc) + //console.log(contents) + $('#files-location').html(currDir.loc) if(contents===null) $('#files-table').append(`null`) else - contents.contents.forEach(element => { - $('#files-table').append(`${element.name}`) - }); + { + $('#files-table').empty(); + contents.contents.forEach(element => { + $('#files-table').append(`${element.name}`) + }); + } } //set table details function populateContents(){ - $.ajax('/files/ls'+currDir.loc,{ + $.ajax('/files/ls',{ method:'post', data: currDir, success:(msg)=>{