From 2ee66b4a01579afd306b6fa5c6e35c4a4e2b575b Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 5 Sep 2019 15:16:28 +0100 Subject: [PATCH] linting js code --- src/Yavsc/wwwroot/js/fs.js | 133 +++++++++++++------------ src/Yavsc/wwwroot/js/md-helpers.js | 16 +-- src/Yavsc/wwwroot/js/md-helpers.min.js | 4 +- 3 files changed, 81 insertions(+), 72 deletions(-) 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; - $('