|
|
@ -33,6 +33,7 @@ define([
|
|
|
|
var USERLIST_CLS = Bar.constants.userlist = "cryptpad-dropdown-users";
|
|
|
|
var USERLIST_CLS = Bar.constants.userlist = "cryptpad-dropdown-users";
|
|
|
|
var EDITSHARE_CLS = Bar.constants.editShare = "cryptpad-dropdown-editShare";
|
|
|
|
var EDITSHARE_CLS = Bar.constants.editShare = "cryptpad-dropdown-editShare";
|
|
|
|
var VIEWSHARE_CLS = Bar.constants.viewShare = "cryptpad-dropdown-viewShare";
|
|
|
|
var VIEWSHARE_CLS = Bar.constants.viewShare = "cryptpad-dropdown-viewShare";
|
|
|
|
|
|
|
|
var SHARE_CLS = Bar.constants.viewShare = "cryptpad-dropdown-share";
|
|
|
|
var DROPDOWN_CONTAINER_CLS = Bar.constants.dropdownContainer = "cryptpad-dropdown-container";
|
|
|
|
var DROPDOWN_CONTAINER_CLS = Bar.constants.dropdownContainer = "cryptpad-dropdown-container";
|
|
|
|
var DROPDOWN_CLS = Bar.constants.dropdown = "cryptpad-dropdown";
|
|
|
|
var DROPDOWN_CLS = Bar.constants.dropdown = "cryptpad-dropdown";
|
|
|
|
var TITLE_CLS = Bar.constants.title = "cryptpad-title";
|
|
|
|
var TITLE_CLS = Bar.constants.title = "cryptpad-title";
|
|
|
@ -95,75 +96,37 @@ define([
|
|
|
|
}, SPINNER_DISAPPEAR_TIME);
|
|
|
|
}, SPINNER_DISAPPEAR_TIME);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createUserButtons = function ($userlistElement, readOnly) {
|
|
|
|
var createUserButtons = function ($userlistElement, readOnly, Cryptpad) {
|
|
|
|
var $listElement = $('<span>', {
|
|
|
|
|
|
|
|
id: 'userButtons',
|
|
|
|
|
|
|
|
'class': USERBUTTONS_CONTAINER_CLS
|
|
|
|
|
|
|
|
}).appendTo($userlistElement);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var createHandler = function ($elmt) {
|
|
|
|
|
|
|
|
return function () {
|
|
|
|
|
|
|
|
if ($elmt.is(':visible')) {
|
|
|
|
|
|
|
|
$elmt.hide();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$userlistElement.find('.' + DROPDOWN_CLS).hide();
|
|
|
|
|
|
|
|
$elmt.show();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fa_caretdown = '<span class="fa fa-caret-down" style="font-family:FontAwesome;"></span>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// User list button
|
|
|
|
// User list button
|
|
|
|
var $editIcon = $('<button>', {
|
|
|
|
var dropdownConfig = {
|
|
|
|
'class': 'userlist dropbtn edit',
|
|
|
|
options: [{
|
|
|
|
});
|
|
|
|
tag: 'p',
|
|
|
|
var $editIconSmall = $editIcon.clone().addClass('small');
|
|
|
|
attributes: {'class': USERLIST_CLS},
|
|
|
|
var $dropdownEditUsers = $('<p>', {'class': USERLIST_CLS});
|
|
|
|
}] // Entries displayed in the menu
|
|
|
|
var $dropdownEditContainer = $('<div>', {'class': DROPDOWN_CONTAINER_CLS});
|
|
|
|
};
|
|
|
|
var $dropdownEdit = $('<div>', {
|
|
|
|
var $block = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
id: "cryptpad-dropdown-edit",
|
|
|
|
$block.attr('id', 'userButtons');
|
|
|
|
'class': DROPDOWN_CLS
|
|
|
|
$userlistElement.append($block);
|
|
|
|
}).append($dropdownEditUsers); //.append($dropdownEditShare);
|
|
|
|
|
|
|
|
$editIcon.click(createHandler($dropdownEdit));
|
|
|
|
|
|
|
|
$editIconSmall.click(createHandler($dropdownEdit));
|
|
|
|
|
|
|
|
$dropdownEditContainer.append($editIcon).append($editIconSmall).append($dropdownEdit);
|
|
|
|
|
|
|
|
$listElement.append($dropdownEditContainer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Share button
|
|
|
|
// Share button
|
|
|
|
var fa_share = '<span class="fa fa-share-alt" style="font-family:FontAwesome;"></span>';
|
|
|
|
var $shareIcon = $('<span>', {'class': 'fa fa-share-alt'});
|
|
|
|
var fa_editusers = '<span class="fa fa-users" style="font-family:FontAwesome;"></span>';
|
|
|
|
var $span = $('<span>', {'class': 'large'}).append($shareIcon.clone()).append(' ' +Messages.shareButton);
|
|
|
|
var fa_viewusers = '<span class="fa fa-eye" style="font-family:FontAwesome;"></span>';
|
|
|
|
var $spanSmall = $('<span>', {'class': 'small'}).append($shareIcon.clone());
|
|
|
|
var $shareIcon = $('<button>', {
|
|
|
|
var dropdownConfigShare = {
|
|
|
|
'class': 'userlist dropbtn share',
|
|
|
|
text: $('<div>').append($span).append($spanSmall).html(),
|
|
|
|
}).html(fa_share + ' ' + Messages.shareButton + ' ' + fa_caretdown);
|
|
|
|
options: []
|
|
|
|
var $shareIconSmall = $shareIcon.clone().addClass('small').html(fa_share + ' ' + fa_caretdown);
|
|
|
|
};
|
|
|
|
var $shareTitle = $('<h2>').html(fa_editusers + ' ' + Messages.shareEdit);
|
|
|
|
var $shareBlock = Cryptpad.createDropdown(dropdownConfigShare);
|
|
|
|
var $shareTitleView = $('<h2>').html(fa_viewusers + ' ' + Messages.shareView);
|
|
|
|
$shareBlock.find('.dropdown-bar-content').addClass(SHARE_CLS).addClass(EDITSHARE_CLS).addClass(VIEWSHARE_CLS);
|
|
|
|
var $dropdownShareP = $('<p>', {'class': EDITSHARE_CLS}).append($shareTitle);
|
|
|
|
$userlistElement.append($shareBlock);
|
|
|
|
var $dropdownSharePView = $('<p>', {'class': VIEWSHARE_CLS}).append($shareTitleView);
|
|
|
|
|
|
|
|
var $dropdownShareContainer = $('<div>', {'class': DROPDOWN_CONTAINER_CLS});
|
|
|
|
|
|
|
|
var $dropdownShare = $('<div>', {
|
|
|
|
|
|
|
|
id: "cryptpad-dropdown-share",
|
|
|
|
|
|
|
|
'class': DROPDOWN_CLS
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (readOnly !== 1) {
|
|
|
|
|
|
|
|
// Hide the "Share edit URL" section when in read-only mode
|
|
|
|
|
|
|
|
$dropdownShare.append($dropdownShareP);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$dropdownShare.append($dropdownSharePView);
|
|
|
|
|
|
|
|
$shareIcon.click(createHandler($dropdownShare));
|
|
|
|
|
|
|
|
$shareIconSmall.click(createHandler($dropdownShare));
|
|
|
|
|
|
|
|
$dropdownShareContainer.append($shareIcon).append($shareIconSmall).append($dropdownShare);
|
|
|
|
|
|
|
|
$listElement.append($dropdownShareContainer);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createUserList = function ($container, readOnly) {
|
|
|
|
var createUserList = function ($container, readOnly, Cryptpad) {
|
|
|
|
var $userlist = $('<div>', {
|
|
|
|
var $userlist = $('<div>', {
|
|
|
|
'class': USER_LIST_CLS,
|
|
|
|
'class': USER_LIST_CLS,
|
|
|
|
id: uid(),
|
|
|
|
id: uid(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
createUserButtons($userlist, readOnly);
|
|
|
|
createUserButtons($userlist, readOnly, Cryptpad);
|
|
|
|
$container.append($userlist);
|
|
|
|
$container.append($userlist);
|
|
|
|
return $userlist[0];
|
|
|
|
return $userlist[0];
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -260,8 +223,11 @@ define([
|
|
|
|
var fa_viewusers = '<span class="fa fa-eye" style="font-family:FontAwesome;"></span>';
|
|
|
|
var fa_viewusers = '<span class="fa fa-eye" style="font-family:FontAwesome;"></span>';
|
|
|
|
var viewersText = numberOfViewUsers > 1 ? Messages.viewers : Messages.viewer;
|
|
|
|
var viewersText = numberOfViewUsers > 1 ? Messages.viewers : Messages.viewer;
|
|
|
|
var editorsText = numberOfEditUsers > 1 ? Messages.editors : Messages.editor;
|
|
|
|
var editorsText = numberOfEditUsers > 1 ? Messages.editors : Messages.editor;
|
|
|
|
$userButtons.find('.userlist.edit').html(fa_editusers + ' ' + numberOfEditUsers + ' ' + editorsText + ' ' + fa_viewusers + ' ' + numberOfViewUsers + ' ' + viewersText + ' ' + fa_caretdown);
|
|
|
|
// $userButtons.find('.userlist.edit').html(fa_editusers + ' ' + numberOfEditUsers + ' ' + editorsText + ' ' + fa_viewusers + ' ' + numberOfViewUsers + ' ' + viewersText + ' ' + fa_caretdown);
|
|
|
|
$userButtons.find('.userlist.edit.small').html(fa_editusers + ' ' + numberOfEditUsers + ' ' + fa_viewusers + ' ' + numberOfViewUsers + ' ' + fa_caretdown);
|
|
|
|
var $span = $('<span>', {'class': 'large'}).html(fa_editusers + ' ' + numberOfEditUsers + ' ' + editorsText + ' ' + fa_viewusers + ' ' + numberOfViewUsers + ' ' + viewersText);
|
|
|
|
|
|
|
|
// $userButtons.find('.userlist.edit.small').html(fa_editusers + ' ' + numberOfEditUsers + ' ' + fa_viewusers + ' ' + numberOfViewUsers + ' ' + fa_caretdown);
|
|
|
|
|
|
|
|
var $spansmall = $('<span>', {'class': 'small'}).html(fa_editusers + ' ' + numberOfEditUsers + ' ' + fa_viewusers + ' ' + numberOfViewUsers);
|
|
|
|
|
|
|
|
$userButtons.find('.buttonTitle').html('').append($span).append($spansmall);
|
|
|
|
|
|
|
|
|
|
|
|
// Change username button
|
|
|
|
// Change username button
|
|
|
|
var $userElement = $userAdminElement.find('.' + USERNAME_CLS);
|
|
|
|
var $userElement = $userAdminElement.find('.' + USERNAME_CLS);
|
|
|
@ -368,11 +334,6 @@ define([
|
|
|
|
// Dropdown language selector
|
|
|
|
// Dropdown language selector
|
|
|
|
Cryptpad.createLanguageSelector($userContainer);
|
|
|
|
Cryptpad.createLanguageSelector($userContainer);
|
|
|
|
|
|
|
|
|
|
|
|
/*$select.on('mousedown', function (e) {
|
|
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $usernameElement = $('<span>', {'class': USERNAME_CLS}).appendTo($userContainer);
|
|
|
|
var $usernameElement = $('<span>', {'class': USERNAME_CLS}).appendTo($userContainer);
|
|
|
|
|
|
|
|
|
|
|
|
return $userContainer;
|
|
|
|
return $userContainer;
|
|
|
@ -462,7 +423,7 @@ define([
|
|
|
|
var Cryptpad = config.common;
|
|
|
|
var Cryptpad = config.common;
|
|
|
|
|
|
|
|
|
|
|
|
var toolbar = createRealtimeToolbar($container);
|
|
|
|
var toolbar = createRealtimeToolbar($container);
|
|
|
|
var userListElement = config.userData ? createUserList(toolbar.find('.' + LEFTSIDE_CLS), readOnly) : undefined;
|
|
|
|
var userListElement = config.userData ? createUserList(toolbar.find('.' + LEFTSIDE_CLS), readOnly, Cryptpad) : undefined;
|
|
|
|
var $titleElement = createTitle(toolbar.find('.' + TOP_CLS), readOnly, config.title, Cryptpad);
|
|
|
|
var $titleElement = createTitle(toolbar.find('.' + TOP_CLS), readOnly, config.title, Cryptpad);
|
|
|
|
var $linkElement = createLinkToMain(toolbar.find('.' + TOP_CLS));
|
|
|
|
var $linkElement = createLinkToMain(toolbar.find('.' + TOP_CLS));
|
|
|
|
var lagElement = createLagElement();
|
|
|
|
var lagElement = createLagElement();
|
|
|
@ -478,9 +439,6 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
if (config.ifrw) {
|
|
|
|
if (config.ifrw) {
|
|
|
|
var removeDropdowns = function (e) {
|
|
|
|
var removeDropdowns = function (e) {
|
|
|
|
if ($(e.target).parents('.cryptpad-dropdown-container').length) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$container.find('.cryptpad-dropdown').hide();
|
|
|
|
$container.find('.cryptpad-dropdown').hide();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var cancelEditTitle = function (e) {
|
|
|
|
var cancelEditTitle = function (e) {
|
|
|
|