replace contacts with contacts2

pull/1/head
ansuz 7 years ago
parent 57d0c6c973
commit 54eefd3d94

@ -657,10 +657,6 @@ define([
return loadingScreen(); return loadingScreen();
}; };
Pages['/contacts2/'] = Pages['/contacts2/index.html'] = function () {
return loadingScreen();
};
Pages['/pad/'] = Pages['/pad/index.html'] = function () { Pages['/pad/'] = Pages['/pad/index.html'] = function () {
return loadingScreen(); return loadingScreen();
}; };

@ -9,7 +9,7 @@ define([
$(function () { $(function () {
var $body = $('body'); var $body = $('body');
var isMainApp = function () { 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 () { var infoPage = function () {
@ -55,9 +55,6 @@ $(function () {
} else if (/^\/contacts\/$/.test(pathname)) { } else if (/^\/contacts\/$/.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML); $('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/contacts/main.js' ], ready); 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)) { } else if (/pad/.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML); $('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/pad/main.js' ], ready); require([ '/pad/main.js' ], ready);

@ -4,9 +4,12 @@ define([
'/common/toolbar2.js', '/common/toolbar2.js',
'/common/cryptpad-common.js', '/common/cryptpad-common.js',
'/common/common-messenger.js',
'/contacts/messenger-ui.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less', 'less!/customize/src/less/cryptpad.less',
], function ($, Crypto, Toolbar, Cryptpad) { ], function ($, Crypto, Toolbar, Cryptpad, Messenger, UI) {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
var APP = window.APP = { var APP = window.APP = {
@ -46,14 +49,11 @@ define([
console.error('reconnecting: ', uid); console.error('reconnecting: ', uid);
Cryptpad.findOKButton().click(); Cryptpad.findOKButton().click();
APP.messenger.cleanFriendChannels(); //APP.messenger.cleanFriendChannels();
APP.messenger.openFriendChannels(); //APP.messenger.openFriendChannels();
APP.messenger.setEditable(true); //APP.messenger.setEditable(true);
}); });
var ui = APP.ui = Cryptpad.initMessagingUI(Cryptpad, $list, $messages);
APP.messenger = Cryptpad.initMessaging(Cryptpad, ui);
var $infoBlock = $('<div>', {'class': 'info'}).appendTo($messages); var $infoBlock = $('<div>', {'class': 'info'}).appendTo($messages);
$('<h2>').text(Messages.contacts_info1).appendTo($infoBlock); $('<h2>').text(Messages.contacts_info1).appendTo($infoBlock);
var $ul = $('<ul>').appendTo($infoBlock); var $ul = $('<ul>').appendTo($infoBlock);
@ -61,7 +61,8 @@ define([
$('<li>').text(Messages.contacts_info3).appendTo($ul); $('<li>').text(Messages.contacts_info3).appendTo($ul);
//$('<li>').text(Messages.contacts_info4).appendTo($ul); //$('<li>').text(Messages.contacts_info4).appendTo($ul);
Cryptpad.removeLoadingScreen(); var messenger = window.messenger = Messenger.messenger(Cryptpad);
UI.create(messenger, $list, $messages);
}; };
Cryptpad.ready(function () { Cryptpad.ready(function () {

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html class="cp pad">
<head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script async data-bootload="/customize/template.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.1.15"></script>
<style>
html, body {
margin: 0px;
padding: 0px;
}
#pad-iframe {
position:fixed;
top:0px;
left:0px;
bottom:0px;
right:0px;
width:100%;
height:100%;
border:none;
margin:0;
padding:0;
overflow:hidden;
}
</style>
</head>
<body>
<iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script async data-bootload="/contacts/inner.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.1.15"></script>
<style>.loading-hidden, .loading-hidden * {display: none !important;}</style>
</head>
<body class="loading-hidden">
<div id="toolbar" class="toolbar-container"></div>
<div id="app">
<div id="friendList"></div>
<div id="messaging"></div>
</div>
</body>
</html>

@ -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 = $('<div>', {'class': 'info'}).appendTo($messages);
$('<h2>').text(Messages.contacts_info1).appendTo($infoBlock);
var $ul = $('<ul>').appendTo($infoBlock);
$('<li>').text(Messages.contacts_info2).appendTo($ul);
$('<li>').text(Messages.contacts_info3).appendTo($ul);
//$('<li>').text(Messages.contacts_info4).appendTo($ul);
var messenger = window.messenger = Messenger.messenger(Cryptpad);
UI.create(messenger, $list, $messages);
};
Cryptpad.ready(function () {
andThen();
Cryptpad.reportAppUsage();
});
});
});
Loading…
Cancel
Save