diff --git a/www/file/inner.js b/www/file/inner.js index 5b3fc66ec..a801e76da 100644 --- a/www/file/inner.js +++ b/www/file/inner.js @@ -175,29 +175,43 @@ define([ }); } - $label.click(function () { - $form.find('input[type="file"]').click(); - }); + var todo = function () { + $label.click(function () { + $form.find('input[type="file"]').click(); + }); - $form.css({ - display: 'block', - }); + $form.css({ + display: 'block', + }); - var fmConfig = { - dropArea: $form, - hoverArea: $label, - body: $body, - keepTable: true // Don't fadeOut the table with the uploaded files - }; + var fmConfig = { + dropArea: $form, + hoverArea: $label, + body: $body, + keepTable: true // Don't fadeOut the table with the uploaded files + }; - var FM = common.createFileManager(fmConfig); + var FM = common.createFileManager(fmConfig); - $form.find("#cp-app-file-upfile").on('change', function (e) { - var file = e.target.files[0]; - FM.handleFile(file); - }); + $form.find("#cp-app-file-upfile").on('change', function (e) { + var file = e.target.files[0]; + FM.handleFile(file); + }); - UI.removeLoadingScreen(); + UI.removeLoadingScreen(); + }; + + var checkOnline = function () { + var priv = metadataMgr.getPrivateData(); + if (priv.offline) { return; } + metadataMgr.off('change', checkOnline); + todo(); + }; + if (priv.offline) { + metadataMgr.onChange(checkOnline); + return; + } + todo(); }; var main = function () { diff --git a/www/file/main.js b/www/file/main.js index ec0b17c6a..c4309692f 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -19,6 +19,7 @@ define([ meta.filehash = Cryptpad.currentPad.hash; }; SFCommonO.start({ + cache: true, hash: hash, href: href, noRealtime: true,