You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
599 B
20 lines
599 B
// @ts-check
|
|
import { formatNumber } from "./common.js";
|
|
import { registerElementAnnotatedBy } from "./userProfile.js";
|
|
|
|
const KC_NUMBER_UNFORMAT = 'kcNumberUnFormat';
|
|
|
|
registerElementAnnotatedBy({
|
|
name: KC_NUMBER_UNFORMAT,
|
|
onAdd(element) {
|
|
for (let form of document.forms) {
|
|
form.addEventListener('submit', (event) => {
|
|
const rawFormat = element.getAttribute(`data-${KC_NUMBER_UNFORMAT}`);
|
|
if (rawFormat) {
|
|
element.value = formatNumber(element.value, rawFormat);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
});
|