Newer
Older
var i18n = require('./i18n'),
und = require('underscore');
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* Module for managing all the known static assets in browserid.
* In filenames/paths below, you may use ``:locale`` as a url
* variable to be expanded later.
*
* These settings affect usage of cachify and eventually our
* asset build steps.
*
* Be careful editing common_js, as it will affect all
* minified scripts that depend on that variable. IE re-ordering
* the list or removing a script.
*/
// Common to browserid.js dialog.js
var common_js = [
'/lib/jquery-1.7.1.min.js',
'/lib/winchan.js',
'/lib/underscore-min.js',
'/lib/vepbundle.js',
'/lib/ejs.js',
'/shared/javascript-extensions.js',
'/i18n/:locale/client.json',
'/shared/gettext.js',
'/shared/browserid.js',
'/lib/hub.js',
'/lib/dom-jquery.js',
'/lib/module.js',
'/lib/jschannel.js',
'/shared/templates.js',
'/shared/renderer.js',
'/shared/class.js',
'/shared/mediator.js',
'/shared/tooltip.js',
'/shared/validation.js',
'/shared/helpers.js',
'/shared/screens.js',
'/shared/browser-support.js',
'/shared/wait-messages.js',
'/shared/error-messages.js',
'/shared/error-display.js',
'/shared/storage.js',
'/shared/xhr.js',
'/shared/network.js',
'/shared/provisioning.js',
'/shared/user.js',
'/shared/modules/page_module.js',
'/shared/modules/xhr_delay.js',
'/shared/modules/xhr_disable_form.js',
'/shared/modules/cookie_check.js'
];
var browserid_min_js = '/production/:locale/browserid.js';
var browserid_js = und.flatten([
common_js,
[
'/pages/page_helpers.js',
'/pages/index.js',
'/pages/start.js',
'/pages/add_email_address.js',
'/pages/verify_email_address.js',
'/pages/forgot.js',
'/pages/manage_account.js',
'/pages/signin.js',
'/pages/signup.js'
]
]);
var dialog_min_js = '/production/:locale/dialog.js';
var dialog_js = und.flatten([
common_js,
[
Lloyd Hilaiel
committed
'/lib/urlparse.js',
'/shared/command.js',
'/shared/history.js',
'/shared/state_machine.js',
'/dialog/resources/internal_api.js',
'/dialog/resources/helpers.js',
'/dialog/resources/state.js',
'/dialog/controllers/actions.js',
'/dialog/controllers/dialog.js',
'/dialog/controllers/authenticate.js',
'/dialog/controllers/forgot_password.js',
'/dialog/controllers/check_registration.js',
'/dialog/controllers/pick_email.js',
'/dialog/controllers/add_email.js',
'/dialog/controllers/required_email.js',
'/dialog/controllers/verify_primary_user.js',
'/dialog/controllers/provision_primary_user.js',
'/dialog/controllers/primary_user_provisioned.js',
'/dialog/controllers/email_chosen.js',
'/dialog/start.js'
]]);
exports.resources = resources = {
'/production/dialog.css': [
'/css/common.css',
'/dialog/css/popup.css',
'/dialog/css/m.css'
],
'/production/browserid.css': [
'/css/common.css',
'/css/style.css',
'/css/m.css'
resources[dialog_min_js] = dialog_js;
resources[browserid_min_js] = browserid_js;
var replace = function(path, locale) { return path.replace(':locale', locale); };
/**
* Returns all filenames of static resources
* in a connect-cachify compatible format.
*
* @langs - array of languages we support
* @return { minified_file: [dependent, files] }
*
* Languages will be converted to locales. Filenames and list of files
* will be expanded to match all the permutations.
*/
exports.all = function(langs) {
var res = {};
for (var f in resources) {
langs.forEach(function (lang) {
var l = i18n.localeFrom(lang);
res[replace(f, l)] = getResources(f, l);
});
}
return res;
/**
* Get all resource urls for a specified resource based on the locale
*/
exports.getResources = getResources = function(path, locale) {
var res = [];
if (resources[path]) {
resources[path].forEach(function(r) {
res.push(replace(r, locale));
});
}
return res;
};