refactoring

This commit is contained in:
Maxim Devaev 2022-04-25 15:55:07 +03:00
parent 293490298c
commit 61cdf10a83

View File

@ -187,9 +187,12 @@ export function Session() {
if (throttling !== null) {
let pairs = [];
for (let field of Object.keys(throttling.parsed_flags).sort()) {
let flags = throttling.parsed_flags[field];
pairs.push([
tools.upperFirst(field).replace("_", " "),
__formatThrottleError(throttling.parsed_flags[field]),
(flags["now"] ? __colored("red", "RIGHT NOW") : __colored("green", "No"))
+ " " +
(flags["past"] ? __colored("red", "In the past") : __colored("green", "Never")),
]);
}
return __formatUl(pairs);
@ -198,13 +201,6 @@ export function Session() {
}
};
var __formatThrottleError = function(flags) {
return `
${flags["now"] ? __colored("red", "RIGHT NOW") : __colored("green", "No")};
${flags["past"] ? __colored("red", "In the past") : __colored("green", "Never")}
`;
};
var __colored = function(color, text) {
return `<font color="${color}">${text}</font>`;
};