Fix the new userlist button and make the toolbar responsive
This commit is contained in:
@@ -727,45 +727,6 @@ define([
|
||||
});
|
||||
}
|
||||
break;
|
||||
/*case 'readonly':
|
||||
button = $('<button>', {
|
||||
title: Messages.getViewButton + '\n' + Messages.getViewButtonTitle,
|
||||
'class': "fa fa-eye",
|
||||
style: 'font:'+size+' FontAwesome'
|
||||
});
|
||||
if (data && data.viewHash) {
|
||||
var viewHash = data.viewHash;
|
||||
button.click(function() {
|
||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||
var url = baseUrl + viewHash;
|
||||
var $content = $('<div>').text(Messages.readonlyUrl);
|
||||
var $copy = $('<button>', {
|
||||
id: "cryptpad-readonly-copy",
|
||||
'class': "button action"
|
||||
}).text(Messages.copyReadOnly);
|
||||
var $open = $('<button>', {
|
||||
id: "cryptpad-readonly-open",
|
||||
'class': "button action"
|
||||
}).text(Messages.openReadOnly);
|
||||
$content.append('<br>').append($copy).append($open);
|
||||
common.alert($content.html());
|
||||
$("#cryptpad-readonly-copy").click(function() {
|
||||
var success = Clipboard.copy(url);
|
||||
if (success) {
|
||||
common.log(Messages.shareSuccess);
|
||||
common.findOKButton().click();
|
||||
return;
|
||||
}
|
||||
});
|
||||
$("#cryptpad-readonly-open").click(function() {
|
||||
common.findOKButton().click();
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
if (callback) { callback(); }
|
||||
});
|
||||
}
|
||||
break;*/
|
||||
case 'editshare':
|
||||
button = $('<button>', {
|
||||
title: Messages.editShareTitle,
|
||||
@@ -791,10 +752,9 @@ define([
|
||||
'class': "button action"
|
||||
}).text(Messages.viewShare);
|
||||
if (data && data.viewHash) {
|
||||
var viewHash = data.viewHash;
|
||||
button.click(function () {
|
||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||
var url = baseUrl + viewHash;
|
||||
var url = baseUrl + data.viewHash;
|
||||
var success = Clipboard.copy(url);
|
||||
if (success) {
|
||||
common.log(Messages.shareSuccess);
|
||||
@@ -810,10 +770,9 @@ define([
|
||||
'class': "button action"
|
||||
}).text(Messages.viewOpen);
|
||||
if (data && data.viewHash) {
|
||||
var viewHash = data.viewHash;
|
||||
button.click(function () {
|
||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||
var url = baseUrl + viewHash;
|
||||
var url = baseUrl + data.viewHash;
|
||||
common.findOKButton().click();
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
@@ -103,24 +103,26 @@ define([
|
||||
|
||||
var $editIcon = $('<button>', {
|
||||
'class': 'userlist dropbtn edit',
|
||||
title: Messages.editUsersIcon
|
||||
});
|
||||
var $editIconSmall = $editIcon.clone().addClass('small');
|
||||
var $viewIcon = $('<button>', {
|
||||
'class': 'userlist dropbtn view',
|
||||
title: Messages.viewUsersIcon
|
||||
});
|
||||
var $viewIconSmall = $viewIcon.clone().addClass('small');
|
||||
|
||||
var $shareTitle = $('<h2>').text(Messages.share);
|
||||
var $dropdownEditUsers = $('<p>', {'class': USERLIST_CLS});
|
||||
var $dropdownEditShare = $('<p>', {'class': EDITSHARE_CLS});
|
||||
if (readOnly !== 1) {
|
||||
$dropdownEditShare.append($shareTitle);
|
||||
}
|
||||
var $dropdownEditContainer = $('<div>', {'class': DROPDOWN_CONTAINER_CLS});
|
||||
var $dropdownEdit = $('<div>', {
|
||||
id: "cryptpad-dropdown-edit",
|
||||
'class': DROPDOWN_CLS
|
||||
}).append($dropdownEditUsers).append($dropdownEditShare);
|
||||
|
||||
var $dropdownViewShare = $('<p>', {'class': VIEWSHARE_CLS});
|
||||
var $dropdownViewShare = $('<p>', {'class': VIEWSHARE_CLS}).append($shareTitle.clone());
|
||||
var $dropdownViewContainer = $('<div>', {'class': DROPDOWN_CONTAINER_CLS});
|
||||
var $dropdownView = $('<div>', {
|
||||
id: "cryptpad-dropdown-view",
|
||||
@@ -223,18 +225,20 @@ define([
|
||||
|
||||
// Update the userlist
|
||||
var editUsersList = '';
|
||||
if (readOnly === 0) {
|
||||
editUsersNames.unshift(Messages.yourself);
|
||||
if (readOnly !== 1) {
|
||||
editUsersNames.unshift('<span class="yourself">' + Messages.yourself + '</span>');
|
||||
anonymous--;
|
||||
}
|
||||
if (anonymous > 0) {
|
||||
var text = anonymous === 1 ? Messages.anonymousUser : Messages.anonymousUsers;
|
||||
editUsersNames.push(anonymous + " " + text);
|
||||
editUsersNames.push('<span class="anonymous">' + anonymous + ' ' + text + '</span>');
|
||||
}
|
||||
if (editUsersNames.length > 0) {
|
||||
editUsersList += editUsersNames.join('<br>');
|
||||
}
|
||||
$userButtons.find('.' + USERLIST_CLS).html(editUsersList);
|
||||
var $usersTitle = $('<h2>').text(Messages.users);
|
||||
var $editUsers = $userButtons.find('.' + USERLIST_CLS);
|
||||
$editUsers.html('').append($usersTitle).append(editUsersList);
|
||||
|
||||
// Update the buttons
|
||||
var fa_caretdown = '<span class="fa fa-caret-down" style="font-family:FontAwesome;"></span>';
|
||||
@@ -313,11 +317,18 @@ define([
|
||||
var connected = false;
|
||||
|
||||
if (config.ifrw) {
|
||||
$(config.ifrw).on('click', function (e) {
|
||||
if (!e.target.matches('.dropbtn') && !e.target.parentElement.matches('.dropbtn')) {
|
||||
$container.find('.cryptpad-dropdown').hide();
|
||||
var removeDropdowns = function (e) {
|
||||
if (e.target.matches('.dropbtn') || (e.target.parentElement && e.target.parentElement.matches('.dropbtn'))) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
$container.find('.cryptpad-dropdown').hide();
|
||||
};
|
||||
$(config.ifrw).on('click',removeDropdowns);
|
||||
if (config.ifrw.$('iframe').length) {
|
||||
var innerIfrw = config.ifrw.$('iframe').each(function (i, el) {
|
||||
$(el.contentWindow).on('click', removeDropdowns);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
userList.onChange = function(newUserData) {
|
||||
|
||||
Reference in New Issue
Block a user