From 2b077a8e9545b5941688744eff2bd975de338f37 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 12 Dec 2016 18:03:06 +0100 Subject: [PATCH] add the file manager in the main page --- customize.dist/index.html | 4 +++- www/file/file.css | 6 ++++++ www/file/main.js | 39 ++++++++++++++++++++++++++------------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/customize.dist/index.html b/customize.dist/index.html index 6c03cb30b..134683e07 100644 --- a/customize.dist/index.html +++ b/customize.dist/index.html @@ -67,7 +67,7 @@
- + +
diff --git a/www/file/file.css b/www/file/file.css index b2bd0bc28..227cb3735 100644 --- a/www/file/file.css +++ b/www/file/file.css @@ -272,9 +272,15 @@ li { #content .list .element span.name { width: 478px; } +.iframe #content .list .element span.name { + width: 278px; +} #content .list .header span.name { width: 500px; } +.iframe #content .list .header span.name { + width: 300px; +} #content .list .element span.type, #content .list .element span.atime, #content .list .element span.ctime { width: 175px; } diff --git a/www/file/main.js b/www/file/main.js index b54b9908a..1ef78a6b2 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -18,9 +18,7 @@ define([ var saveAs = window.saveAs; var $iframe = $('#pad-iframe').contents(); var ifrw = $('#pad-iframe')[0].contentWindow; - - var hash = window.location.hash || localStorage.FS_hash; - var secret = Cryptpad.getSecrets(hash); + var homePageIframe = false; var ROOT = "root"; var ROOT_NAME = Messages.fm_rootName; @@ -1356,17 +1354,31 @@ define([ - var listmapConfig = module.config = { - data: {}, - websocketURL: Cryptpad.getWebsocketURL(), - channel: secret.channel, - readOnly: false, - validateKey: secret.keys.validateKey || undefined, - crypto: Crypto.createEncryptor(secret.keys), - }; - // don't initialize until the store is ready. Cryptpad.ready(function () { + if (window.location.hash && window.location.hash === "#iframe") { + $('.top-bar').hide(); + $('#pad-iframe').css({ + top: "0px", + height: "100%" + }); + $iframe.find('body').addClass('iframe'); + window.location.hash = ""; + homePageIframe = true; + } + + var hash = window.location.hash || localStorage.FS_hash; + var secret = Cryptpad.getSecrets(hash); + + var listmapConfig = module.config = { + data: {}, + websocketURL: Cryptpad.getWebsocketURL(), + channel: secret.channel, + readOnly: false, + validateKey: secret.keys.validateKey || undefined, + crypto: Crypto.createEncryptor(secret.keys), + }; + var rt = window.rt = module.rt = Listmap.create(listmapConfig); rt.proxy.on('create', function (info) { var realtime = module.realtime = info.realtime; @@ -1394,8 +1406,9 @@ define([ initLocalStorage(); init(rt.proxy); }) - .on('disconnect', function () { + .on('disconnect', function (info) { //setEditable(false); + console.error('err'); Cryptpad.alert(Messages.common_connectionLost); }); });