From 89e5830409541ace820953c3ffa310d355f1950c Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 28 Dec 2016 17:13:00 +0100 Subject: [PATCH] make alertify display time configurable --- customize.dist/application_config.js | 6 ++++++ www/common/cryptpad-common.js | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/customize.dist/application_config.js b/customize.dist/application_config.js index e4561df24..0e3f88f88 100644 --- a/customize.dist/application_config.js +++ b/customize.dist/application_config.js @@ -6,5 +6,11 @@ define(function() { */ config.availablePadTypes = ['pad', 'code', 'slide', 'poll']; + /* Cryptpad apps use a common API to display notifications to users + * by default, notifications are hidden after 5 seconds + * You can change their duration here (measured in milliseconds) + */ + config.notificationTimeout = 5000; + return config; }); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index f78535686..0e6e1311e 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -7,9 +7,10 @@ define([ '/bower_components/spin.js/spin.min.js', '/common/clipboard.js', '/customize/fsStore.js', + '/customize/application_config.js', '/bower_components/jquery/dist/jquery.min.js', -], function (Config, Messages, Store, Crypto, Alertify, Spinner, Clipboard, FS) { +], function (Config, Messages, Store, Crypto, Alertify, Spinner, Clipboard, FS, AppConfig) { /* This file exposes functionality which is specific to Cryptpad, but not to any particular pad type. This includes functions for committing metadata about pads to your local storage for future use and improved usability. @@ -26,6 +27,7 @@ define([ var common = window.Cryptpad = { Messages: Messages, + Alertify: Alertify, }; var store; var fsStore; @@ -91,14 +93,6 @@ define([ return hash; }; - Store.ready(function (err, Store) { - if (err) { - console.error(err); - return; - } - store = Store; - }); - // var isArray = function (o) { return Object.prototype.toString.call(o) === '[object Array]'; }; var isArray = common.isArray = $.isArray; @@ -1062,7 +1056,18 @@ define([ }; }; + // All code which is called implicitly is found below + Store.ready(function (err, Store) { + if (err) { + console.error(err); + return; + } + store = Store; + }); + Messages._applyTranslation(); + Alertify._$$alertify.delay = AppConfig.notificationTimeout || 5000; + return common; });