Convert coffee files to JS

This commit is contained in:
Blade Barringer
2015-11-11 20:32:00 -06:00
parent 92a8c3d958
commit 774a42d67e
8 changed files with 9923 additions and 1942 deletions

View File

@@ -1,4 +1,4 @@
module.exports = require('./script/index.coffee');
module.exports = require('./script/index');
var _ = require('lodash');
var moment = require('moment');

View File

@@ -1,6 +1,5 @@
'use strict';
require('coffee-script');
var t = require('./translation.js');
var NUMBER_OF_QUESTIONS = 12;

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
'use strict';
require('coffee-script');
var i18n = require('../i18n.coffee');
var i18n = require('../i18n');
var t = function(string, vars) {
var func = function(lang) {

View File

@@ -1,8 +1,7 @@
'use strict';
require('coffee-script');
var _ = require('lodash');
var content = require('./content/index.coffee');
var content = require('./content/index');
var DROP_ANIMALS = _.keys(content.pets);

51
common/script/i18n.js Normal file
View File

@@ -0,0 +1,51 @@
var _;
_ = require('lodash');
module.exports = {
strings: null,
translations: {},
t: function(stringName) {
var clonedVars, e, locale, string, stringNotFound, vars;
vars = arguments[1];
if (_.isString(arguments[1])) {
vars = null;
locale = arguments[1];
} else if (arguments[2] != null) {
vars = arguments[1];
locale = arguments[2];
}
if ((locale == null) || (!module.exports.strings && !module.exports.translations[locale])) {
locale = 'en';
}
if (module.exports.strings) {
string = module.exports.strings[stringName];
} else {
string = module.exports.translations[locale] && module.exports.translations[locale][stringName];
}
clonedVars = _.clone(vars) || {};
clonedVars.locale = locale;
if (string) {
try {
return _.template(string, clonedVars);
} catch (_error) {
e = _error;
return 'Error processing the string. Please see Help > Report a Bug.';
}
} else {
if (module.exports.strings) {
stringNotFound = module.exports.strings.stringNotFound;
} else if (module.exports.translations[locale]) {
stringNotFound = module.exports.translations[locale] && module.exports.translations[locale].stringNotFound;
}
try {
return _.template(stringNotFound, {
string: stringName
});
} catch (_error) {
e = _error;
return 'Error processing the string. Please see Help > Report a Bug.';
}
}
}
};

File diff suppressed because it is too large Load Diff

2864
common/script/index.js Normal file

File diff suppressed because it is too large Load Diff