define([ 'jquery', '/common/toolbar3.js', '/common/cryptpad-common.js', '/bower_components/nthen/index.js', '/common/sframe-common.js', '/common/common-interface.js', '/bower_components/file-saver/FileSaver.min.js', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'less!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/customize/src/less2/main.less', ], function ( $, Toolbar, Cryptpad, nThen, SFCommon, UI ) { var saveAs = window.saveAs; var Messages = Cryptpad.Messages; var APP = window.APP = { Cryptpad: Cryptpad, }; var onConnectError = function () { UI.errorLoadingScreen(Messages.websocketError); }; var common; var metadataMgr; var privateData; var sframeChan; var categories = { 'account': [ 'cp-settings-info-block', 'cp-settings-displayname', 'cp-settings-language-selector', 'cp-settings-logout-everywhere', 'cp-settings-resettips', 'cp-settings-thumbnails', 'cp-settings-userfeedback' ], 'drive': [ 'cp-settings-backup-drive', 'cp-settings-import-local-pads', 'cp-settings-reset-drive' ], 'code': [ 'cp-settings-indent-unit', 'cp-settings-indent-type' ] }; var createInfoBlock = function () { var $div = $('
', {'class': 'cp-settings-info-block'}); var $account = $('
', {'class': 'cp-sidebarlayout-element'}).appendTo($div); var accountName = privateData.accountName; var $label = $('', {'class': 'label'}).text(Messages.user_accountName); var $name = $('').text(accountName || ''); if (!accountName) { $label.text(''); $name.text(Messages.settings_anonymous); } $account.append($label).append($name); var publicKey = privateData.edPublic; if (publicKey) { var $key = $('
', {'class': 'cp-sidebarlayout-element'}).appendTo($div); var userHref = Cryptpad.getUserHrefFromKeys(accountName, publicKey); var $pubLabel = $('', {'class': 'label'}) .text(Messages.settings_publicSigningKey); $key.append($pubLabel).append(UI.dialog.selectable(userHref)); } return $div; }; // Create the block containing the display name field var createDisplayNameInput = function () { var $div = $('
', {'class': 'cp-settings-displayname cp-sidebarlayout-element'}); $('