Improve drive loading speed

This commit is contained in:
yflory
2017-11-21 11:09:59 +01:00
parent 06ede6b294
commit 7f88d1d43a
5 changed files with 52 additions and 67 deletions

View File

@@ -1,8 +1,9 @@
define([
'/common/common-util.js',
'/customize/messages.js',
'/bower_components/chainpad-crypto/crypto.js',
'/bower_components/tweetnacl/nacl-fast.min.js'
], function (Util, Crypto) {
], function (Util, Messages, Crypto) {
var Nacl = window.nacl;
var Hash = {};
@@ -361,5 +362,19 @@ Version 1
'/' + curvePublic.replace(/\//g, '-') + '/';
};
// Create untitled documents when no name is given
var getLocaleDate = function () {
if (window.Intl && window.Intl.DateTimeFormat) {
var options = {weekday: "short", year: "numeric", month: "long", day: "numeric"};
return new window.Intl.DateTimeFormat(undefined, options).format(new Date());
}
return new Date().toString().split(' ').slice(0,4).join(' ');
};
Hash.getDefaultName = function (parsed) {
var type = parsed.type;
var name = (Messages.type)[type] + ' - ' + getLocaleDate();
return name;
};
return Hash;
});