BoL : V12 support only

This commit is contained in:
2024-08-13 10:37:56 +02:00
parent 165a18e897
commit 321052fd33
147 changed files with 424 additions and 325 deletions

View File

@ -79,7 +79,7 @@ export const registerHandlebarsHelpers = function () {
Handlebars.registerHelper('countKeys', function (obj) {
return Object.keys(obj).length;
})
Handlebars.registerHelper('isEnabled', function (configKey) {
return game.settings.get("bol", configKey);
})
@ -108,10 +108,10 @@ export const registerHandlebarsHelpers = function () {
return parseInt(a) - parseInt(b);
})
Handlebars.registerHelper('abbrev2', function (a) {
return a.substring(0,2);
return a.substring(0, 2);
})
Handlebars.registerHelper('abbrev3', function (a) {
return a.substring(0,3);
return a.substring(0, 3);
})
Handlebars.registerHelper('valueAtIndex', function (arr, idx) {
return arr[idx];
@ -141,5 +141,12 @@ export const registerHandlebarsHelpers = function () {
return key == "creature" || key == "daemon";
})
// Handle v12 removal of this helper
Handlebars.registerHelper('select', function (selected, options) {
const escapedValue = RegExp.escape(Handlebars.escapeExpression(selected));
const rgx = new RegExp(' value=[\"\']' + escapedValue + '[\"\']');
const html = options.fn(this);
return html.replace(rgx, "$& selected");
});
}