WIP RPC code
This commit is contained in:
@@ -106,7 +106,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
@@ -225,7 +225,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
&#shareButton {
|
&#shareButton, &.btn.btn-success {
|
||||||
// Bootstrap 4 colors
|
// Bootstrap 4 colors
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: @toolbar-green;
|
background: @toolbar-green;
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&#newdoc {
|
&#newdoc, &.btn.btn-primary {
|
||||||
// Bootstrap 4 colors
|
// Bootstrap 4 colors
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #0275d8;
|
background: #0275d8;
|
||||||
@@ -77,10 +77,21 @@
|
|||||||
&.hidden {
|
&.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bootstrap 4 colors (btn-secondary)
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: .25rem;
|
||||||
|
color: #292b2c;
|
||||||
|
background-color: #fff;
|
||||||
|
border-color: #ccc;
|
||||||
|
&:hover {
|
||||||
|
color: #292b2c;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryptpad-limit {
|
.cryptpad-limit {
|
||||||
color: red;
|
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
@@ -88,10 +99,11 @@
|
|||||||
padding: 3px;
|
padding: 3px;
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
font-size: 20px;
|
|
||||||
span {
|
span {
|
||||||
|
color: red;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,17 +207,6 @@
|
|||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
|
||||||
color: #000;
|
|
||||||
background-color: inherit;
|
|
||||||
background-image: linear-gradient(to bottom,#fff,#e4e4e4);
|
|
||||||
border: 1px solid #A6A6A6;
|
|
||||||
border-bottom-color: #979797;
|
|
||||||
border-radius: 3px;
|
|
||||||
&:hover {
|
|
||||||
background-image:linear-gradient(to bottom,#f2f2f2,#ccc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.cryptpad-state {
|
.cryptpad-state {
|
||||||
line-height: 32px; /* equivalent to 26px + 2*2px margin used for buttons */
|
line-height: 32px; /* equivalent to 26px + 2*2px margin used for buttons */
|
||||||
}
|
}
|
||||||
@@ -429,13 +430,19 @@
|
|||||||
display: none;
|
display: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
.next {
|
.next {
|
||||||
float: right;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 20px;
|
||||||
}
|
}
|
||||||
.previous {
|
.previous {
|
||||||
float: left;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 20px;
|
||||||
}
|
}
|
||||||
.goto {
|
.goto {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
input { width: 50px; }
|
input { width: 50px; }
|
||||||
}
|
}
|
||||||
.gotoInput {
|
.gotoInput {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
@@ -117,41 +117,60 @@
|
|||||||
.cryptpad-toolbar a {
|
.cryptpad-toolbar a {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#shareButton {
|
.cryptpad-toolbar button {
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: .25rem;
|
||||||
|
color: #292b2c;
|
||||||
|
background-color: #fff;
|
||||||
|
border-color: #ccc;
|
||||||
|
}
|
||||||
|
.cryptpad-toolbar button#shareButton,
|
||||||
|
.cryptpad-toolbar button.btn.btn-success {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #5cb85c;
|
background: #5cb85c;
|
||||||
border-color: #5cb85c;
|
border-color: #5cb85c;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#shareButton:hover {
|
.cryptpad-toolbar button#shareButton:hover,
|
||||||
|
.cryptpad-toolbar button.btn.btn-success:hover {
|
||||||
background: #449d44;
|
background: #449d44;
|
||||||
border: 1px solid #419641;
|
border: 1px solid #419641;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#shareButton span {
|
.cryptpad-toolbar button#shareButton span,
|
||||||
|
.cryptpad-toolbar button.btn.btn-success span {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#shareButton .large {
|
.cryptpad-toolbar button#shareButton .large,
|
||||||
|
.cryptpad-toolbar button.btn.btn-success .large {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#newdoc {
|
.cryptpad-toolbar button#newdoc,
|
||||||
|
.cryptpad-toolbar button.btn.btn-primary {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #0275d8;
|
background: #0275d8;
|
||||||
border-color: #0275d8;
|
border-color: #0275d8;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#newdoc:hover {
|
.cryptpad-toolbar button#newdoc:hover,
|
||||||
|
.cryptpad-toolbar button.btn.btn-primary:hover {
|
||||||
background: #025aa5;
|
background: #025aa5;
|
||||||
border: 1px solid #01549b;
|
border: 1px solid #01549b;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#newdoc span {
|
.cryptpad-toolbar button#newdoc span,
|
||||||
|
.cryptpad-toolbar button.btn.btn-primary span {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button#newdoc .large {
|
.cryptpad-toolbar button#newdoc .large,
|
||||||
|
.cryptpad-toolbar button.btn.btn-primary .large {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button.hidden {
|
.cryptpad-toolbar button.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.cryptpad-toolbar button:hover {
|
||||||
|
color: #292b2c;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
.cryptpad-toolbar .cryptpad-limit {
|
.cryptpad-toolbar .cryptpad-limit {
|
||||||
color: red;
|
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
@@ -159,11 +178,12 @@
|
|||||||
padding: 3px;
|
padding: 3px;
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
font-size: 20px;
|
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar .cryptpad-limit span {
|
.cryptpad-toolbar .cryptpad-limit span {
|
||||||
|
color: red;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar .cryptpad-lag {
|
.cryptpad-toolbar .cryptpad-lag {
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
@@ -265,17 +285,6 @@
|
|||||||
margin-top: -3px;
|
margin-top: -3px;
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar button {
|
|
||||||
color: #000;
|
|
||||||
background-color: inherit;
|
|
||||||
background-image: linear-gradient(to bottom, #fff, #e4e4e4);
|
|
||||||
border: 1px solid #A6A6A6;
|
|
||||||
border-bottom-color: #979797;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
.cryptpad-toolbar button:hover {
|
|
||||||
background-image: linear-gradient(to bottom, #f2f2f2, #ccc);
|
|
||||||
}
|
|
||||||
.cryptpad-toolbar .cryptpad-state {
|
.cryptpad-toolbar .cryptpad-state {
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
/* equivalent to 26px + 2*2px margin used for buttons */
|
/* equivalent to 26px + 2*2px margin used for buttons */
|
||||||
@@ -492,13 +501,19 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar-history .next {
|
.cryptpad-toolbar-history .next {
|
||||||
float: right;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 20px;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar-history .previous {
|
.cryptpad-toolbar-history .previous {
|
||||||
float: left;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 20px;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar-history .goto {
|
.cryptpad-toolbar-history .goto {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar-history .goto input {
|
.cryptpad-toolbar-history .goto input {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ define(function () {
|
|||||||
out.history_restoreTitle = "Restaurer la version du document sélectionnée";
|
out.history_restoreTitle = "Restaurer la version du document sélectionnée";
|
||||||
out.history_restorePrompt = "Êtes-vous sûr de vouloir remplacer la version actuelle du document par la version affichée ?";
|
out.history_restorePrompt = "Êtes-vous sûr de vouloir remplacer la version actuelle du document par la version affichée ?";
|
||||||
out.history_restoreDone = "Document restauré";
|
out.history_restoreDone = "Document restauré";
|
||||||
|
out.history_version = "Version :";
|
||||||
|
|
||||||
// Polls
|
// Polls
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ define(function () {
|
|||||||
out.history_restoreTitle = "Restore the selected version of the document";
|
out.history_restoreTitle = "Restore the selected version of the document";
|
||||||
out.history_restorePrompt = "Are you sure you want to replace the current version of the document by the displayed one?";
|
out.history_restorePrompt = "Are you sure you want to replace the current version of the document by the displayed one?";
|
||||||
out.history_restoreDone = "Document restored";
|
out.history_restoreDone = "Document restored";
|
||||||
|
out.history_version = "Version:";
|
||||||
|
|
||||||
// Polls
|
// Polls
|
||||||
|
|
||||||
|
|||||||
24
rpc.js
24
rpc.js
@@ -390,7 +390,20 @@ var safeMkdir = function (path, cb) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var upload = function (store, Sessions, publicKey, cb) {
|
var upload = function (store, Sessions, publicKey, cb) {
|
||||||
|
/*
|
||||||
|
1. check if there is an upload in progress
|
||||||
|
* if yes, return error
|
||||||
|
2.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
console.log('UPLOAD_NOT_IMPLEMENTED');
|
||||||
|
cb('NOT_IMPLEMENTED');
|
||||||
|
};
|
||||||
|
|
||||||
|
var cancelUpload = function (store, Sessions, publicKey, cb) {
|
||||||
|
console.log('CANCEL_UPLOAD_NOT_IMPLEMENTED');
|
||||||
|
cb('NOT_IMPLEMENTED');
|
||||||
};
|
};
|
||||||
|
|
||||||
/*::const ConfigType = require('./config.example.js');*/
|
/*::const ConfigType = require('./config.example.js');*/
|
||||||
@@ -504,6 +517,15 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
|
|||||||
if (e) { return void Respond(e); }
|
if (e) { return void Respond(e); }
|
||||||
Respond(void 0, dict);
|
Respond(void 0, dict);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
case 'UPLOAD':
|
||||||
|
return void upload(null, null, null, function (e) {
|
||||||
|
Respond(e);
|
||||||
|
});
|
||||||
|
case 'CANCEL_UPLOAD':
|
||||||
|
return void cancelUpload(null, null, null, function (e) {
|
||||||
|
Respond(e);
|
||||||
|
});
|
||||||
default:
|
default:
|
||||||
return void Respond('UNSUPPORTED_RPC_CALL', msg);
|
return void Respond('UNSUPPORTED_RPC_CALL', msg);
|
||||||
}
|
}
|
||||||
@@ -531,7 +553,7 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
|
|||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
expireSessions(Sessions);
|
expireSessions(Sessions);
|
||||||
}, 60000);
|
}, 60000);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -270,5 +270,10 @@ Version 2
|
|||||||
return '/blob/' + id.slice(0,2) + '/' + id;
|
return '/blob/' + id.slice(0,2) + '/' + id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var serializeHash = Hash.serializeHash = function (hash) {
|
||||||
|
if (hash && hash.slice(-1) !== "/") { hash += "/"; }
|
||||||
|
return hash;
|
||||||
|
};
|
||||||
|
|
||||||
return Hash;
|
return Hash;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ define([
|
|||||||
|
|
||||||
var create = History.create = function (common, config) {
|
var create = History.create = function (common, config) {
|
||||||
if (!config.$toolbar) { return void console.error("config.$toolbar is undefined");}
|
if (!config.$toolbar) { return void console.error("config.$toolbar is undefined");}
|
||||||
|
if (History.loading) { return void console.error("History is already being loaded..."); }
|
||||||
|
History.loading = true;
|
||||||
var $toolbar = config.$toolbar;
|
var $toolbar = config.$toolbar;
|
||||||
var noFunc = function () {};
|
var noFunc = function () {};
|
||||||
var render = config.onRender || noFunc;
|
var render = config.onRender || noFunc;
|
||||||
@@ -112,9 +114,9 @@ define([
|
|||||||
var val = states[i].getContent().doc;
|
var val = states[i].getContent().doc;
|
||||||
c = i;
|
c = i;
|
||||||
if (typeof onUpdate === "function") { onUpdate(); }
|
if (typeof onUpdate === "function") { onUpdate(); }
|
||||||
$hist.find('.next, .previous').show();
|
$hist.find('.next, .previous').css('visibility', '');
|
||||||
if (c === states.length - 1) { $hist.find('.next').hide(); }
|
if (c === states.length - 1) { $hist.find('.next').css('visibility', 'hidden'); }
|
||||||
if (c === 0) { $hist.find('.previous').hide(); }
|
if (c === 0) { $hist.find('.previous').css('visibility', 'hidden'); }
|
||||||
return val || '';
|
return val || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,15 +134,16 @@ define([
|
|||||||
$right.hide();
|
$right.hide();
|
||||||
$cke.hide();
|
$cke.hide();
|
||||||
var $prev =$('<button>', {
|
var $prev =$('<button>', {
|
||||||
'class': 'previous fa fa-step-backward',
|
'class': 'previous fa fa-step-backward btn btn-primary',
|
||||||
title: Messages.history_prev
|
title: Messages.history_prev
|
||||||
}).appendTo($hist);
|
}).appendTo($hist);
|
||||||
|
var $nav = $('<div>', {'class': 'goto'}).appendTo($hist);
|
||||||
var $next = $('<button>', {
|
var $next = $('<button>', {
|
||||||
'class': 'next fa fa-step-forward',
|
'class': 'next fa fa-step-forward btn btn-primary',
|
||||||
title: Messages.history_next
|
title: Messages.history_next
|
||||||
}).appendTo($hist);
|
}).appendTo($hist);
|
||||||
|
|
||||||
var $nav = $('<div>', {'class': 'goto'}).appendTo($hist);
|
var $label = $('<label>').text(Messages.history_version).appendTo($nav);
|
||||||
var $cur = $('<input>', {
|
var $cur = $('<input>', {
|
||||||
'class' : 'gotoInput',
|
'class' : 'gotoInput',
|
||||||
'type' : 'number',
|
'type' : 'number',
|
||||||
@@ -151,19 +154,15 @@ define([
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
var $label = $('<label>').text(' / '+ states.length).appendTo($nav);
|
var $label = $('<label>').text(' / '+ states.length).appendTo($nav);
|
||||||
var $goTo = $('<button>', {
|
|
||||||
'class': 'fa fa-check',
|
|
||||||
'title': Messages.history_goTo
|
|
||||||
}).appendTo($nav);
|
|
||||||
$('<br>').appendTo($nav);
|
$('<br>').appendTo($nav);
|
||||||
var $rev = $('<button>', {
|
|
||||||
'class':'revertHistory',
|
|
||||||
title: Messages.history_restoreTitle
|
|
||||||
}).text(Messages.history_restore).appendTo($nav);
|
|
||||||
var $close = $('<button>', {
|
var $close = $('<button>', {
|
||||||
'class':'closeHistory',
|
'class':'closeHistory',
|
||||||
title: Messages.history_closeTitle
|
title: Messages.history_closeTitle
|
||||||
}).text(Messages.history_close).appendTo($nav);
|
}).text(Messages.history_close).appendTo($nav);
|
||||||
|
var $rev = $('<button>', {
|
||||||
|
'class':'revertHistory btn btn-success',
|
||||||
|
title: Messages.history_restoreTitle
|
||||||
|
}).text(Messages.history_restore).appendTo($nav);
|
||||||
|
|
||||||
onUpdate = function () {
|
onUpdate = function () {
|
||||||
$cur.attr('max', states.length);
|
$cur.attr('max', states.length);
|
||||||
@@ -181,7 +180,6 @@ define([
|
|||||||
// Buttons actions
|
// Buttons actions
|
||||||
$prev.click(function () { render(getPrevious()); });
|
$prev.click(function () { render(getPrevious()); });
|
||||||
$next.click(function () { render(getNext()); });
|
$next.click(function () { render(getNext()); });
|
||||||
$goTo.click(function () { render( get($cur.val() - 1) ); });
|
|
||||||
$cur.keydown(function (e) {
|
$cur.keydown(function (e) {
|
||||||
var p = function () { e.preventDefault(); };
|
var p = function () { e.preventDefault(); };
|
||||||
if (e.which === 13) { p(); return render( get($cur.val() - 1) ); } // Enter
|
if (e.which === 13) { p(); return render( get($cur.val() - 1) ); } // Enter
|
||||||
@@ -192,7 +190,7 @@ define([
|
|||||||
if (e.which === 27) { p(); $close.click(); }
|
if (e.which === 27) { p(); $close.click(); }
|
||||||
}).focus();
|
}).focus();
|
||||||
$cur.on('change', function () {
|
$cur.on('change', function () {
|
||||||
$goTo.click();
|
render( get($cur.val() - 1) );
|
||||||
});
|
});
|
||||||
$close.click(function () {
|
$close.click(function () {
|
||||||
states = [];
|
states = [];
|
||||||
@@ -214,6 +212,7 @@ define([
|
|||||||
|
|
||||||
// Load all the history messages into a new chainpad object
|
// Load all the history messages into a new chainpad object
|
||||||
loadHistory(common, function (err, newRt) {
|
loadHistory(common, function (err, newRt) {
|
||||||
|
History.loading = false;
|
||||||
if (err) { throw new Error(err); }
|
if (err) { throw new Error(err); }
|
||||||
realtime = newRt;
|
realtime = newRt;
|
||||||
update();
|
update();
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ define([
|
|||||||
common.createChannelId = Hash.createChannelId;
|
common.createChannelId = Hash.createChannelId;
|
||||||
common.findWeaker = Hash.findWeaker;
|
common.findWeaker = Hash.findWeaker;
|
||||||
common.findStronger = Hash.findStronger;
|
common.findStronger = Hash.findStronger;
|
||||||
|
common.serializeHash = Hash.serializeHash;
|
||||||
|
|
||||||
// History
|
// History
|
||||||
common.getHistory = function (config) { return History.create(common, config); };
|
common.getHistory = function (config) { return History.create(common, config); };
|
||||||
@@ -166,6 +167,7 @@ define([
|
|||||||
var login = common.login = function (hash, name, cb) {
|
var login = common.login = function (hash, name, cb) {
|
||||||
if (!hash) { throw new Error('expected a user hash'); }
|
if (!hash) { throw new Error('expected a user hash'); }
|
||||||
if (!name) { throw new Error('expected a user name'); }
|
if (!name) { throw new Error('expected a user name'); }
|
||||||
|
hash = common.serializeHash(hash);
|
||||||
localStorage.setItem(userHashKey, hash);
|
localStorage.setItem(userHashKey, hash);
|
||||||
localStorage.setItem(userNameKey, name);
|
localStorage.setItem(userNameKey, name);
|
||||||
if (cb) { cb(); }
|
if (cb) { cb(); }
|
||||||
@@ -216,11 +218,12 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var getUserHash = common.getUserHash = function () {
|
var getUserHash = common.getUserHash = function () {
|
||||||
var hash;
|
var hash = localStorage[userHashKey];
|
||||||
[sessionStorage, localStorage].some(function (s) {
|
|
||||||
var h = s[userHashKey];
|
if (hash) {
|
||||||
if (h) { return (hash = h); }
|
var sHash = common.serializeHash(hash);
|
||||||
});
|
if (sHash !== hash) { localStorage[userHashKey] = sHash; }
|
||||||
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -731,7 +731,7 @@ define([
|
|||||||
parentEl[newName] = element;
|
parentEl[newName] = element;
|
||||||
parentEl[oldName] = undefined;
|
parentEl[oldName] = undefined;
|
||||||
delete parentEl[oldName];
|
delete parentEl[oldName];
|
||||||
cb();
|
if (typeof cb === "function") { cb(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// REPLACE
|
// REPLACE
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
$content.on('mousedown', function (e) {
|
$content.on('mousedown', function (e) {
|
||||||
console.log('down');
|
if (e.which !== 1) { return; }
|
||||||
sel.down = true;
|
sel.down = true;
|
||||||
if (!e.ctrlKey) { removeSelected(); }
|
if (!e.ctrlKey) { removeSelected(); }
|
||||||
var rect = e.currentTarget.getBoundingClientRect();
|
var rect = e.currentTarget.getBoundingClientRect();
|
||||||
@@ -298,7 +298,7 @@ define([
|
|||||||
width: '0px',
|
width: '0px',
|
||||||
height: '0px'
|
height: '0px'
|
||||||
});
|
});
|
||||||
if (sel.move) { console.log('ret'); return; }
|
if (sel.move) { return; }
|
||||||
sel.move = function (ev) {
|
sel.move = function (ev) {
|
||||||
var rectMove = ev.currentTarget.getBoundingClientRect(),
|
var rectMove = ev.currentTarget.getBoundingClientRect(),
|
||||||
offX = ev.clientX - rectMove.left,
|
offX = ev.clientX - rectMove.left,
|
||||||
@@ -342,7 +342,6 @@ define([
|
|||||||
sel.to = undefined;
|
sel.to = undefined;
|
||||||
}, (sel.refresh - diffT));
|
}, (sel.refresh - diffT));
|
||||||
}
|
}
|
||||||
console.log('cancelled');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sel.update = +new Date();
|
sel.update = +new Date();
|
||||||
@@ -351,7 +350,7 @@ define([
|
|||||||
$content.mousemove(sel.move);
|
$content.mousemove(sel.move);
|
||||||
});
|
});
|
||||||
$content.on('mouseup', function (e) {
|
$content.on('mouseup', function (e) {
|
||||||
console.log(sel.pos);
|
if (e.which !== 1) { return; }
|
||||||
sel.down = false;
|
sel.down = false;
|
||||||
sel.$selectBox.hide();
|
sel.$selectBox.hide();
|
||||||
$content.off('mousemove', sel.move);
|
$content.off('mousemove', sel.move);
|
||||||
@@ -640,6 +639,36 @@ define([
|
|||||||
updateContextButton();
|
updateContextButton();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var displayMenu = function (e, $menu) {
|
||||||
|
$menu.css({ display: "block" });
|
||||||
|
var h = $menu.outerHeight();
|
||||||
|
var w = $menu.outerWidth();
|
||||||
|
var wH = window.innerHeight;
|
||||||
|
var wW = window.innerWidth;
|
||||||
|
if (e.pageY + h <= wH) {
|
||||||
|
$menu.css({
|
||||||
|
top: e.pageY+'px',
|
||||||
|
bottom: ''
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$menu.css({
|
||||||
|
bottom: '0px',
|
||||||
|
top: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (e.pageX + w <= wW) {
|
||||||
|
$menu.css({
|
||||||
|
left: e.pageX+'px',
|
||||||
|
right: ''
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$menu.css({
|
||||||
|
left: '',
|
||||||
|
right: '0px',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Open the selected context menu on the closest "li" element
|
// Open the selected context menu on the closest "li" element
|
||||||
var openContextMenu = function (e, $menu) {
|
var openContextMenu = function (e, $menu) {
|
||||||
module.hideMenu();
|
module.hideMenu();
|
||||||
@@ -664,11 +693,7 @@ define([
|
|||||||
$a.parent('li').hide();
|
$a.parent('li').hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$menu.css({
|
displayMenu(e, $menu);
|
||||||
display: "block",
|
|
||||||
left: e.pageX,
|
|
||||||
top: e.pageY
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($menu.find('li:visible').length === 0) {
|
if ($menu.find('li:visible').length === 0) {
|
||||||
debug("No visible element in the context menu. Abort.");
|
debug("No visible element in the context menu. Abort.");
|
||||||
@@ -730,11 +755,7 @@ define([
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$menu.css({
|
displayMenu(e, $menu);
|
||||||
display: "block",
|
|
||||||
left: e.pageX,
|
|
||||||
top: e.pageY
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($menu.find('li:visible').length === 0) {
|
if ($menu.find('li:visible').length === 0) {
|
||||||
debug("No visible element in the context menu. Abort.");
|
debug("No visible element in the context menu. Abort.");
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li class="title" data-localization="footer_contact"><li>
|
<li class="title" data-localization="footer_contact"><li>
|
||||||
<li><a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" target="_blank" rel="noopener noreferrer">IRC</a></li>
|
<li><a href="https://riot.im/app/#/room/!cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li>
|
||||||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li>
|
||||||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li>
|
||||||
<li><a href="/contact.html">Email</a></li>
|
<li><a href="/contact.html">Email</a></li>
|
||||||
|
|||||||
Reference in New Issue
Block a user