define([ 'jquery', '/common/toolbar3.js', '/bower_components/nthen/index.js', '/common/sframe-common.js', '/common/common-interface.js', '/common/common-ui-elements.js', '/common/common-util.js', '/common/common-hash.js', '/customize/messages.js', '/common/hyperscript.js', '/common/common-credential.js', '/customize/application_config.js', '/api/config', '/common/make-backup.js', '/common/common-feedback.js', '/common/jscolor.js', '/bower_components/file-saver/FileSaver.min.js', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/settings/app-settings.less', ], function ( $, Toolbar, nThen, SFCommon, UI, UIElements, Util, Hash, Messages, h, Cred, AppConfig, ApiConfig, Backup, Feedback ) { var saveAs = window.saveAs; var APP = window.APP = {}; var common; var metadataMgr; var privateData; var sframeChan; var categories = { 'account': [ 'cp-settings-own-drive', 'cp-settings-info-block', 'cp-settings-displayname', 'cp-settings-language-selector', 'cp-settings-resettips', 'cp-settings-change-password', 'cp-settings-delete' ], 'security': [ 'cp-settings-logout-everywhere', 'cp-settings-autostore', 'cp-settings-safe-links', 'cp-settings-userfeedback', ], 'drive': [ 'cp-settings-drive-duplicate', 'cp-settings-thumbnails', 'cp-settings-drive-backup', 'cp-settings-drive-import-local', 'cp-settings-trim-history' //'cp-settings-drive-reset' ], 'cursor': [ 'cp-settings-cursor-color', 'cp-settings-cursor-share', 'cp-settings-cursor-show', ], 'pad': [ 'cp-settings-pad-width', 'cp-settings-pad-spellcheck', ], 'code': [ 'cp-settings-code-indent-unit', 'cp-settings-code-indent-type', 'cp-settings-code-brackets', 'cp-settings-code-font-size', 'cp-settings-code-spellcheck', ], 'subscription': { onClick: function () { var urls = common.getMetadataMgr().getPrivateData().accounts; window.open(urls.upgradeURL); Feedback.send('SUBSCRIPTION_BUTTON'); } } }; if (AppConfig.disableFeedback) { var feedbackIdx = categories.account.indexOf('cp-settings-userfeedback'); categories.account.splice(feedbackIdx, 1); } if (AppConfig.disableProfile) { var displaynameIdx = categories.account.indexOf('cp-settings-displayname'); categories.account.splice(displaynameIdx, 1); } if (!ApiConfig.allowSubscriptions) { delete categories.subscription; } var create = {}; var SPECIAL_HINTS_HANDLER = { safeLinks: function () { return $('', {'class': 'cp-sidebarlayout-description'}) .html(Messages._getKey('settings_safeLinksHint', [''])); }, }; var DEFAULT_HINT_HANDLER = function (safeKey) { return $('', {'class': 'cp-sidebarlayout-description'}) .text(Messages['settings_'+safeKey+'Hint'] || 'Coming soon...'); }; var makeBlock = function (key, getter, full) { var safeKey = key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); create[key] = function () { var $div = $('
', {'class': 'cp-settings-' + key + ' cp-sidebarlayout-element'}); if (full) { $('