// requires DropZone ยช toMarkdown if (typeof 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) { 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 root; var selection = []; var SetItemSelected = function (name, selected) { if (selected) selection.push(name); else selection = selection.filter(function(ele) { return ele != name; }); }; var RemoveSelectedFiles = function () { var xmlhttp = new XMLHttpRequest(); $.each(selection, function() { xmlhttp.open('DELETE', '/api/fs/' + this, true); xmlhttp.send(); }); }; var InitDir = function ($view) { root = $view.data('path'); var owner = $view.data('owner'); var fsiourl = root ? '/api/fs/' + root : '/api/fs'; $view.empty(); $.get(fsiourl, function(data) { $('').click(function() { OpenDir($view, null); }).appendTo($view); var npath = null; if (root) $.each(root.split('/'), function () { var part = this; if (npath == null) npath = part; else npath = npath + '/' + part; $('').addClass('glyphicon').append().click(function() { RemoveSelectedFiles(); }).appendTo($divedit); $divedit.appendTo($view); var $ftable = $('').css('border-spacing', '6px') .css('border-collapse', 'separate') .append(''); $.each(data.Files, function () { var item = this; var $tr = $(''); var $td = $(''); $('').addClass('check-box').click(function() { SetItemSelected(item.Name, this.checked) }).appendTo($td); $td.append(' '); $('').append(item.Name).click(function() { if (root) document.location = '/' + owner + '/' + root + '/' + item.Name; else document.location = '/files/' + owner + '/' + item.Name; }).appendTo($td); $td.appendTo($tr); $('').appendTo($tr); $('').appendTo($tr); $tr.appendTo($ftable); }); $ftable.appendTo($view); }); }; $(document).ready(function () { OpenDir($('.dirinfo')); }); })($); Dropzone.options.postfiles = { maxFilesize: 20, // MB TODO: let sell it. autoProcessQueue: true, accept: function(file, done) { if (file.name == 'justinbieber.jpg') { done('Naha, you don\'t.'); } else { done(); } }, success: function (file, response) { for (var i = 0; i < response.length; i++) { var filer = response[i]; $('

' + filer.FileName + '

').appendTo('#ql-editor-2'); updateMD('Content', $('#contentview').html()); } }, url: '/api/fs' }; })($, Dropzone, updateMD);
NomTailleModification
' + item.Size + '' + item.LastModified + '