btclock_v3/data/src/js/helpers.js

20 lines
No EOL
729 B
JavaScript

//import "handlebars/dist/handlebars.js";
Handlebars.registerHelper('splitText', function (aString) {
if (aString.includes("/")) {
var c = aString.split("/").map((el) => { return "<div class=\"flex-items\">" + el + "</div>"; }).join('');
return "<div class=\"splitText\">" + c + "</div>";
}
if (aString.length > 1) {
return "<div class=\"mediumText\">" + aString + "</div>";
}
if (aString.length == 0 || aString === " ") {
aString = "&nbsp;&nbsp;";
}
//return aString;
return "<div class=\"digit\">" + aString + "</div>";
});
Handlebars.registerHelper('ifEquals', function(arg1, arg2, options) {
return (arg1 == arg2) ? options.fn(this) : options.inverse(this);
});