diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 9e2759786..aac6ddfa7 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -635,6 +635,10 @@ define([ return loadingScreen(); }; + Pages['/contacts2/'] = Pages['/contacts2/index.html'] = function () { + return loadingScreen(); + }; + Pages['/pad/'] = Pages['/pad/index.html'] = function () { return loadingScreen(); }; diff --git a/customize.dist/template.js b/customize.dist/template.js index a9067f35f..a980270a3 100644 --- a/customize.dist/template.js +++ b/customize.dist/template.js @@ -9,7 +9,7 @@ define([ $(function () { var $body = $('body'); var isMainApp = function () { - return /^\/(pad|code|slide|poll|whiteboard|file|media|contacts|drive|settings|profile|todo)\/$/.test(location.pathname); + return /^\/(pad|code|slide|poll|whiteboard|file|media|contacts|contacts2|drive|settings|profile|todo)\/$/.test(location.pathname); }; var infoPage = function () { @@ -52,9 +52,12 @@ $(function () { } else if (/\/file\//.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); require([ '/file/main.js' ], ready); - } else if (/contacts/.test(pathname)) { + } else if (/^\/contacts\/$/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); require([ '/contacts/main.js' ], ready); + } else if (/contacts2/.test(pathname)) { + $('body').append(h('body', Pages[pathname]()).innerHTML); + require([ '/contacts2/main.js' ], ready); } else if (/pad/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); require([ '/pad/main.js' ], ready); diff --git a/www/contacts2/index.html b/www/contacts2/index.html new file mode 100644 index 000000000..a76879a6d --- /dev/null +++ b/www/contacts2/index.html @@ -0,0 +1,30 @@ + + + + CryptPad + + + + + + + + diff --git a/www/contacts2/inner.html b/www/contacts2/inner.html new file mode 100644 index 000000000..ebfb164c8 --- /dev/null +++ b/www/contacts2/inner.html @@ -0,0 +1,17 @@ + + + + + + + + + +
+
+
+
+
+ + + diff --git a/www/contacts2/inner.js b/www/contacts2/inner.js new file mode 100644 index 000000000..556f37ee3 --- /dev/null +++ b/www/contacts2/inner.js @@ -0,0 +1,13 @@ +define([ + 'jquery', + 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', + 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', + 'less!/contacts/main.less', + 'less!/customize/src/less/toolbar.less', +], function ($) { + $('.loading-hidden').removeClass('loading-hidden'); + // dirty hack to get rid the flash of the lock background + setTimeout(function () { + $('#app').addClass('ready'); + }, 100); +}); diff --git a/www/contacts2/main.js b/www/contacts2/main.js new file mode 100644 index 000000000..9e318dac9 --- /dev/null +++ b/www/contacts2/main.js @@ -0,0 +1,81 @@ +define([ + 'jquery', + '/bower_components/chainpad-crypto/crypto.js', + '/common/toolbar2.js', + '/common/cryptpad-common.js', + + '/common/common-messenger.js', + '/contacts2/messenger-ui.js', + + 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', + 'less!/customize/src/less/cryptpad.less', +], function ($, Crypto, Toolbar, Cryptpad, Messenger, UI) { + var Messages = Cryptpad.Messages; + + var APP = window.APP = { + Cryptpad: Cryptpad + }; + + $(function () { + + var andThen = function () { + Cryptpad.addLoadingScreen(); + + var ifrw = $('#pad-iframe')[0].contentWindow; + var $iframe = $('#pad-iframe').contents(); + //var $appContainer = $iframe.find('#app'); + var $list = $iframe.find('#friendList'); + var $messages = $iframe.find('#messaging'); + var $bar = $iframe.find('.toolbar-container'); + + var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle']; + + + var configTb = { + displayed: displayed, + ifrw: ifrw, + common: Cryptpad, + $container: $bar, + network: Cryptpad.getNetwork(), + pageTitle: Messages.contacts_title, + }; + var toolbar = APP.toolbar = Toolbar.create(configTb); + toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar + + Cryptpad.getProxy().on('disconnect', function () { + Cryptpad.alert(Messages.common_connectionLost, undefined, true); + Cryptpad.enableMessaging(false); + }); + Cryptpad.getProxy().on('reconnect', function (uid) { + console.error('reconnecting: ', uid); + Cryptpad.findOKButton().click(); + + //APP.messenger.cleanFriendChannels(); + //APP.messenger.openFriendChannels(); + //APP.messenger.setEditable(true); + }); + + var $infoBlock = $('
', {'class': 'info'}).appendTo($messages); + $('

').text(Messages.contacts_info1).appendTo($infoBlock); + var $ul = $('