Merge branch 'staging' into reviewed

pull/1/head
ansuz 4 years ago
commit 0ea9ae1a70

@ -72,6 +72,14 @@ define([
});
UI.addTooltips();
var subscribeButton;
/* Display a subscribe button if they are enabled and the button's translation key exists */
if (Config.allowSubscriptions && Msg.subscribe_button) {
subscribeButton = Pages.subscribeButton(function () {
Feedback.send('HOME_SUBSCRIBE_CRYPTPAD');
});
}
var blocks = [
h('div.row.cp-page-section', [
h('div.col-sm-6',
@ -104,6 +112,7 @@ define([
h('div.col-sm-6', [
h('h2', Msg.home_support_title),
Pages.setHTML(h('span'), Msg.home_support),
subscribeButton,
Pages.crowdfundingButton(function () {
Feedback.send('HOME_SUPPORT_CRYPTPAD');
}),
@ -111,6 +120,11 @@ define([
])
];
var notice;
if (AppConfig.homeNotice) {
notice = h('div.alert.alert-info', h('span', AppConfig.homeNotice));
}
return [
h('div#cp-main', [
Pages.infopageTopbar(),
@ -129,6 +143,7 @@ define([
icons,
])
]),
notice,
blocks
]),
Pages.infopageFooter(),

@ -7,6 +7,15 @@ define([
], function (Config, h, Msg, Pages, Feedback) {
var urlArgs = Config.requireConf.urlArgs;
var logoLink = function (alt, src, url, cls) {
var img = h('img' + (cls || ''), {
src: src + '?' + urlArgs,
alt: alt,
});
if (!url) { return img; }
return h('a', { href: url, }, img);
};
return function () {
return h('div#cp-main', [
Pages.infopageTopbar(),
@ -66,26 +75,17 @@ define([
}),
]),
h('div.col-md-6.order-md-1.small-logos', [
h('img.cp-img-invert', {
src: '/customize/images/logo_ngi.png?' + urlArgs,
alt: 'NGI Award 2019'
}),
h('img.cp-img-invert', {
src: '/customize/images/logo_nlnet.svg?' + urlArgs,
alt: 'NLNet Foundation logo'
}),
h('img', {
src: '/customize/images/logo_bpifrance.svg?' + urlArgs,
alt: 'BPI France logo'
}),
h('img', {
src: '/customize/images/logo_moss.jpg?' + urlArgs,
alt: 'Mozilla Open Source Support logo'
}),
h('img', {
src: '/customize/images/logo_ngi_trust.png?' + urlArgs,
alt: 'NGI Trust logo'
}),
logoLink('NGI Award 2019', '/customize/images/logo_ngi.png',
'https://www.ngi.eu/', '.cp-img-invert'),
logoLink('NLnet Foundation logo', '/customize/images/logo_nlnet.svg',
'https://nlnet.nl', '.cp-img-invert'),
logoLink('BPI France logo', '/customize/images/logo_bpifrance.svg',
'https://bpifrance.com'),
logoLink('Mozilla Open Source Support logo', '/customize/images/logo_moss.jpg',
'https://www.mozilla.org/en-US/moss/'),
logoLink('NGI Trust logo', '/customize/images/logo_ngi_trust.png',
'https://www.ngi.eu/ngi-projects/ngi-trust/'),
]),
]),
h('div.row.cp-page-section', [

@ -387,6 +387,7 @@
// Rich text
@cp_pad-fg: @cryptpad_text_col;
@cp_pad-icon-filter: invert();
@cp_pad-resize: @cryptpad_color_grey_800;
// Comments
@cp_comments-fg: @cryptpad_text_col;
@cp_comments-bg: @cryptpad_color_grey_800;

@ -387,6 +387,7 @@
// Rich text
@cp_pad-fg: @cryptpad_text_col;
@cp_pad-icon-filter: none;
@cp_pad-resize: @cryptpad_text_col;
// Comments
@cp_comments-fg: @cryptpad_text_col;
@cp_comments-bg: @cryptpad_color_white;

@ -54,10 +54,10 @@ var grep = function (pattern, cb) {
}).join(' ');
// grep this repository, ignoring binary files and excluding anything matching the above patterns
var ignoreBinaries= '--binary-files=without-match ';
//var ignoreBinaries= '--binary-files=without-match ';
var command = 'git grep ' + pattern + " -- ':/' " + exclude;
Exec(command, function (err, stdout, stderr) {
Exec(command, function (err, stdout /*, stderr */) {
if (err && err.code === 1 && err.killed === false) {
if (isPossiblyGenerated(pattern)) {
return cb(void 0, true, 'POSSIBLY_GENERATED');
@ -114,13 +114,14 @@ var next = function () {
if (!key) { return; }
keys.shift();
if (!limit--) { return void console.log("[DONE]"); }
if (!limit) { return void console.log("[DONE]"); }
limit--;
grep(key, function (err, flagged, reason, output) {
if (err) {
return;
console.error("[%s]", key, err);
console.log();
return;
} else if (!flagged) {
} else if (reason === 'OTHER') {

@ -1198,9 +1198,10 @@ define([
"user": {
"id": String(myOOId), //"c0c3bf82-20d7-4663-bf6d-7fa39c598b1d",
"firstname": metadataMgr.getUserData().name || Messages.anonymous,
"name": metadataMgr.getUserData().name || Messages.anonymous,
},
"mode": "edit",
"lang": (navigator.language || navigator.userLanguage || '').slice(0,2)
"lang": (window.cryptpadLanguage || navigator.language || navigator.userLanguage || '').slice(0,2)
},
"events": {
"onAppReady": function(/*evt*/) {

File diff suppressed because one or more lines are too long

@ -24,6 +24,21 @@ body.cp-app-pad {
overflow: hidden;
}
@media screen and (max-height: @browser_media-medium-screen),
screen and (max-width: @browser_media-medium-screen) {
#cp-app-pad-toc {
margin: 5px;
&.hidden {
margin: 1px;
}
}
#cp-app-pad-comments {
.cp-pad-show, .cp-pad-hide {
display: none;
}
}
}
#cp-app-pad-toc, #cp-app-pad-comments, #cp-app-pad-resize {
.cp-pad-show, .cp-pad-hide {
position: absolute;
@ -68,6 +83,10 @@ body.cp-app-pad {
margin-left: -40px;
margin-top: 10px;
margin-right: 0;
button {
color: @cp_pad-resize;
border-color: @cp_pad-resize;
}
&.hidden {
margin-left: -70px;
margin-right: 40px;
@ -106,6 +125,29 @@ body.cp-app-pad {
}
}
}
#cp-app-pad-comments {
order: 3;
width: 330px;
//background-color: white;
margin: 10px;
position: relative;
.cp-pad-show, .cp-pad-hide {
left: 0;
}
h2 {
font-size: 1.5rem;
text-align: right;
}
.comments_main();
}
.cp-app-pad-comments-modal {
display: flex;
flex-flow: column;
max-height: 100%;
h2 {
text-align: left;
}
}
.cke_toolbox_main {
background-color: @cp_toolbar-bg;
@ -193,21 +235,6 @@ body.cp-app-pad {
}
}
}
#cp-app-pad-comments {
order: 3;
width: 330px;
//background-color: white;
margin: 10px;
position: relative;
.cp-pad-show, .cp-pad-hide {
left: 0;
}
h2 {
font-size: 1.5rem;
text-align: right;
}
.comments_main();
}
&.cke_body_width {
div.cp-comment-bubble {
button {

@ -636,6 +636,8 @@ define([
// If we've clicked on the show/hide buttons, always use our latest local value
if (typeof(Env.localHide) === "boolean") { hide = Env.localHide; }
if (Env.mobile) { hide = false; }
Env.$container.removeClass('hidden');
if (hide) { Env.$container.addClass('hidden'); }
@ -644,6 +646,10 @@ define([
$showBtn.addClass('notif');
}
if (Env.mobile && Env.current) {
Env.$container.find('.cp-comment-container[data-uid]').hide();
Env.$container.find('.cp-comment-container[data-uid="' + Env.current + '"]').show();
}
Env.$container.show();
};
@ -823,6 +829,9 @@ define([
v: canonicalize(Env.editor.getSelection().getSelectedText())
}]
};
Env.current = uid;
// There may be a race condition between updateMetadata and addMark that causes
// * updateMetadata first: comment not rendered (redrawComments called
// before addMark)
@ -839,6 +848,12 @@ define([
Env.$container.show();
Env.$container.find('> h2').after(form);
if (Env.modal) {
UI.openCustomModal(Env.modal);
Env.current = undefined;
Env.$container.find('.cp-comment-container[data-uid]').hide();
}
};
@ -934,7 +949,16 @@ define([
var $comment = $(e.target);
var uid = $comment.attr('data-uid');
if (!uid) { return; }
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').click();
if (Env.modal) {
UI.openCustomModal(Env.modal);
Env.current = uid;
Env.$container.find('.cp-comment-container[data-uid]').hide();
setTimeout(function () {
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').show().click();
});
} else {
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').click();
}
});
var call = function(f) {

@ -101,6 +101,7 @@ define([
logFights: true,
fights: [],
Cursor: Cursor,
mobile: $('body').width() <= 600
};
// MEDIATAG: Filter elements to serialize
@ -678,6 +679,7 @@ define([
var metadataMgr = framework._.sfCommon.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
var common = framework._.sfCommon;
var APP = window.APP;
var comments = Comments.create({
framework: framework,
@ -688,10 +690,13 @@ define([
$iframe: $iframe,
$inner: $inner,
$contentContainer: $contentContainer,
$container: $('#cp-app-pad-comments')
$container: $(APP.commentsEl),
modal: APP.mobile && APP.comments,
mobile: APP.mobile
});
var $resize = $('#cp-app-pad-resize');
if (module.mobile) { $resize.hide(); }
var $toc = $('#cp-app-pad-toc');
$toc.show();
@ -714,6 +719,7 @@ define([
mkHelpMenu(framework);
}
/*
framework._.sfCommon.getAttribute(['pad', 'width'], function(err, data) {
var active = data || typeof(data) === "undefined";
if (active) {
@ -722,6 +728,7 @@ define([
editor.execCommand('pagemode');
}
});
*/
framework.onEditableChange(function(unlocked) {
if (!framework.isReadOnly()) {
@ -813,9 +820,13 @@ define([
hide = md.defaultWidth === 0;
}
// If we've clicking on the show/hide buttons, always use our last value
// If we've clicked on the show/hide buttons, always use our last value
if (typeof(localHide) === "boolean") { hide = localHide; }
if (window.APP.mobile) {
hide = false;
}
$contentContainer.removeClass('cke_body_width');
$resize.removeClass('hidden');
if (hide) {
@ -870,7 +881,7 @@ define([
} else {
hide = md.defaultOutline === 0;
}
// If we've clicking on the show/hide buttons, always use our last value
// If we've clicked on the show/hide buttons, always use our last value
if (typeof(localHide) === "boolean") { hide = localHide; }
$toc.removeClass('hidden');
@ -1401,12 +1412,27 @@ define([
var $ckeToolbar = $('#cke_1_top').find('.cke_toolbox_main');
$mainContainer.prepend($ckeToolbar.addClass('cke_reset_all'));
$contentContainer.append(h('div#cp-app-pad-resize'));
$contentContainer.append(h('div#cp-app-pad-comments'));
var comments = h('div#cp-app-pad-comments');
var APP = window.APP;
APP.commentsEl = comments;
if (APP.mobile) {
APP.comments = UI.dialog.customModal(comments, {
buttons: [{
name: Messages.filePicker_close,
onClick: function () {}
}]
});
$(APP.comments).addClass('cp-app-pad-comments-modal');
} else {
$contentContainer.append(comments);
}
$contentContainer.prepend(h('div#cp-app-pad-toc'));
$ckeToolbar.find('.cke_button__image_icon').parent().hide();
var $iframe = $('iframe').contents();
if (window.CryptPad_theme === 'dark') {
/*if (window.CryptPad_theme === 'dark') {
$iframe.find('html').addClass('cp-dark').css({
'background-color': '#323232', // grey_850
'color': '#EEEEEE' // dark text_col
@ -1415,7 +1441,10 @@ define([
$iframe.find('html').css({
'background-color': '#FFF'
});
}
}*/
$iframe.find('html').css({
'background-color': '#FFF'
});
}).nThen(waitFor());
}).nThen(function(waitFor) {

Loading…
Cancel
Save