define([ 'jquery', '/customize/application_config.js', '/api/config' ], function ($, Config, ApiConfig) { var Messages = {}; var Bar = { constants: {}, }; /** Id of the div containing the user list. */ var USER_LIST_CLS = Bar.constants.userlist = 'cryptpad-user-list'; /** Id of the div containing the lag info. */ var LAG_ELEM_CLS = Bar.constants.lag = 'cryptpad-lag'; /** The toolbar class which contains the user list, debug link and lag. */ var TOOLBAR_CLS = Bar.constants.toolbar = 'cryptpad-toolbar'; var TOP_CLS = Bar.constants.top = 'cryptpad-toolbar-top'; var LEFTSIDE_CLS = Bar.constants.leftside = 'cryptpad-toolbar-leftside'; var RIGHTSIDE_CLS = Bar.constants.rightside = 'cryptpad-toolbar-rightside'; var SPINNER_CLS = Bar.constants.spinner = 'cryptpad-spinner'; var STATE_CLS = Bar.constants.state = 'cryptpad-state'; var USERNAME_CLS = Bar.constants.username = 'cryptpad-toolbar-username'; var READONLY_CLS = Bar.constants.readonly = 'cryptpad-readonly'; var USERBUTTONS_CONTAINER_CLS = Bar.constants.userButtonsContainer = "cryptpad-userbuttons-container"; var USERLIST_CLS = Bar.constants.userlist = "cryptpad-dropdown-users"; var EDITSHARE_CLS = Bar.constants.editShare = "cryptpad-dropdown-editShare"; 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_CLS = Bar.constants.dropdown = "cryptpad-dropdown"; var TITLE_CLS = Bar.constants.title = "cryptpad-title"; var USER_CLS = Bar.constants.userAdmin = "cryptpad-user"; var USERBUTTON_CLS = Bar.constants.changeUsername = "cryptpad-change-username"; var SPINNER_DISAPPEAR_TIME = 3000; var uid = function () { return 'cryptpad-uid-' + String(Math.random()).substring(2); }; var $style; var connected = false; var firstConnection = true; var lagErrors = 0; var styleToolbar = function ($container, href, version) { href = href || '/customize/toolbar.css' + (version?('?' + version): ''); $.ajax({ url: href, dataType: 'text', success: function (data) { $container.append($('