diff --git a/src/Yavsc/wwwroot/js/fs.js b/src/Yavsc/wwwroot/js/fs.js index 3e327f10..f0dc3134 100644 --- a/src/Yavsc/wwwroot/js/fs.js +++ b/src/Yavsc/wwwroot/js/fs.js @@ -1,93 +1,100 @@ // requires DropZone ยช toMarkdown +if (typeof jQuery === 'undefined') { + throw new Error('YavscRemoteFs script requires jQuery'); +} +if (typeof Dropzone === 'undefined') { + throw new Error('YavscRemoteFs requires Dropzone'); +} +if (typeof updateMD === 'undefined') { + throw new Error('YavscRemoteFs requires md-helpers.js'); +} -window.RemoteFS = (function ($) { - var Combine = function (patha, pathb) { - if (!patha) return pathb; - if (!pathb) return patha; - return patha + '/' + pathb; - }; +(function($, Dropzone, updateMD) { - var OpenDir = function ($view, sub) { - $view.data('path', sub); - InitDir($view); - }; + window.RemoteFS = (function ($) { + + /* + var Combine = function (patha, pathb) { + if (!patha) return pathb; + if (!pathb) return patha; + return patha + '/' + pathb; + }; */ + + var OpenDir = function ($view, sub) { + $view.data('path', sub); + InitDir($view); + }; var InitDir = function ($view) { var path = $view.data('path'); var owner = $view.data('owner'); - var url = path ? '/api/fs/' + path : '/api/fs'; + var fsiourl = path ? '/api/fs/' + path : '/api/fs'; $view.empty(); - $.get(url, function(data) { - - $('').click(function() { - OpenDir($view, null); - }).appendTo($view); - var npath = null; + $.get(fsiourl, function(data) { + $('').click(function() { + OpenDir($view, null); + }).appendTo($view); - if (path) $.each(path.split('/'), function () { - var part = this; - if (npath) npath = npath + '/' + part; - else npath = part; - $('