Merge branch 'main' into soon

pull/1/head
ansuz 3 years ago
commit 5bf21a25c0

@ -1965,12 +1965,17 @@ define([
if (!categories[active]) { active = 'general'; } if (!categories[active]) { active = 'general'; }
common.setHash(active); common.setHash(active);
Object.keys(categories).forEach(function (key) { Object.keys(categories).forEach(function (key) {
var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories);
var iconClass = SIDEBAR_ICONS[key]; var iconClass = SIDEBAR_ICONS[key];
var icon;
if (iconClass) { if (iconClass) {
$category.append($('<span>', {'class': iconClass})); icon = h('span', { class: iconClass });
} }
var $category = $(h('div', {
'class': 'cp-sidebarlayout-category'
}, [
icon,
Messages['admin_cat_'+key] || key,
])).appendTo($categories);
if (key === active) { if (key === active) {
$category.addClass('cp-leftside-active'); $category.addClass('cp-leftside-active');
} }
@ -1987,7 +1992,6 @@ define([
showCategories(categories[key]); showCategories(categories[key]);
}); });
$category.append(Messages['admin_cat_'+key] || key);
}); });
showCategories(categories[active]); showCategories(categories[active]);
}; };

@ -50,11 +50,6 @@ define([
var key = $el.data('localization'); var key = $el.data('localization');
$el.html(Messages[key]); $el.html(Messages[key]);
}; };
var translateAppend = function (i, e) {
var $el = $(e);
var key = $el.data('localization-append');
$el.append(Messages[key]);
};
var translateTitle = function () { var translateTitle = function () {
var $el = $(this); var $el = $(this);
var key = $el.data('localization-title'); var key = $el.data('localization-title');
@ -66,11 +61,9 @@ define([
$el.attr('placeholder', Messages[key]); $el.attr('placeholder', Messages[key]);
}; };
$('[data-localization]').each(translateText); $('[data-localization]').each(translateText);
$('[data-localization-append]').each(translateAppend);
$('[data-localization-title]').each(translateTitle); $('[data-localization-title]').each(translateTitle);
$('[data-localization-placeholder]').each(translatePlaceholder); $('[data-localization-placeholder]').each(translatePlaceholder);
$('#pad-iframe').contents().find('[data-localization]').each(translateText); $('#pad-iframe').contents().find('[data-localization]').each(translateText);
$('#pad-iframe').contents().find('[data-localization-append]').each(translateAppend);
$('#pad-iframe').contents().find('[data-localization-title]').each(translateTitle); $('#pad-iframe').contents().find('[data-localization-title]').each(translateTitle);
$('#pad-iframe').contents().find('[data-localization-placeholder]').each(translatePlaceholder); $('#pad-iframe').contents().find('[data-localization-placeholder]').each(translatePlaceholder);
}; };

@ -1420,9 +1420,20 @@ define([
} }
// Button // Button
var $button = $('<button>', { var $button;
if (config.buttonContent) {
$button = $(h('button', {
class: config.buttonCls || '',
}, [
h('span.cp-dropdown-button-title', config.buttonContent),
]));
} else {
$button = $('<button>', {
'class': config.buttonCls || '' 'class': config.buttonCls || ''
}).append($('<span>', {'class': 'cp-dropdown-button-title'}).html(config.text || "")); }).append($('<span>', {'class': 'cp-dropdown-button-title'}).text(config.text || ""));
}
if (config.caretDown) { if (config.caretDown) {
$('<span>', { $('<span>', {
'class': 'fa fa-caret-down', 'class': 'fa fa-caret-down',
@ -1445,8 +1456,24 @@ define([
var setOptions = function (options) { var setOptions = function (options) {
options.forEach(function (o) { options.forEach(function (o) {
if (!isValidOption(o)) { return; } if (!isValidOption(o)) { return; }
if (isElement(o)) { return $innerblock.append($(o)); } if (isElement(o)) { return $innerblock.append(o); }
var $el = $('<' + o.tag + '>', o.attributes || {}).html(o.content || ''); var $el = $('<' + o.tag + '>', o.attributes || {});
if (typeof(o.content) === 'string' || (o.content instanceof Element)) {
o.content = [o.content];
}
if (Array.isArray(o.content)) {
o.content.forEach(function (item) {
if (item instanceof Element) {
return void $el.append(item);
}
if (typeof(item) === 'string') {
$el[0].appendChild(document.createTextNode(item));
}
});
// array of elements or text nodes
}
$el.appendTo($innerblock); $el.appendTo($innerblock);
if (typeof(o.action) === 'function') { if (typeof(o.action) === 'function') {
$el.click(function (e) { $el.click(function (e) {
@ -1533,8 +1560,8 @@ define([
$container.on('click', 'a', function () { $container.on('click', 'a', function () {
value = $(this).data('value'); value = $(this).data('value');
var $val = $(this); var $val = $(this);
var textValue = $val.html() || value; var textValue = $val.text() || value;
$button.find('.cp-dropdown-button-title').html(textValue); $button.find('.cp-dropdown-button-title').text(textValue);
$container.onChange.fire(textValue, value); $container.onChange.fire(textValue, value);
}); });
$container.keydown(function (e) { $container.keydown(function (e) {
@ -1594,14 +1621,13 @@ define([
$container.setValue = function (val, name, sync) { $container.setValue = function (val, name, sync) {
value = val; value = val;
var $val = $innerblock.find('[data-value="'+val+'"]'); var $val = $innerblock.find('[data-value="'+val+'"]');
var textValue = name || $val.html() || val; var textValue = name || $val.text() || val;
if (sync) { var f = function () {
$button.find('.cp-dropdown-button-title').html(textValue); $button.find('.cp-dropdown-button-title').text(textValue);
return; };
}
setTimeout(function () { if (sync) { return void f(); }
$button.find('.cp-dropdown-button-title').html(textValue); setTimeout(f);
});
}; };
$container.getValue = function () { $container.getValue = function () {
return typeof(value) === "undefined" ? '' : value; return typeof(value) === "undefined" ? '' : value;
@ -1676,33 +1702,37 @@ define([
var metadataMgr = Common.getMetadataMgr(); var metadataMgr = Common.getMetadataMgr();
var displayNameCls = config.displayNameCls || 'cp-toolbar-user-name'; var displayNameCls = config.displayNameCls || 'cp-toolbar-user-name';
var $displayedName = $('<span>', {'class': displayNameCls});
var priv = metadataMgr.getPrivateData(); var priv = metadataMgr.getPrivateData();
var accountName = Util.fixHTML(priv.accountName); var accountName = Util.fixHTML(priv.accountName);
var origin = priv.origin; var origin = priv.origin;
var padType = metadataMgr.getMetadata().type; var padType = metadataMgr.getMetadata().type;
var $userName = $('<span>');
var options = []; var options = [];
if (config.displayNameCls) { if (config.displayNameCls) {
var $userAdminContent = $('<p>'); var userAdminContent = [];
if (accountName) { if (accountName) {
var $userAccount = $('<span>').append(Messages.user_accountName + ': '); userAdminContent.push(h('span', [
Messages.user_accountName,
$userAdminContent.append($userAccount).append(accountName); ': ',
$userAdminContent.append($('<br>')); h('span', accountName),
]));
userAdminContent.push(h('br'));
} }
if (config.displayName && !AppConfig.disableProfile) { if (config.displayName && !AppConfig.disableProfile) {
// Hide "Display name:" in read only mode // Hide "Display name:" in read only mode
$userName.append(Messages.user_displayName + ': '); userAdminContent.push(h('span', [
$userName.append($displayedName); Messages.user_displayName,
': ',
h('span', {
class: displayNameCls,
}),
]));
} }
$userAdminContent.append($userName);
options.push({ options.push({
tag: 'p', tag: 'p',
attributes: {'class': 'cp-toolbar-account'}, attributes: {'class': 'cp-toolbar-account'},
content: $userAdminContent.html() content: userAdminContent,
}); });
} }
@ -1964,7 +1994,7 @@ define([
$userbig.append($('<span>', {'class': 'account-name'}).text(accountName)); $userbig.append($('<span>', {'class': 'account-name'}).text(accountName));
}*/ }*/
var dropdownConfigUser = { var dropdownConfigUser = {
text: $userButton.html(), // Button initial text buttonContent: $userButton[0],
options: options, // Entries displayed in the menu options: options, // Entries displayed in the menu
left: true, // Open to the left of the button left: true, // Open to the left of the button
container: config.$initBlock, // optional container: config.$initBlock, // optional
@ -2066,7 +2096,9 @@ define([
'data-value': l, 'data-value': l,
'href': '#', 'href': '#',
}, },
content: languages[l] // Pretty name of the language value content: [ // supplying content as an array ensures it's a text node, not parsed HTML
languages[l] // Pretty name of the language value
],
}); });
}); });
var dropdownConfig = { var dropdownConfig = {

@ -2935,34 +2935,49 @@ define([
if (isInRoot) { if (isInRoot) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-folder'}, attributes: {'class': 'cp-app-drive-new-folder pewpew'},
content: $('<div>').append($folderIcon.clone()).html() + Messages.fm_folder content: [
$folderIcon.clone()[0],
Messages.fm_folder,
],
}); });
if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) { if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-shared-folder'}, attributes: {'class': 'cp-app-drive-new-shared-folder'},
content: $('<div>').append($sharedFolderIcon.clone()).html() + Messages.fm_sharedFolder content: [
$sharedFolderIcon.clone()[0],
Messages.fm_sharedFolder,
],
}); });
} }
options.push({tag: 'hr'}); options.push({tag: 'hr'});
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-fileupload'}, attributes: {'class': 'cp-app-drive-new-fileupload'},
content: $('<div>').append(getIcon('fileupload')).html() + Messages.uploadButton content: [
getIcon('fileupload')[0],
Messages.uploadButton,
],
}); });
if (APP.allowFolderUpload) { if (APP.allowFolderUpload) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-folderupload'}, attributes: {'class': 'cp-app-drive-new-folderupload'},
content: $('<div>').append(getIcon('folderupload')).html() + Messages.uploadFolderButton content: [
getIcon('folderupload')[0],
Messages.uploadFolderButton,
],
}); });
} }
options.push({tag: 'hr'}); options.push({tag: 'hr'});
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-link'}, attributes: {'class': 'cp-app-drive-new-link'},
content: $('<div>').append(getIcon('link')).html() + Messages.fm_link_new content: [
getIcon('link')[0],
Messages.fm_link_new,
],
}); });
options.push({tag: 'hr'}); options.push({tag: 'hr'});
} }
@ -2983,14 +2998,17 @@ define([
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: attributes, attributes: attributes,
content: $('<div>').append(getIcon(type)).html() + Messages.type[type] content: [
getIcon(type)[0],
Messages.type[type],
],
}); });
}); });
var $plusIcon = $('<div>').append($('<span>', {'class': 'fa fa-plus'}));
var dropdownConfig = { var dropdownConfig = {
text: $plusIcon.html() + '<span>'+Messages.fm_newButton+'</span>', buttonContent: [
h('span.fa.fa-plus'),
h('span', Messages.fm_newButton),
],
options: options, options: options,
feedback: 'DRIVE_NEWPAD_LOCALFOLDER', feedback: 'DRIVE_NEWPAD_LOCALFOLDER',
common: common common: common
@ -3071,15 +3089,24 @@ define([
var options = [{ var options = [{
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-element-type'}, attributes: {'class': 'cp-app-drive-element-type'},
content: '<i class="fa fa-minus"></i>' + Messages.fm_type content: [
h('i.fa.fa-minus'),
Messages.fm_type,
],
},{ },{
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-element-atime'}, attributes: {'class': 'cp-app-drive-element-atime'},
content: '<i class="fa fa-minus"></i>' + Messages.fm_lastAccess content: [
h('i.fa.fa-minus'),
Messages.fm_lastAccess,
],
},{ },{
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-element-ctime'}, attributes: {'class': 'cp-app-drive-element-ctime'},
content: '<i class="fa fa-minus"></i>' + Messages.fm_creation content: [
h('i.fa.fa-minus'),
Messages.fm_creation,
],
}]; }];
var dropdownConfig = { var dropdownConfig = {
text: '', // Button initial text text: '', // Button initial text

@ -663,7 +663,7 @@ define([
'data-value': '', 'data-value': '',
'href': '#' 'href': '#'
}, },
content: '&nbsp;' content: ' ',
}); });
var dropdownConfig = { var dropdownConfig = {
text: ext, // Button initial text text: ext, // Button initial text

@ -343,7 +343,7 @@ define([
'data-value': l.mode, 'data-value': l.mode,
'href': '#', 'href': '#',
}, },
content: l.language // Pretty name of the language value content: [l.language] // Pretty name of the language value
}); });
}); });
var dropdownConfig = { var dropdownConfig = {
@ -395,7 +395,7 @@ define([
'data-value': l.name, 'data-value': l.name,
'href': '#', 'href': '#',
}, },
content: l.name // Pretty name of the language value content: [l.name] // Pretty name of the language value
}); });
}); });
var dropdownConfig = { var dropdownConfig = {

@ -8,6 +8,6 @@ This file is intended to be used as a log of what third-party source we have ven
* [jscolor v2.0.5](https://jscolor.com/) for providing a consistent color picker across all browsers * [jscolor v2.0.5](https://jscolor.com/) for providing a consistent color picker across all browsers
* [jquery.ui 1.12.1](https://jqueryui.com/) for its 'autocomplete' extension which is used for our tag picker * [jquery.ui 1.12.1](https://jqueryui.com/) for its 'autocomplete' extension which is used for our tag picker
* [pdfjs](https://mozilla.github.io/pdf.js/) with some minor modifications to prevent CSP errors * [pdfjs](https://mozilla.github.io/pdf.js/) with some minor modifications to prevent CSP errors
* [mermaid 8.13.8](https://github.com/mermaid-js/mermaid/releases/tag/8.13.4) extends our markdown integration to support a variety of diagram types * [mermaid 8.13.10](https://github.com/mermaid-js/mermaid/releases/tag/8.13.4) extends our markdown integration to support a variety of diagram types
* [Fabricjs 4.6.0](https://github.com/fabricjs/fabric.js) and [Fabric-history](https://github.com/lyzerk/fabric-history) for the whiteboard app * [Fabricjs 4.6.0](https://github.com/fabricjs/fabric.js) and [Fabric-history](https://github.com/lyzerk/fabric-history) for the whiteboard app

File diff suppressed because one or more lines are too long

@ -271,7 +271,7 @@ define([
// Pending friend (we've sent a friend request) // Pending friend (we've sent a friend request)
var pendingFriends = APP.common.getPendingFriends(); // Friend requests sent var pendingFriends = APP.common.getPendingFriends(); // Friend requests sent
if (pendingFriends[data.curvePublic]) { if (pendingFriends[data.curvePublic]) {
$button.attr('disabled', 'disabled').append(Messages.profile_friendRequestSent); $button.attr('disabled', 'disabled').text(Messages.profile_friendRequestSent);
addCancel(); addCancel();
return; return;
} }
@ -522,7 +522,7 @@ define([
var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories); var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories);
$category.append($('<span>', {'class': 'fa fa-user'})); $category.append($('<span>', {'class': 'fa fa-user'}));
$category.addClass('cp-leftside-active'); $category.addClass('cp-leftside-active');
$category.append(Messages.profileButton); $category.text(Messages.profileButton);
}; };
var init = function () { var init = function () {
@ -603,7 +603,7 @@ define([
if (!privateData.readOnly && !common.isLoggedIn()) { if (!privateData.readOnly && !common.isLoggedIn()) {
UI.removeLoadingScreen(); UI.removeLoadingScreen();
var $p = $('<p>', {id: CREATE_ID}).append(Messages.profile_register); var $p = $('<p>', {id: CREATE_ID}).text(Messages.profile_register);
var $a = $('<a>', { var $a = $('<a>', {
href: APP.origin + '/register/' href: APP.origin + '/register/'
}); });

@ -340,9 +340,10 @@ define([
$('<span>', { 'class': 'label' }).text(Messages.settings_userFeedbackTitle).appendTo($div); $('<span>', { 'class': 'label' }).text(Messages.settings_userFeedbackTitle).appendTo($div);
$('<span>', { 'class': 'cp-sidebarlayout-description' }) $div.append(h('span.cp-sidebarlayout-description', [
.append(Messages.settings_userFeedbackHint1) Messages.settings_userFeedbackHint1,
.append(Messages.settings_userFeedbackHint2).appendTo($div); Messages.settings_userFeedbackHint2,
]));
var $ok = $('<span>', { 'class': 'fa fa-check', title: Messages.saved }); var $ok = $('<span>', { 'class': 'fa fa-check', title: Messages.saved });
var $spinner = $('<span>', { 'class': 'fa fa-spinner fa-pulse' }); var $spinner = $('<span>', { 'class': 'fa fa-spinner fa-pulse' });
@ -851,9 +852,9 @@ define([
$('<span>', { 'class': 'label' }).text(Messages.settings_driveRedirectTitle).appendTo($div); $('<span>', { 'class': 'label' }).text(Messages.settings_driveRedirectTitle).appendTo($div);
$('<span>', { 'class': 'cp-sidebarlayout-description' }) $div.append(h('span', {
.append(Messages.settings_driveRedirectHint) class: 'cp-sidebarlayout-description',
.appendTo($div); }, Messages.settings_driveRedirectHint));
var $ok = $('<span>', { 'class': 'fa fa-check', title: Messages.saved }); var $ok = $('<span>', { 'class': 'fa fa-check', title: Messages.saved });
var $spinner = $('<span>', { 'class': 'fa fa-spinner fa-pulse' }); var $spinner = $('<span>', { 'class': 'fa fa-spinner fa-pulse' });
@ -1719,16 +1720,22 @@ define([
var active = privateData.category || 'account'; var active = privateData.category || 'account';
if (!categories[active]) { active = 'account'; } if (!categories[active]) { active = 'account'; }
Object.keys(categories).forEach(function(key) { Object.keys(categories).forEach(function(key) {
var $category = $('<div>', {
'class': 'cp-sidebarlayout-category',
'data-category': key
}).appendTo($categories);
var iconClass = SIDEBAR_ICONS[key]; var iconClass = SIDEBAR_ICONS[key];
var icon;
if (iconClass) { if (iconClass) {
$category.append($('<span>', { 'class': iconClass })); icon = h('span', {
class: iconClass,
});
} }
var $category = $(h('div.cp-sidebarlayout-category', {
'data-category': key
}, [
icon,
Messages['settings_cat_' + key] || key,
])).appendTo($categories);
if (key === active) { if (key === active) {
$category.addClass('cp-leftside-active'); $category.addClass('cp-leftside-active');
} }
@ -1744,8 +1751,6 @@ define([
$category.addClass('cp-leftside-active'); $category.addClass('cp-leftside-active');
showCategories(categories[key]); showCategories(categories[key]);
}); });
$category.append(Messages['settings_cat_' + key] || key);
}); });
showCategories(categories[active]); showCategories(categories[active]);
common.setHash(active); common.setHash(active);

@ -229,7 +229,7 @@ define([
var refreshValue = function () { var refreshValue = function () {
$bgValue.html(''); $bgValue.html('');
if (slideOptionsTmp.background && slideOptionsTmp.background.name) { if (slideOptionsTmp.background && slideOptionsTmp.background.name) {
$bgValue.append(Messages._getKey("printBackgroundValue", [slideOptionsTmp.background.name])); $bgValue.append(Messages._getKey("printBackgroundValue", [Util.fixHTML(slideOptionsTmp.background.name)]));
$('<span>', { $('<span>', {
'class': 'fa fa-times', 'class': 'fa fa-times',
title: Messages.printBackgroundRemove, title: Messages.printBackgroundRemove,

Loading…
Cancel
Save