Burocratas, emailconfirmed, Administradores da interface, Administradores (Semantic MediaWiki), Curadores (Semantic MediaWiki), Editores (Semantic MediaWiki), Supressores, Administradores
1 056
edições
(Criou página com '// from: https://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript // To be used in Template:CardCatalog and other places as well functi...') |
Sem resumo de edição |
||
// To be used in Template:CardCatalog and other places as well
function
if (isNaN(num)) return NaN;
const digits = String(+num).split(""),
key = [▼
"
"
"
"
"
"
"
"
"
"CM",
"
"
"
"
"
"
"
"
"
"XC",
"
"
"
"
"
"
"
"
"
let
while (i--) roman = (key[+digits.pop() + i * 10] || "") + roman;▼
}▼
}
const incrementElemsNumeral = document.querySelectorAll(
".increment-numeralpha-numeral"
);
for (let [i, element] of incrementElemsNumeral.entries()) {
element.innerHTML = `${++i}. ${element.innerHTML}`;
}
const incrementElemsRoman = document.querySelectorAll(
".increment-numeralpha-roman"
);
for (let [i, element] of incrementElemsRoman.entries()) {▼
element.innerHTML = `${romanize(++i)}. ${element.innerHTML}`;▼
}
▲}
if (document.readyState === "complete" || document.readyState !== "loading") {
▲for (let [i, element] of incrementElemsRoman.entries()) {
mainFunc();
▲ element.innerHTML = `${romanize(++i)}. ${element.innerHTML}`;
} else {
document.addEventListener("DOMContentLoaded", mainFunc);
}
|