From 54eefd3d9470365f6f75b6b584a3654bb4fddf51 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 25 Aug 2017 16:07:53 +0200 Subject: [PATCH] replace contacts with contacts2 --- customize.dist/pages.js | 4 -- customize.dist/template.js | 5 +- www/contacts/main.js | 17 ++--- www/{contacts2 => contacts}/messenger-ui.js | 0 www/contacts2/index.html | 30 --------- www/contacts2/inner.html | 17 ----- www/contacts2/main.js | 75 --------------------- 7 files changed, 10 insertions(+), 138 deletions(-) rename www/{contacts2 => contacts}/messenger-ui.js (100%) delete mode 100644 www/contacts2/index.html delete mode 100644 www/contacts2/inner.html delete mode 100644 www/contacts2/main.js diff --git a/customize.dist/pages.js b/customize.dist/pages.js index f9a5addc6..784fc007f 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -657,10 +657,6 @@ 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 a980270a3..062be4308 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|contacts2|drive|settings|profile|todo)\/$/.test(location.pathname); + return /^\/(pad|code|slide|poll|whiteboard|file|media|contacts|drive|settings|profile|todo)\/$/.test(location.pathname); }; var infoPage = function () { @@ -55,9 +55,6 @@ $(function () { } 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/contacts/main.js b/www/contacts/main.js index 4803a812a..f1d58029c 100644 --- a/www/contacts/main.js +++ b/www/contacts/main.js @@ -4,9 +4,12 @@ define([ '/common/toolbar2.js', '/common/cryptpad-common.js', + '/common/common-messenger.js', + '/contacts/messenger-ui.js', + 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/customize/src/less/cryptpad.less', -], function ($, Crypto, Toolbar, Cryptpad) { +], function ($, Crypto, Toolbar, Cryptpad, Messenger, UI) { var Messages = Cryptpad.Messages; var APP = window.APP = { @@ -46,14 +49,11 @@ define([ console.error('reconnecting: ', uid); Cryptpad.findOKButton().click(); - APP.messenger.cleanFriendChannels(); - APP.messenger.openFriendChannels(); - APP.messenger.setEditable(true); + //APP.messenger.cleanFriendChannels(); + //APP.messenger.openFriendChannels(); + //APP.messenger.setEditable(true); }); - var ui = APP.ui = Cryptpad.initMessagingUI(Cryptpad, $list, $messages); - APP.messenger = Cryptpad.initMessaging(Cryptpad, ui); - var $infoBlock = $('
', {'class': 'info'}).appendTo($messages); $('

').text(Messages.contacts_info1).appendTo($infoBlock); var $ul = $('
    ').appendTo($infoBlock); @@ -61,7 +61,8 @@ define([ $('
  • ').text(Messages.contacts_info3).appendTo($ul); //$('
  • ').text(Messages.contacts_info4).appendTo($ul); - Cryptpad.removeLoadingScreen(); + var messenger = window.messenger = Messenger.messenger(Cryptpad); + UI.create(messenger, $list, $messages); }; Cryptpad.ready(function () { diff --git a/www/contacts2/messenger-ui.js b/www/contacts/messenger-ui.js similarity index 100% rename from www/contacts2/messenger-ui.js rename to www/contacts/messenger-ui.js diff --git a/www/contacts2/index.html b/www/contacts2/index.html deleted file mode 100644 index a76879a6d..000000000 --- a/www/contacts2/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - CryptPad - - - - - - - - diff --git a/www/contacts2/inner.html b/www/contacts2/inner.html deleted file mode 100644 index ebfb164c8..000000000 --- a/www/contacts2/inner.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - -
    -
    -
    -
    -
    - - - diff --git a/www/contacts2/main.js b/www/contacts2/main.js deleted file mode 100644 index 664ffc333..000000000 --- a/www/contacts2/main.js +++ /dev/null @@ -1,75 +0,0 @@ -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 = $('
      ').appendTo($infoBlock); - $('
    • ').text(Messages.contacts_info2).appendTo($ul); - $('
    • ').text(Messages.contacts_info3).appendTo($ul); - //$('
    • ').text(Messages.contacts_info4).appendTo($ul); - - var messenger = window.messenger = Messenger.messenger(Cryptpad); - UI.create(messenger, $list, $messages); - }; - - Cryptpad.ready(function () { - andThen(); - Cryptpad.reportAppUsage(); - }); - - }); -});