diff --git a/src/Yavsc/Views/Shared/_FSScriptsPartial.cshtml b/src/Yavsc/Views/Shared/_FSScriptsPartial.cshtml index 4098d3ff..43dc0a2b 100644 --- a/src/Yavsc/Views/Shared/_FSScriptsPartial.cshtml +++ b/src/Yavsc/Views/Shared/_FSScriptsPartial.cshtml @@ -1 +1,24 @@ - \ No newline at end of file + + diff --git a/src/Yavsc/wwwroot/js/yavsc-remote-fs.js b/src/Yavsc/wwwroot/js/yavsc-remote-fs.js index 6f541070..5863f4f1 100644 --- a/src/Yavsc/wwwroot/js/yavsc-remote-fs.js +++ b/src/Yavsc/wwwroot/js/yavsc-remote-fs.js @@ -1,128 +1,136 @@ // requires DropZone ª toMarkdown -if (typeof jQuery === 'undefined') { + +if (typeof window.jQuery === 'undefined') { throw new Error('yavsc-remote-fs script requires jQuery'); } -if (typeof Dropzone === 'undefined') { - throw new Error('yavsc-remote-fs requires Dropzone'); -} -if (typeof updateMD === 'undefined') { - throw new Error('yavsc-remote-fs requires md-helpers.js'); -} -(function($, Dropzone, updateMD) { +(function ($) { + $.widget('psc.yarfs', { + options: { + fsnurl: '/api/fs' + }, + root: null, + rmAlert: null, + flist: null, + selection: [], + dirBar: null, + openDir: function (sub) { + var _this = this; + this.root = sub; + var owner = this.element.data('owner'); + this.selection = []; + this.dirBar.empty(); + $('').click(function() { + _this.openDir(null); + }).appendTo(this.dirBar); + var npath = null; - window.RemoteFS = (function ($) { + if (_this.root) { + var dnames = _this.root.split('/'); + $.each(dnames, function () { + var part = this; + if (npath == null) npath = part; + else npath = npath + '/' + part; + $('