Manual merge, update the CSS in loading.js and document that loading.less does nothing.
This commit is contained in:
commit
b24e9b84af
@ -438,12 +438,12 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var loadingScreen = Pages.loadingScreen = function () {
|
var loadingScreen = Pages.loadingScreen = function () {
|
||||||
return h('div#loading',
|
return h('div#cp-loading',
|
||||||
h('div.loadingContainer', [
|
h('div.cp-loading-container', [
|
||||||
h('img.cryptofist', {
|
h('img.cp-loading-cryptofist', {
|
||||||
src: '/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs
|
src: '/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs
|
||||||
}),
|
}),
|
||||||
h('div.spinnerContainer',
|
h('div.cp-loading-spinner-container',
|
||||||
h('span.fa.fa-circle-o-notch.fa-spin.fa-4x.fa-fw')),
|
h('span.fa.fa-circle-o-notch.fa-spin.fa-4x.fa-fw')),
|
||||||
h('p'),
|
h('p'),
|
||||||
])
|
])
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
@import "../less2/include/colortheme.less";
|
@import "../less2/include/colortheme.less";
|
||||||
@import "../less2/include/modal.less";
|
@import "../less2/include/modal.less";
|
||||||
@import "../less2/include/font.less";
|
@import "../less2/include/font.less";
|
||||||
|
@import "../less2/loading.less";
|
||||||
@import "./bar.less";
|
@import "./bar.less";
|
||||||
@import "./loading.less";
|
|
||||||
@import "./dropdown.less";
|
@import "./dropdown.less";
|
||||||
@import "./topbar.less";
|
@import "./topbar.less";
|
||||||
@import "./footer.less";
|
@import "./footer.less";
|
||||||
@ -296,7 +296,7 @@ noscript {
|
|||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 2;
|
z-index: 2; // noscriptContainer
|
||||||
#noscript {
|
#noscript {
|
||||||
width: 1000px;
|
width: 1000px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -341,7 +341,7 @@ noscript {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
z-index: 1;
|
z-index: 1; // #main, #main_other
|
||||||
|
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ noscript {
|
|||||||
background: blue;
|
background: blue;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index:1;
|
z-index:1; // .usage
|
||||||
&.normal {
|
&.normal {
|
||||||
background: @toolbar-green;
|
background: @toolbar-green;
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ noscript {
|
|||||||
position: relative;
|
position: relative;
|
||||||
color: black;
|
color: black;
|
||||||
text-shadow: 1px 0 2px white, 0 1px 2px white, -1px 0 2px white, 0 -1px 2px white;
|
text-shadow: 1px 0 2px white, 0 1px 2px white, -1px 0 2px white, 0 -1px 2px white;
|
||||||
z-index: 2;
|
z-index: 2; // .usageText
|
||||||
font-size: @main-font-size;
|
font-size: @main-font-size;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -644,7 +644,7 @@ noscript {
|
|||||||
bottom: 10vh;
|
bottom: 10vh;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 10000;
|
z-index: 10000; // #uploadStatusContainer
|
||||||
display: none;
|
display: none;
|
||||||
#uploadStatus {
|
#uploadStatus {
|
||||||
width: 80vw;
|
width: 80vw;
|
||||||
@ -674,7 +674,7 @@ noscript {
|
|||||||
left: @upload_pad_v;
|
left: @upload_pad_v;
|
||||||
top: @upload_pad_h; bottom: @upload_pad_h;
|
top: @upload_pad_h; bottom: @upload_pad_h;
|
||||||
background-color: rgba(0,0,255,0.3);
|
background-color: rgba(0,0,255,0.3);
|
||||||
z-index: -1;
|
z-index: -1; // .progressContainer
|
||||||
}
|
}
|
||||||
.upCancel { text-align: center; }
|
.upCancel { text-align: center; }
|
||||||
.fa.cancel {
|
.fa.cancel {
|
||||||
|
|||||||
@ -259,7 +259,7 @@ body .cryptpad-toolbar {
|
|||||||
|
|
||||||
font: @toolbar-button-font;
|
font: @toolbar-button-font;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 9001;
|
z-index: 10000; // body, .cryptpad-toolbar
|
||||||
|
|
||||||
.cp-dropdown-container {
|
.cp-dropdown-container {
|
||||||
//height: 100%;
|
//height: 100%;
|
||||||
@ -792,7 +792,7 @@ body .cryptpad-toolbar {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.cryptpad-user-dropdown {
|
.cryptpad-user-dropdown {
|
||||||
z-index: 10000;
|
z-index: 10000; // .cryptpad-user-dropdown
|
||||||
//margin-left: 20px;
|
//margin-left: 20px;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
@ -915,7 +915,7 @@ body .cryptpad-toolbar {
|
|||||||
background: @dropdown-bg;
|
background: @dropdown-bg;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
z-index:10000;
|
z-index:10000; // .drawer-content
|
||||||
color: black;
|
color: black;
|
||||||
.fa {
|
.fa {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 99999; // alertify container
|
z-index: 100000; // alertify container
|
||||||
&.forefront {
|
&.forefront {
|
||||||
z-index: @max-z-index; // alertify max forefront
|
z-index: @max-z-index; // alertify max forefront
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,9 @@
|
|||||||
@colortheme_modal-link-visited: lighten(@colortheme_modal-link, 10%);
|
@colortheme_modal-link-visited: lighten(@colortheme_modal-link, 10%);
|
||||||
@colortheme_modal-dim: rgba(0, 0, 0, 0.4);
|
@colortheme_modal-dim: rgba(0, 0, 0, 0.4);
|
||||||
|
|
||||||
|
@colortheme_loading-bg: #222;
|
||||||
|
@colortheme_loading-color: @colortheme_old-fore;
|
||||||
|
|
||||||
@colortheme_modal-input: #111;
|
@colortheme_modal-input: #111;
|
||||||
|
|
||||||
@colortheme_alertify-red: #E55236;
|
@colortheme_alertify-red: #E55236;
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
background-color: @colortheme_dropdown-bg;
|
background-color: @colortheme_dropdown-bg;
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2);
|
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2);
|
||||||
z-index: 1000;
|
z-index: 1000; //Z dropdown content
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
font: @dropdown_font;
|
font: @dropdown_font;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
bottom: 10vh;
|
bottom: 10vh;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 1000000;
|
z-index: 1000000; //Z file upload table container
|
||||||
display: none;
|
display: none;
|
||||||
#cp-fileupload-table {
|
#cp-fileupload-table {
|
||||||
width: 80vw;
|
width: 80vw;
|
||||||
@ -40,7 +40,7 @@
|
|||||||
left: @upload_pad_v;
|
left: @upload_pad_v;
|
||||||
top: @upload_pad_h; bottom: @upload_pad_h;
|
top: @upload_pad_h; bottom: @upload_pad_h;
|
||||||
background-color: rgba(0,0,255,0.3);
|
background-color: rgba(0,0,255,0.3);
|
||||||
z-index: -1;
|
z-index: -1; //Z file upload progress container
|
||||||
}
|
}
|
||||||
.cp-fileupload-table-cancel { text-align: center; }
|
.cp-fileupload-table-cancel { text-align: center; }
|
||||||
.fa.cancel {
|
.fa.cancel {
|
||||||
|
|||||||
@ -117,7 +117,7 @@
|
|||||||
.infopages_topbar () {
|
.infopages_topbar () {
|
||||||
.cp-topbar {
|
.cp-topbar {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
z-index: 9001;
|
z-index: 10000; //Z infopage toolbar
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
.cp-modal-container {
|
.cp-modal-container {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
z-index: 100000;
|
z-index: 100000; //Z modal container
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
@ -274,7 +274,7 @@
|
|||||||
|
|
||||||
font: @toolbar_button-font;
|
font: @toolbar_button-font;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 9001;
|
z-index: 10000; // cp-toolbar
|
||||||
|
|
||||||
.cp-dropdown-container {
|
.cp-dropdown-container {
|
||||||
//height: 100%;
|
//height: 100%;
|
||||||
@ -597,7 +597,7 @@
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
.cp-toolbar-user-dropdown {
|
.cp-toolbar-user-dropdown {
|
||||||
z-index: 10000;
|
z-index: 10000; //Z cp-toolbar-user-dropdown
|
||||||
//margin-left: 20px;
|
//margin-left: 20px;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
@ -737,7 +737,7 @@
|
|||||||
background: @colortheme_dropdown-bg;
|
background: @colortheme_dropdown-bg;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
z-index:10000;
|
z-index:10000; //Z cp-toolbar-drawer-content
|
||||||
color: black;
|
color: black;
|
||||||
.fa {
|
.fa {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
|
|||||||
@ -1,31 +1,36 @@
|
|||||||
@import "./variables.less";
|
/*
|
||||||
@import (once) "../less2/include/colortheme.less";
|
WARNING: THIS FILE DOES NOTHING
|
||||||
|
It exists only as a proposal of what CSS you should use in loading.js
|
||||||
|
The CSS inside of loading.js is precompiled in order to save 200ish milliseconds to the loading screen.
|
||||||
|
*/
|
||||||
|
@import (once) "./include/colortheme.less";
|
||||||
|
@import (once) "./include/browser.less";
|
||||||
|
|
||||||
#loading {
|
#cp-loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 9999999;
|
z-index: 10000000; // #loading
|
||||||
top: 0px;
|
top: 0px;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
background: @bg-loading;
|
background: @colortheme_loading-bg;
|
||||||
color: @color-loading;
|
color: @colortheme_loading-color;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
.loadingContainer {
|
.cp-loading-container {
|
||||||
margin-top: 50vh;
|
margin-top: 50vh;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
}
|
}
|
||||||
.cryptofist {
|
.cp-loading-cryptofist {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
@media screen and (max-height: @media-short-screen) {
|
@media screen and (max-height: @browser_media-short-screen) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.spinnerContainer {
|
.cp-loading-spinner-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
> div {
|
> div {
|
||||||
@ -33,9 +38,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#loadingTip {
|
#cp-loading-tip {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 99999;
|
z-index: 100000; // loading tip
|
||||||
top: 80%;
|
top: 80%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
@ -43,12 +48,12 @@
|
|||||||
|
|
||||||
transition: opacity 750ms;
|
transition: opacity 750ms;
|
||||||
transition-delay: 3000ms;
|
transition-delay: 3000ms;
|
||||||
@media screen and (max-height: @media-medium-screen) {
|
@media screen and (max-height: @browser_media-medium-screen) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
background-color: @bg-loading;
|
background: @colortheme_loading-bg;
|
||||||
color: @color-loading;
|
color: @colortheme_loading-color;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
@ -58,3 +63,4 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
@import (once) "../include/infopages.less";
|
@import (once) "../include/infopages.less";
|
||||||
@import (once) "../include/colortheme.less";
|
@import (once) "../include/colortheme.less";
|
||||||
@import (once) "../include/alertify.less";
|
@import (once) "../include/alertify.less";
|
||||||
|
@import (once) "../loading.less";
|
||||||
|
|
||||||
.infopages_main();
|
.infopages_main();
|
||||||
.infopages_topbar();
|
.infopages_topbar();
|
||||||
@ -75,4 +76,4 @@
|
|||||||
.cp-container {
|
.cp-container {
|
||||||
padding-top: 3em;
|
padding-top: 3em;
|
||||||
min-height: 66vh;
|
min-height: 66vh;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
@import (once) "../include/infopages.less";
|
@import (once) "../include/infopages.less";
|
||||||
@import (once) "../include/colortheme.less";
|
@import (once) "../include/colortheme.less";
|
||||||
@import (once) "../include/alertify.less";
|
@import (once) "../include/alertify.less";
|
||||||
|
@import (once) "../loading.less";
|
||||||
|
|
||||||
.infopages_main();
|
.infopages_main();
|
||||||
.infopages_topbar();
|
.infopages_topbar();
|
||||||
|
|||||||
@ -38,7 +38,7 @@ $(function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
require([
|
require([
|
||||||
'less!/customize/src/less/loading.less'
|
'less!/customize/src/less2/loading.less'
|
||||||
], function () {
|
], function () {
|
||||||
if (/whiteboard/.test(pathname)) {
|
if (/whiteboard/.test(pathname)) {
|
||||||
$('body').html(h('body', Pages[pathname]()).innerHTML);
|
$('body').html(h('body', Pages[pathname]()).innerHTML);
|
||||||
|
|||||||
@ -177,7 +177,7 @@ define(function () {
|
|||||||
out.fileShare = "Copier le lien";
|
out.fileShare = "Copier le lien";
|
||||||
out.getEmbedCode = "Obtenir le code d'intégration";
|
out.getEmbedCode = "Obtenir le code d'intégration";
|
||||||
out.viewEmbedTitle = "Intégrer le pad dans une page web";
|
out.viewEmbedTitle = "Intégrer le pad dans une page web";
|
||||||
out.viewEmbedTag = "Pour intégrer ce pad, veuillez inclure l'iframe suivant dans votre page là om vous souhaitez l'afficher. Vous pouvez changer sa taille en utilisant du code CSS ou des attributs HTML.";
|
out.viewEmbedTag = "Pour intégrer ce pad, veuillez inclure l'iframe suivant dans votre page là où vous souhaitez l'afficher. Vous pouvez changer sa taille en utilisant du code CSS ou des attributs HTML.";
|
||||||
out.fileEmbedTitle = "Intégrer le fichier dans une page web";
|
out.fileEmbedTitle = "Intégrer le fichier dans une page web";
|
||||||
out.fileEmbedScript = "Pour intégrer un fichier, veuillez inclure le script suivant une fois dans votre page afin de pouvoir charger le Media Tag :";
|
out.fileEmbedScript = "Pour intégrer un fichier, veuillez inclure le script suivant une fois dans votre page afin de pouvoir charger le Media Tag :";
|
||||||
out.fileEmbedTag = "Ensuite vous pouvez placer ce Media Tag où vous souhaitez dans votre page pour l'intégrer :";
|
out.fileEmbedTag = "Ensuite vous pouvez placer ce Media Tag où vous souhaitez dans votre page pour l'intégrer :";
|
||||||
|
|||||||
@ -163,14 +163,6 @@ define([
|
|||||||
content: textValue,
|
content: textValue,
|
||||||
metadata: metadataMgr.getMetadataLazy()
|
metadata: metadataMgr.getMetadataLazy()
|
||||||
};
|
};
|
||||||
/* metadata: {
|
|
||||||
users: UserList.userData,
|
|
||||||
defaultTitle: Title.defaultTitle
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (!initializing) {
|
|
||||||
obj.metadata.title = Title.title;
|
|
||||||
}*/
|
|
||||||
// set mode too...
|
// set mode too...
|
||||||
obj.highlightMode = CodeMirror.highlightMode;
|
obj.highlightMode = CodeMirror.highlightMode;
|
||||||
|
|
||||||
@ -428,9 +420,6 @@ define([
|
|||||||
//console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val());
|
//console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the user list (metadata) from the hyperjson
|
|
||||||
//Metadata.update(userDoc);
|
|
||||||
|
|
||||||
if (newDoc) {
|
if (newDoc) {
|
||||||
editor.setValue(newDoc);
|
editor.setValue(newDoc);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ define([
|
|||||||
|
|
||||||
var cacheGet = function (k, cb) {
|
var cacheGet = function (k, cb) {
|
||||||
if (window.cryptpadCache) { return void window.cryptpadCache.get(k, cb); }
|
if (window.cryptpadCache) { return void window.cryptpadCache.get(k, cb); }
|
||||||
setTimeout(function () { cb(localStorage['LESS_CACHE|' + key + '|' + k]); })
|
setTimeout(function () { cb(localStorage['LESS_CACHE|' + key + '|' + k]); });
|
||||||
};
|
};
|
||||||
var cachePut = function (k, v, cb) {
|
var cachePut = function (k, v, cb) {
|
||||||
if (window.cryptpadCache) { return void window.cryptpadCache.put(k, v, cb); }
|
if (window.cryptpadCache) { return void window.cryptpadCache.put(k, v, cb); }
|
||||||
|
|||||||
@ -215,9 +215,10 @@ define([
|
|||||||
force = opt.force || false;
|
force = opt.force || false;
|
||||||
} else if (typeof(opt) === 'boolean') {
|
} else if (typeof(opt) === 'boolean') {
|
||||||
force = opt;
|
force = opt;
|
||||||
|
}
|
||||||
|
if (typeof(opt) !== 'object') {
|
||||||
opt = {};
|
opt = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
cb = cb || function () {};
|
cb = cb || function () {};
|
||||||
|
|
||||||
var message;
|
var message;
|
||||||
@ -278,22 +279,25 @@ define([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
var listener;
|
var listener;
|
||||||
var close = Util.once(function () {
|
var close = Util.once(function (result, ev) {
|
||||||
$(frame).fadeOut(150, function () { $(this).remove(); });
|
var $frame = $(frame).fadeOut(150, function () {
|
||||||
stopListening(listener);
|
stopListening(listener);
|
||||||
|
$frame.remove();
|
||||||
|
cb(result, ev);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var $ok = $(ok).click(function (ev) { cb(input.value, ev); });
|
var $ok = $(ok).click(function (ev) { close(input.value, ev); });
|
||||||
var $cancel = $(cancel).click(function (ev) { cb(null, ev); });
|
var $cancel = $(cancel).click(function (ev) { close(null, ev); });
|
||||||
listener = listenForKeys(function () { // yes
|
listener = listenForKeys(function () { // yes
|
||||||
close(); $ok.click();
|
$ok.click();
|
||||||
}, function () { // no
|
}, function () { // no
|
||||||
close(); $cancel.click();
|
$cancel.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.appendChild(frame);
|
document.body.appendChild(frame);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
input.select().focus();
|
$(input).select().focus();
|
||||||
UI.notify();
|
UI.notify();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -321,13 +325,14 @@ define([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
var listener;
|
var listener;
|
||||||
var close = Util.once(function () {
|
var close = Util.once(function (bool, ev) {
|
||||||
$(frame).fadeOut(150, function () { $(this).remove(); });
|
$(frame).fadeOut(150, function () { $(this).remove(); });
|
||||||
stopListening(listener);
|
stopListening(listener);
|
||||||
|
cb(bool, ev);
|
||||||
});
|
});
|
||||||
|
|
||||||
var $ok = $(ok).click(function (ev) { close(); cb(true, ev); });
|
var $ok = $(ok).click(function (ev) { close(true, ev); });
|
||||||
var $cancel = $(cancel).click(function (ev) { close(); cb(false, ev); });
|
var $cancel = $(cancel).click(function (ev) { close(false, ev); });
|
||||||
|
|
||||||
if (opt.cancelClass) { $cancel.addClass(opt.cancelClass); }
|
if (opt.cancelClass) { $cancel.addClass(opt.cancelClass); }
|
||||||
if (opt.okClass) { $ok.addClass(opt.okClass); }
|
if (opt.okClass) { $ok.addClass(opt.okClass); }
|
||||||
@ -381,7 +386,7 @@ define([
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var LOADING = 'loading';
|
var LOADING = 'cp-loading';
|
||||||
|
|
||||||
var getRandomTip = function () {
|
var getRandomTip = function () {
|
||||||
if (!Messages.tips || !Object.keys(Messages.tips).length) { return ''; }
|
if (!Messages.tips || !Object.keys(Messages.tips).length) { return ''; }
|
||||||
@ -400,21 +405,21 @@ define([
|
|||||||
if (loadingText) {
|
if (loadingText) {
|
||||||
$('#' + LOADING).find('p').text(loadingText);
|
$('#' + LOADING).find('p').text(loadingText);
|
||||||
}
|
}
|
||||||
$container = $loading.find('.loadingContainer');
|
$container = $loading.find('.cp-loading-container');
|
||||||
} else {
|
} else {
|
||||||
$loading = $(Pages.loadingScreen());
|
$loading = $(Pages.loadingScreen());
|
||||||
$container = $loading.find('.loadingContainer');
|
$container = $loading.find('.cp-loading-container');
|
||||||
if (hideLogo) {
|
if (hideLogo) {
|
||||||
$loading.find('img').hide();
|
$loading.find('img').hide();
|
||||||
} else {
|
} else {
|
||||||
$loading.find('img').show();
|
$loading.find('img').show();
|
||||||
}
|
}
|
||||||
var $spinner = $loading.find('.spinnerContainer');
|
var $spinner = $loading.find('.cp-loading-spinner-container');
|
||||||
$spinner.show();
|
$spinner.show();
|
||||||
$('body').append($loading);
|
$('body').append($loading);
|
||||||
}
|
}
|
||||||
if (Messages.tips && !hideTips) {
|
if (Messages.tips && !hideTips) {
|
||||||
var $loadingTip = $('<div>', {'id': 'loadingTip'});
|
var $loadingTip = $('<div>', {'id': 'cp-loading-tip'});
|
||||||
$('<span>', {'class': 'tips'}).text(getRandomTip()).appendTo($loadingTip);
|
$('<span>', {'class': 'tips'}).text(getRandomTip()).appendTo($loadingTip);
|
||||||
$loadingTip.css({
|
$loadingTip.css({
|
||||||
'bottom': $('body').height()/2 - $container.height()/2 + 20 + 'px'
|
'bottom': $('body').height()/2 - $container.height()/2 + 20 + 'px'
|
||||||
@ -424,7 +429,7 @@ define([
|
|||||||
};
|
};
|
||||||
UI.removeLoadingScreen = function (cb) {
|
UI.removeLoadingScreen = function (cb) {
|
||||||
$('#' + LOADING).fadeOut(750, cb);
|
$('#' + LOADING).fadeOut(750, cb);
|
||||||
var $tip = $('#loadingTip').css('top', '')
|
var $tip = $('#cp-loading-tip').css('top', '')
|
||||||
// loading.less sets transition-delay: $wait-time
|
// loading.less sets transition-delay: $wait-time
|
||||||
// and transition: opacity $fadeout-time
|
// and transition: opacity $fadeout-time
|
||||||
.css({
|
.css({
|
||||||
@ -438,7 +443,7 @@ define([
|
|||||||
};
|
};
|
||||||
UI.errorLoadingScreen = function (error, transparent) {
|
UI.errorLoadingScreen = function (error, transparent) {
|
||||||
if (!$('#' + LOADING).is(':visible')) { UI.addLoadingScreen({hideTips: true}); }
|
if (!$('#' + LOADING).is(':visible')) { UI.addLoadingScreen({hideTips: true}); }
|
||||||
$('.spinnerContainer').hide();
|
$('.cp-loading-spinner-container').hide();
|
||||||
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
|
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
|
||||||
$('#' + LOADING).find('p').html(error || Messages.error);
|
$('#' + LOADING).find('p').html(error || Messages.error);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,76 +1,76 @@
|
|||||||
define([], function () {
|
define([], function () {
|
||||||
var loadingStyle = (function(){/*
|
var loadingStyle = (function(){/*
|
||||||
#loading {
|
#cp-loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 9999999;
|
z-index: 10000000;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
background: #222;
|
background: #222;
|
||||||
color: #fafafa;
|
color: #fafafa;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
#loading .loadingContainer {
|
#cp-loading .cp-loading-container {
|
||||||
margin-top: 50vh;
|
margin-top: 50vh;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
}
|
}
|
||||||
#loading .cryptofist {
|
#cp-loading .cp-loading-cryptofist {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
@media screen and (max-height: 450px) {
|
@media screen and (max-height: 450px) {
|
||||||
#loading .cryptofist {
|
#cp-loading .cp-loading-cryptofist {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#loading .spinnerContainer {
|
#cp-loading .cp-loading-spinner-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
#loading .spinnerContainer > div {
|
#cp-loading .cp-loading-spinner-container > div {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
#loadingTip {
|
#cp-loading-tip {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 99999;
|
z-index: 100000;
|
||||||
top: 80%;
|
top: 80%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transition: opacity 750ms;
|
transition: opacity 750ms;
|
||||||
transition-delay: 3000ms;
|
transition-delay: 3000ms;
|
||||||
}
|
}
|
||||||
@media screen and (max-height: 600px) {
|
@media screen and (max-height: 600px) {
|
||||||
#loadingTip {
|
#cp-loading-tip {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#loadingTip span {
|
#cp-loading-tip span {
|
||||||
background-color: #222;
|
background: #222;
|
||||||
color: #fafafa;
|
color: #fafafa;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
|
font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
max-width: 60%;
|
max-width: 60%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}*/
|
}
|
||||||
}).toString().slice(14, -3);
|
*/}).toString().slice(14, -3);
|
||||||
var urlArgs = window.location.href.replace(/^.*\?([^\?]*)$/, function (all, x) { return x; });
|
var urlArgs = window.location.href.replace(/^.*\?([^\?]*)$/, function (all, x) { return x; });
|
||||||
var elem = document.createElement('div');
|
var elem = document.createElement('div');
|
||||||
elem.setAttribute('id', 'loading');
|
elem.setAttribute('id', 'cp-loading');
|
||||||
elem.innerHTML = [
|
elem.innerHTML = [
|
||||||
'<style>',
|
'<style>',
|
||||||
loadingStyle,
|
loadingStyle,
|
||||||
'</style>',
|
'</style>',
|
||||||
'<div class="loadingContainer">',
|
'<div class="cp-loading-container">',
|
||||||
'<img class="cryptofist" src="/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs + '">',
|
'<img class="cp-loading-cryptofist" src="/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs + '">',
|
||||||
'<div class="spinnerContainer">',
|
'<div class="cp-loading-spinner-container">',
|
||||||
'<span class="fa fa-circle-o-notch fa-spin fa-4x fa-fw"></span>',
|
'<span class="fa fa-circle-o-notch fa-spin fa-4x fa-fw"></span>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<p id="cp-loading-message"></p>',
|
'<p id="cp-loading-message"></p>',
|
||||||
|
|||||||
@ -49,6 +49,7 @@ define([
|
|||||||
readOnly: true
|
readOnly: true
|
||||||
});
|
});
|
||||||
editor.setValue(Messages.codeInitialState);
|
editor.setValue(Messages.codeInitialState);
|
||||||
|
editor.focus();
|
||||||
|
|
||||||
var setMode = exp.setMode = function (mode, cb) {
|
var setMode = exp.setMode = function (mode, cb) {
|
||||||
exp.highlightMode = mode;
|
exp.highlightMode = mode;
|
||||||
|
|||||||
@ -200,20 +200,7 @@ define([
|
|||||||
return button;
|
return button;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Avatars
|
||||||
UI.getFileSize = function (Common, href, cb) {
|
|
||||||
var channelId = Cryptpad.hrefToHexChannelId(href);
|
|
||||||
Common.sendAnonRpcMsg("GET_FILE_SIZE", channelId, function (data) {
|
|
||||||
if (!data) { return void cb("No response"); }
|
|
||||||
if (data.error) { return void cb(data.error); }
|
|
||||||
if (data.response && data.response.length && typeof(data.response[0]) === 'number') {
|
|
||||||
return void cb(void 0, data.response[0]);
|
|
||||||
} else {
|
|
||||||
cb('INVALID_RESPONSE');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
UI.displayAvatar = function (Common, $container, href, name, cb) {
|
UI.displayAvatar = function (Common, $container, href, name, cb) {
|
||||||
var MutationObserver = window.MutationObserver;
|
var MutationObserver = window.MutationObserver;
|
||||||
var displayDefault = function () {
|
var displayDefault = function () {
|
||||||
@ -229,7 +216,7 @@ define([
|
|||||||
var cryptKey = secret.keys && secret.keys.fileKeyStr;
|
var cryptKey = secret.keys && secret.keys.fileKeyStr;
|
||||||
var hexFileName = Cryptpad.base64ToHex(secret.channel);
|
var hexFileName = Cryptpad.base64ToHex(secret.channel);
|
||||||
var src = Cryptpad.getBlobPathFromHex(hexFileName);
|
var src = Cryptpad.getBlobPathFromHex(hexFileName);
|
||||||
UI.getFileSize(Common, href, function (e, data) {
|
Common.getFileSize(href, function (e, data) {
|
||||||
if (e) {
|
if (e) {
|
||||||
displayDefault();
|
displayDefault();
|
||||||
return void console.error(e);
|
return void console.error(e);
|
||||||
@ -467,9 +454,13 @@ define([
|
|||||||
var metadataMgr = common.getMetadataMgr();
|
var metadataMgr = common.getMetadataMgr();
|
||||||
var type = metadataMgr.getMetadataLazy().type;
|
var type = metadataMgr.getMetadataLazy().type;
|
||||||
var sframeChan = common.getSframeChannel();
|
var sframeChan = common.getSframeChannel();
|
||||||
|
var focus;
|
||||||
|
|
||||||
var onConfirm = function (yes) {
|
var onConfirm = function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) {
|
||||||
|
if (focus) { focus.focus(); }
|
||||||
|
return;
|
||||||
|
}
|
||||||
var first = true; // We can only pick a template once (for a new document)
|
var first = true; // We can only pick a template once (for a new document)
|
||||||
var fileDialogCfg = {
|
var fileDialogCfg = {
|
||||||
onSelect: function (data) {
|
onSelect: function (data) {
|
||||||
@ -480,6 +471,7 @@ define([
|
|||||||
Cryptpad.removeLoadingScreen();
|
Cryptpad.removeLoadingScreen();
|
||||||
common.feedback('TEMPLATE_USED');
|
common.feedback('TEMPLATE_USED');
|
||||||
});
|
});
|
||||||
|
if (focus) { focus.focus(); }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -494,6 +486,7 @@ define([
|
|||||||
|
|
||||||
sframeChan.query("Q_TEMPLATE_EXIST", type, function (err, data) {
|
sframeChan.query("Q_TEMPLATE_EXIST", type, function (err, data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
focus = document.activeElement;
|
||||||
Cryptpad.confirm(Messages.useTemplate, onConfirm, {
|
Cryptpad.confirm(Messages.useTemplate, onConfirm, {
|
||||||
ok: Messages.useTemplateOK,
|
ok: Messages.useTemplateOK,
|
||||||
cancel: Messages.useTemplateCancel,
|
cancel: Messages.useTemplateCancel,
|
||||||
|
|||||||
@ -77,7 +77,6 @@ define([
|
|||||||
funcs.openTemplatePicker = callWithCommon(UI.openTemplatePicker);
|
funcs.openTemplatePicker = callWithCommon(UI.openTemplatePicker);
|
||||||
funcs.displayAvatar = callWithCommon(UI.displayAvatar);
|
funcs.displayAvatar = callWithCommon(UI.displayAvatar);
|
||||||
funcs.createButton = callWithCommon(UI.createButton);
|
funcs.createButton = callWithCommon(UI.createButton);
|
||||||
funcs.getFileSize = callWithCommon(UI.getFileSize);
|
|
||||||
|
|
||||||
// History
|
// History
|
||||||
funcs.getHistory = callWithCommon(History.create);
|
funcs.getHistory = callWithCommon(History.create);
|
||||||
@ -106,6 +105,19 @@ define([
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
funcs.getFileSize = function (href, cb) {
|
||||||
|
var channelId = Cryptpad.hrefToHexChannelId(href);
|
||||||
|
funcs.sendAnonRpcMsg("GET_FILE_SIZE", channelId, function (data) {
|
||||||
|
if (!data) { return void cb("No response"); }
|
||||||
|
if (data.error) { return void cb(data.error); }
|
||||||
|
if (data.response && data.response.length && typeof(data.response[0]) === 'number') {
|
||||||
|
return void cb(void 0, data.response[0]);
|
||||||
|
} else {
|
||||||
|
cb('INVALID_RESPONSE');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// CodeMirror
|
// CodeMirror
|
||||||
funcs.initCodeMirrorApp = callWithCommon(CodeMirror.create);
|
funcs.initCodeMirrorApp = callWithCommon(CodeMirror.create);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -837,7 +837,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
var initClickEvents = function (toolbar, config) {
|
var initClickEvents = function (toolbar) {
|
||||||
var removeDropdowns = function () {
|
var removeDropdowns = function () {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
toolbar.$toolbar.find('.cp-dropdown-content').hide();
|
toolbar.$toolbar.find('.cp-dropdown-content').hide();
|
||||||
|
|||||||
@ -232,13 +232,14 @@ define([
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we're in upload mode
|
||||||
|
|
||||||
if (!common.isLoggedIn()) {
|
if (!common.isLoggedIn()) {
|
||||||
// TODO
|
|
||||||
return Cryptpad.alert(Messages.upload_mustLogin, function () {
|
return Cryptpad.alert(Messages.upload_mustLogin, function () {
|
||||||
if (sessionStorage) {
|
Cryptpad.errorLoadingScreen(Messages.upload_mustLogin);
|
||||||
sessionStorage.redirectTo = window.location.href;
|
common.setLoginRedirect(function () {
|
||||||
}
|
common.gotoURL('/login/');
|
||||||
window.location.href = '/login/';
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,521 +261,7 @@ define([
|
|||||||
FM.handleFile(file);
|
FM.handleFile(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
// we're in upload mode
|
|
||||||
Cryptpad.removeLoadingScreen();
|
Cryptpad.removeLoadingScreen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
//===========================================================================
|
|
||||||
var readOnly = false;
|
|
||||||
var cpNfInner;
|
|
||||||
var metadataMgr;
|
|
||||||
var $bar = $('#cme_toolbox');
|
|
||||||
|
|
||||||
var isHistoryMode = false;
|
|
||||||
|
|
||||||
var setEditable = APP.setEditable = function (bool) {
|
|
||||||
if (readOnly && bool) { return; }
|
|
||||||
editor.setOption('readOnly', !bool);
|
|
||||||
};
|
|
||||||
|
|
||||||
var Title;
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
readOnly: readOnly,
|
|
||||||
transformFunction: JsonOT.validate,
|
|
||||||
// cryptpad debug logging (default is 1)
|
|
||||||
// logLevel: 0,
|
|
||||||
validateContent: function (content) {
|
|
||||||
try {
|
|
||||||
JSON.parse(content);
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Failed to parse, rejecting patch");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };
|
|
||||||
|
|
||||||
var setHistory = function (bool, update) {
|
|
||||||
isHistoryMode = bool;
|
|
||||||
setEditable(!bool);
|
|
||||||
if (!bool && update) {
|
|
||||||
config.onRemote();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var $contentContainer = $('#cp-app-code-editor');
|
|
||||||
var $previewContainer = $('#cp-app-code-preview');
|
|
||||||
var $preview = $('#cp-app-code-preview-content');
|
|
||||||
$preview.click(function (e) {
|
|
||||||
if (!e.target) { return; }
|
|
||||||
var $t = $(e.target);
|
|
||||||
if ($t.is('a') || $t.parents('a').length) {
|
|
||||||
e.preventDefault();
|
|
||||||
var $a = $t.is('a') ? $t : $t.parents('a').first();
|
|
||||||
var href = $a.attr('href');
|
|
||||||
window.open(href);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var setIndentation = APP.setIndentation = function (units, useTabs) {
|
|
||||||
if (typeof(units) !== 'number') { return; }
|
|
||||||
editor.setOption('indentUnit', units);
|
|
||||||
editor.setOption('tabSize', units);
|
|
||||||
editor.setOption('indentWithTabs', useTabs);
|
|
||||||
};
|
|
||||||
|
|
||||||
var indentKey = 'indentUnit';
|
|
||||||
var useTabsKey = 'indentWithTabs';
|
|
||||||
var updateIndentSettings = function () {
|
|
||||||
if (!metadataMgr) { return; }
|
|
||||||
var data = metadataMgr.getPrivateData().settings;
|
|
||||||
data = data.codemirror || {};
|
|
||||||
var indentUnit = data[indentKey];
|
|
||||||
var useTabs = data[useTabsKey];
|
|
||||||
setIndentation(
|
|
||||||
typeof(indentUnit) === 'number'? indentUnit: 2,
|
|
||||||
typeof(useTabs) === 'boolean'? useTabs: false);
|
|
||||||
};
|
|
||||||
|
|
||||||
CommonRealtime.onInfiniteSpinner(function () { setEditable(false); });
|
|
||||||
|
|
||||||
setEditable(false);
|
|
||||||
var initializing = true;
|
|
||||||
|
|
||||||
var stringifyInner = function (textValue) {
|
|
||||||
var obj = {
|
|
||||||
content: textValue,
|
|
||||||
metadata: metadataMgr.getMetadataLazy()
|
|
||||||
};
|
|
||||||
/* metadata: {
|
|
||||||
users: UserList.userData,
|
|
||||||
defaultTitle: Title.defaultTitle
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (!initializing) {
|
|
||||||
obj.metadata.title = Title.title;
|
|
||||||
}*/
|
|
||||||
// set mode too...
|
|
||||||
obj.highlightMode = CodeMirror.highlightMode;
|
|
||||||
|
|
||||||
// stringify the json and send it into chainpad
|
|
||||||
return stringify(obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
var forceDrawPreview = function () {
|
|
||||||
try {
|
|
||||||
DiffMd.apply(DiffMd.render(editor.getValue()), $preview);
|
|
||||||
} catch (e) { console.error(e); }
|
|
||||||
};
|
|
||||||
|
|
||||||
var drawPreview = Cryptpad.throttle(function () {
|
|
||||||
if (CodeMirror.highlightMode !== 'markdown') { return; }
|
|
||||||
if (!$previewContainer.is(':visible')) { return; }
|
|
||||||
forceDrawPreview();
|
|
||||||
}, 150);
|
|
||||||
|
|
||||||
var onLocal = config.onLocal = function () {
|
|
||||||
if (initializing) { return; }
|
|
||||||
if (isHistoryMode) { return; }
|
|
||||||
if (readOnly) { return; }
|
|
||||||
|
|
||||||
editor.save();
|
|
||||||
|
|
||||||
drawPreview();
|
|
||||||
|
|
||||||
var textValue = canonicalize(CodeMirror.$textarea.val());
|
|
||||||
var shjson = stringifyInner(textValue);
|
|
||||||
|
|
||||||
APP.patchText(shjson);
|
|
||||||
|
|
||||||
if (APP.realtime.getUserDoc() !== shjson) {
|
|
||||||
console.error("realtime.getUserDoc() !== shjson");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var mediaTagModes = [
|
|
||||||
'markdown',
|
|
||||||
'html',
|
|
||||||
'htmlembedded',
|
|
||||||
'htmlmixed',
|
|
||||||
'index.html',
|
|
||||||
'php',
|
|
||||||
'velocity',
|
|
||||||
'xml',
|
|
||||||
];
|
|
||||||
|
|
||||||
var onModeChanged = function (mode) {
|
|
||||||
var $codeMirror = $('.CodeMirror');
|
|
||||||
window.clearTimeout(APP.previewTo);
|
|
||||||
$codeMirror.addClass('transition');
|
|
||||||
APP.previewTo = window.setTimeout(function () {
|
|
||||||
$codeMirror.removeClass('transition');
|
|
||||||
}, 500);
|
|
||||||
if (mediaTagModes.indexOf(mode) !== -1) {
|
|
||||||
$(APP.$mediaTagButton).show();
|
|
||||||
} else { $(APP.$mediaTagButton).hide(); }
|
|
||||||
|
|
||||||
if (mode === "markdown") {
|
|
||||||
APP.$previewButton.show();
|
|
||||||
common.getPadAttribute('previewMode', function (e, data) {
|
|
||||||
if (e) { return void console.error(e); }
|
|
||||||
if (data !== false) {
|
|
||||||
$previewContainer.show();
|
|
||||||
APP.$previewButton.addClass('active');
|
|
||||||
$codeMirror.removeClass('fullPage');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
APP.$previewButton.hide();
|
|
||||||
$previewContainer.hide();
|
|
||||||
APP.$previewButton.removeClass('active');
|
|
||||||
$codeMirror.addClass('fullPage');
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onInit = function (info) {
|
|
||||||
metadataMgr.onChangeLazy(updateIndentSettings);
|
|
||||||
updateIndentSettings();
|
|
||||||
|
|
||||||
readOnly = metadataMgr.getPrivateData().readOnly;
|
|
||||||
|
|
||||||
var titleCfg = { getHeadingText: CodeMirror.getHeadingText };
|
|
||||||
Title = common.createTitle(titleCfg, config.onLocal);
|
|
||||||
|
|
||||||
var configTb = {
|
|
||||||
displayed: ['title', 'useradmin', 'spinner', 'share', 'userlist', 'newpad', 'limit'],
|
|
||||||
title: Title.getTitleConfig(),
|
|
||||||
metadataMgr: metadataMgr,
|
|
||||||
readOnly: readOnly,
|
|
||||||
ifrw: window,
|
|
||||||
realtime: info.realtime,
|
|
||||||
common: Cryptpad,
|
|
||||||
sfCommon: common,
|
|
||||||
$container: $bar,
|
|
||||||
$contentContainer: $contentContainer
|
|
||||||
};
|
|
||||||
toolbar = APP.toolbar = Toolbar.create(configTb);
|
|
||||||
Title.setToolbar(toolbar);
|
|
||||||
CodeMirror.init(config.onLocal, Title, toolbar);
|
|
||||||
|
|
||||||
var $rightside = toolbar.$rightside;
|
|
||||||
var $drawer = toolbar.$drawer;
|
|
||||||
|
|
||||||
/* add a history button */
|
|
||||||
var histConfig = {
|
|
||||||
onLocal: config.onLocal,
|
|
||||||
onRemote: config.onRemote,
|
|
||||||
setHistory: setHistory,
|
|
||||||
applyVal: function (val) {
|
|
||||||
var remoteDoc = JSON.parse(val || '{}').content;
|
|
||||||
editor.setValue(remoteDoc || '');
|
|
||||||
editor.save();
|
|
||||||
},
|
|
||||||
$toolbar: $bar
|
|
||||||
};
|
|
||||||
var $hist = common.createButton('history', true, {histConfig: histConfig});
|
|
||||||
$drawer.append($hist);
|
|
||||||
|
|
||||||
/* save as template */
|
|
||||||
if (!metadataMgr.getPrivateData().isTemplate) {
|
|
||||||
var templateObj = {
|
|
||||||
rt: info.realtime,
|
|
||||||
getTitle: function () { return metadataMgr.getMetadata().title; }
|
|
||||||
};
|
|
||||||
var $templateButton = common.createButton('template', true, templateObj);
|
|
||||||
$rightside.append($templateButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add an export button */
|
|
||||||
var $export = common.createButton('export', true, {}, CodeMirror.exportText);
|
|
||||||
$drawer.append($export);
|
|
||||||
|
|
||||||
if (!readOnly) {
|
|
||||||
/* add an import button */
|
|
||||||
var $import = common.createButton('import', true, {}, CodeMirror.importText);
|
|
||||||
$drawer.append($import);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add a forget button */
|
|
||||||
var forgetCb = function (err) {
|
|
||||||
if (err) { return; }
|
|
||||||
setEditable(false);
|
|
||||||
};
|
|
||||||
var $forgetPad = common.createButton('forget', true, {}, forgetCb);
|
|
||||||
$rightside.append($forgetPad);
|
|
||||||
|
|
||||||
var $previewButton = APP.$previewButton = common.createButton(null, true);
|
|
||||||
$previewButton.removeClass('fa-question').addClass('fa-eye');
|
|
||||||
$previewButton.attr('title', Messages.previewButtonTitle);
|
|
||||||
$previewButton.click(function () {
|
|
||||||
var $codeMirror = $('.CodeMirror');
|
|
||||||
window.clearTimeout(APP.previewTo);
|
|
||||||
$codeMirror.addClass('transition');
|
|
||||||
APP.previewTo = window.setTimeout(function () {
|
|
||||||
$codeMirror.removeClass('transition');
|
|
||||||
}, 500);
|
|
||||||
if (CodeMirror.highlightMode !== 'markdown') {
|
|
||||||
$previewContainer.show();
|
|
||||||
}
|
|
||||||
$previewContainer.toggle();
|
|
||||||
if ($previewContainer.is(':visible')) {
|
|
||||||
forceDrawPreview();
|
|
||||||
$codeMirror.removeClass('cp-ap-code-fullpage');
|
|
||||||
$previewButton.addClass('cp-toolbar-button-active');
|
|
||||||
common.setPadAttribute('previewMode', true, function (e) {
|
|
||||||
if (e) { return console.log(e); }
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$codeMirror.addClass('cp-app-code-fullpage');
|
|
||||||
$previewButton.removeClass('cp-toolbar-button-active');
|
|
||||||
common.setPadAttribute('previewMode', false, function (e) {
|
|
||||||
if (e) { return console.log(e); }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$rightside.append($previewButton);
|
|
||||||
|
|
||||||
if (!readOnly) {
|
|
||||||
CodeMirror.configureTheme(function () {
|
|
||||||
CodeMirror.configureLanguage(null, onModeChanged);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CodeMirror.configureTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!readOnly) {
|
|
||||||
var fileDialogCfg = {
|
|
||||||
onSelect: function (data) {
|
|
||||||
if (data.type === 'file') {
|
|
||||||
var mt = '<media-tag src="' + data.src + '" data-crypto-key="cryptpad:' + data.key + '"></media-tag>';
|
|
||||||
editor.replaceSelection(mt);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
common.initFilePicker(fileDialogCfg);
|
|
||||||
APP.$mediaTagButton = $('<button>', {
|
|
||||||
title: Messages.filePickerButton,
|
|
||||||
'class': 'cp-toolbar-rightside-button fa fa-picture-o',
|
|
||||||
style: 'font-size: 17px'
|
|
||||||
}).click(function () {
|
|
||||||
var pickerCfg = {
|
|
||||||
types: ['file'],
|
|
||||||
where: ['root']
|
|
||||||
};
|
|
||||||
common.openFilePicker(pickerCfg);
|
|
||||||
}).appendTo($rightside);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onReady = function (info) {
|
|
||||||
console.log('onready');
|
|
||||||
if (APP.realtime !== info.realtime) {
|
|
||||||
var realtime = APP.realtime = info.realtime;
|
|
||||||
APP.patchText = TextPatcher.create({
|
|
||||||
realtime: realtime,
|
|
||||||
//logging: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var userDoc = APP.realtime.getUserDoc();
|
|
||||||
|
|
||||||
var isNew = false;
|
|
||||||
if (userDoc === "" || userDoc === "{}") { isNew = true; }
|
|
||||||
|
|
||||||
var newDoc = "";
|
|
||||||
if (userDoc !== "") {
|
|
||||||
var hjson = JSON.parse(userDoc);
|
|
||||||
|
|
||||||
if (hjson && hjson.metadata) {
|
|
||||||
metadataMgr.updateMetadata(hjson.metadata);
|
|
||||||
}
|
|
||||||
if (typeof (hjson) !== 'object' || Array.isArray(hjson) ||
|
|
||||||
(typeof(hjson.type) !== 'undefined' && hjson.type !== 'code')) {
|
|
||||||
var errorText = Messages.typeError;
|
|
||||||
Cryptpad.errorLoadingScreen(errorText);
|
|
||||||
throw new Error(errorText);
|
|
||||||
}
|
|
||||||
|
|
||||||
newDoc = hjson.content;
|
|
||||||
|
|
||||||
if (hjson.highlightMode) {
|
|
||||||
CodeMirror.setMode(hjson.highlightMode, onModeChanged);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Title.updateTitle(Cryptpad.initialName || Title.defaultTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CodeMirror.highlightMode) {
|
|
||||||
CodeMirror.setMode('markdown', onModeChanged);
|
|
||||||
//console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the user list (metadata) from the hyperjson
|
|
||||||
//Metadata.update(userDoc);
|
|
||||||
|
|
||||||
if (newDoc) {
|
|
||||||
editor.setValue(newDoc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Cryptpad.initialName && Title.isDefaultTitle()) {
|
|
||||||
Title.updateTitle(Cryptpad.initialName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
common.getPadAttribute('previewMode', function (e, data) {
|
|
||||||
if (e) { return void console.error(e); }
|
|
||||||
if (data === false && APP.$previewButton) {
|
|
||||||
APP.$previewButton.click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// add the splitter
|
|
||||||
if (!$iframe.has('.cp-splitter').length) {
|
|
||||||
var $preview = $iframe.find('#previewContainer');
|
|
||||||
var splitter = $('<div>', {
|
|
||||||
'class': 'cp-splitter'
|
|
||||||
}).appendTo($preview);
|
|
||||||
|
|
||||||
$preview.on('scroll', function() {
|
|
||||||
splitter.css('top', $preview.scrollTop() + 'px');
|
|
||||||
});
|
|
||||||
|
|
||||||
var $target = $iframe.find('.CodeMirror');
|
|
||||||
|
|
||||||
splitter.on('mousedown', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var x = e.pageX;
|
|
||||||
var w = $target.width();
|
|
||||||
|
|
||||||
$iframe.on('mouseup mousemove', function handler(evt) {
|
|
||||||
if (evt.type === 'mouseup') {
|
|
||||||
$iframe.off('mouseup mousemove', handler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$target.css('width', (w - x + evt.pageX) + 'px');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Cryptpad.removeLoadingScreen();
|
|
||||||
setEditable(!readOnly);
|
|
||||||
initializing = false;
|
|
||||||
|
|
||||||
onLocal(); // push local state to avoid parse errors later.
|
|
||||||
|
|
||||||
if (readOnly) {
|
|
||||||
config.onRemote();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNew) {
|
|
||||||
common.openTemplatePicker();
|
|
||||||
}
|
|
||||||
|
|
||||||
var fmConfig = {
|
|
||||||
dropArea: $('.CodeMirror'),
|
|
||||||
body: $('body'),
|
|
||||||
onUploaded: function (ev, data) {
|
|
||||||
//var cursor = editor.getCursor();
|
|
||||||
//var cleanName = data.name.replace(/[\[\]]/g, '');
|
|
||||||
//var text = '';
|
|
||||||
var parsed = Cryptpad.parsePadUrl(data.url);
|
|
||||||
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
|
|
||||||
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
|
|
||||||
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
|
|
||||||
editor.replaceSelection(mt);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
APP.FM = common.createFileManager(fmConfig);
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onRemote = function () {
|
|
||||||
if (initializing) { return; }
|
|
||||||
if (isHistoryMode) { return; }
|
|
||||||
|
|
||||||
var oldDoc = canonicalize(CodeMirror.$textarea.val());
|
|
||||||
var shjson = APP.realtime.getUserDoc();
|
|
||||||
|
|
||||||
// Update the user list (metadata) from the hyperjson
|
|
||||||
//Metadata.update(shjson);
|
|
||||||
|
|
||||||
var hjson = JSON.parse(shjson);
|
|
||||||
var remoteDoc = hjson.content;
|
|
||||||
|
|
||||||
if (hjson.metadata) {
|
|
||||||
metadataMgr.updateMetadata(hjson.metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
var highlightMode = hjson.highlightMode;
|
|
||||||
if (highlightMode && highlightMode !== APP.highlightMode) {
|
|
||||||
CodeMirror.setMode(highlightMode, onModeChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.setValueAndCursor(oldDoc, remoteDoc, TextPatcher);
|
|
||||||
drawPreview();
|
|
||||||
|
|
||||||
if (!readOnly) {
|
|
||||||
var textValue = canonicalize(CodeMirror.$textarea.val());
|
|
||||||
var shjson2 = stringifyInner(textValue);
|
|
||||||
if (shjson2 !== shjson) {
|
|
||||||
console.error("shjson2 !== shjson");
|
|
||||||
TextPatcher.log(shjson, TextPatcher.diff(shjson, shjson2));
|
|
||||||
APP.patchText(shjson2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (oldDoc !== remoteDoc) { Cryptpad.notify(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onAbort = function () {
|
|
||||||
// inform of network disconnect
|
|
||||||
setEditable(false);
|
|
||||||
toolbar.failed();
|
|
||||||
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onConnectionChange = function (info) {
|
|
||||||
setEditable(info.state);
|
|
||||||
//toolbar.failed();
|
|
||||||
if (info.state) {
|
|
||||||
initializing = true;
|
|
||||||
//toolbar.reconnecting(info.myId);
|
|
||||||
Cryptpad.findOKButton().click();
|
|
||||||
} else {
|
|
||||||
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
config.onError = onConnectError;
|
|
||||||
|
|
||||||
cpNfInner = common.startRealtime(config);
|
|
||||||
metadataMgr = cpNfInner.metadataMgr;
|
|
||||||
|
|
||||||
cpNfInner.onInfiniteSpinner(function () {
|
|
||||||
setEditable(false);
|
|
||||||
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
|
||||||
if (!yes) { return; }
|
|
||||||
common.gotoURL();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('change', onLocal);
|
|
||||||
|
|
||||||
Cryptpad.onLogout(function () { setEditable(false); });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var main = function () {
|
var main = function () {
|
||||||
|
|||||||
@ -4,7 +4,6 @@ define([
|
|||||||
'/common/login.js',
|
'/common/login.js',
|
||||||
|
|
||||||
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||||
'less!/customize/src/less/loading.less',
|
|
||||||
], function ($, Cryptpad, Login) {
|
], function ($, Cryptpad, Login) {
|
||||||
$(function () {
|
$(function () {
|
||||||
var $main = $('#mainBlock');
|
var $main = $('#mainBlock');
|
||||||
|
|||||||
@ -6,7 +6,6 @@ define([
|
|||||||
'/common/credential.js', // preloaded for login.js
|
'/common/credential.js', // preloaded for login.js
|
||||||
|
|
||||||
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||||
'less!/customize/src/less/loading.less',
|
|
||||||
], function ($, Login, Cryptpad, Test, Cred) {
|
], function ($, Login, Cryptpad, Test, Cred) {
|
||||||
var Messages = Cryptpad.Messages;
|
var Messages = Cryptpad.Messages;
|
||||||
|
|
||||||
@ -252,8 +251,8 @@ define([
|
|||||||
|
|
||||||
Test(function () {
|
Test(function () {
|
||||||
$uname.val('test' + Math.random());
|
$uname.val('test' + Math.random());
|
||||||
$passwd.val('test');
|
$passwd.val('testtest');
|
||||||
$confirm.val('test');
|
$confirm.val('testtest');
|
||||||
$checkImport[0].checked = true;
|
$checkImport[0].checked = true;
|
||||||
$checkAcceptTerms[0].checked = true;
|
$checkAcceptTerms[0].checked = true;
|
||||||
$register.click();
|
$register.click();
|
||||||
|
|||||||
@ -153,7 +153,7 @@ div#cp-app-slide-modal {
|
|||||||
display: none;
|
display: none;
|
||||||
z-index: 9001;
|
z-index: 9001;
|
||||||
}
|
}
|
||||||
.cp-app-slie-modal-button:hover {
|
.cp-app-slide-modal-button:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
<style>
|
<style>
|
||||||
.loading-hidden { display: none; }
|
.loading-hidden { display: none; }
|
||||||
#editor1 { display: none; }
|
#editor1 { display: none; }
|
||||||
|
.cp-app-slide-modal-button { display: none; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="cp-app-slide">
|
<body class="cp-app-slide">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user