Skip to content

Commit

Permalink
Common classes patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Jun 26, 2024
1 parent a13f1e8 commit a7a26a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
5 changes: 3 additions & 2 deletions assets/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# License: GNU/GPLv2
# @see LICENSE.txt
#
# This file: Configuration defaults file (last modified: 2024.04.30).
# This file: Configuration defaults file (last modified: 2024.06.26).
##/

frontend:
Expand All @@ -26,7 +26,7 @@ frontend:
Arabic-2: "١٬٢٣٤٬٥٦٧٫٨٩"
Arabic-3: "۱٬۲۳۴٬۵۶۷٫۸۹"
Arabic-4: "۱۲٬۳۴٬۵۶۷٫۸۹"
Armenian: "Ռ̅Մ̅Լ̅ՏՇԿԷ"
Armenian: "Ճ̅Ի̅Գ̅ՏՇԿԷ"
Base-12: "4b6547.a8"
Base-16: "12d687.e3"
Bengali-1: "১২,৩৪,৫৬৭.৮৯"
Expand All @@ -37,6 +37,7 @@ frontend:
Chinese-Traditional: "一百二十三萬四千五百六十七點八九"
Chinese-Traditional-Financial: "壹佰貳拾叄萬肆仟伍佰陸拾柒點捌玖"
Fullwidth: "1234567.89"
Geez: "፻፳፫፼፵፭፻፷፯"
Hebrew: "א׳׳ב׳קג׳יד׳ךסז"
India-1: "12,34,567.89"
India-2: "१२,३४,५६७.८९"
Expand Down
28 changes: 20 additions & 8 deletions assets/numberJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,20 @@ function nft(Number, Decimals = 0) {
} else {
WholeLen = Number.length;
}
let ThouPos = GroupOffset;
for (let Unit = 0, Pos = WholeLen - 1; Pos > -1; Pos--, Unit++) {
for (let OddEven = 'o', Unit = 0, Pos = WholeLen - 1, ThouPos = GroupOffset; Pos > -1; Pos--, Unit++, OddEven = OddEven === 'o' ? 'e' : 'o') {
if (ThouPos >= GroupSize) {
ThouPos = 1;
Formatted = GroupSeparator + Formatted;
} else {
ThouPos++;
}
if (Unit === 0) {
var Myriads = false;
var Hundreds = false;
} else {
var Myriads = (Unit %% 4) === 0;
var Hundreds = Myriads === false && (Unit %% 2) === 0;
}
var Key = Number.substring(Pos, Pos + 1);
var Double = (Pos > 0) ? Number.substring(Pos - 1, Pos) + Key : '';
let Power = '';
Expand All @@ -65,9 +71,17 @@ function nft(Number, Decimals = 0) {
} else if (typeof ConversionSet['+' + Key] != 'undefined') {
Digit = ConversionSet['+' + Key];
} else {
Digit = (typeof ConversionSet[Key] != 'undefined') ? ConversionSet[Key] : Key;
if (typeof ConversionSet['^' + Unit + '*' + Key] != 'undefined') {
Power = ConversionSet['^' + Unit + '*' + Key];
Digit = (typeof ConversionSet[OddEven + Key] != 'undefined') ? ConversionSet[OddEven + Key] : (typeof ConversionSet[Key] != 'undefined') ? ConversionSet[Key] : Key;
if (Myriads === true && (typeof ConversionSet['Myriads'] != 'undefined')) {
Power = ConversionSet['Myriads'];
if (typeof ConversionSet['Myriads+' + Key] != 'undefined') {
Digit = ConversionSet['Myriads+' + Key];
}
} else if (Hundreds === true && (typeof ConversionSet['Hundreds'] != 'undefined')) {
Power = ConversionSet['Hundreds'];
if (typeof ConversionSet['Hundreds+' + Key] != 'undefined') {
Digit = ConversionSet['Hundreds+' + Key];
}
} else if (typeof ConversionSet['^' + Unit] != 'undefined') {
Power = ConversionSet['^' + Unit];
}
Expand All @@ -90,9 +104,7 @@ function nft(Number, Decimals = 0) {
} else {
Digit = (typeof ConversionSet[Key] != 'undefined') ? ConversionSet[Key] : Key;
}
if (typeof ConversionSet['^-' + Pos + '*' + Key] != 'undefined') {
Power = ConversionSet['^-' + Pos + '*' + Key];
} else if (typeof ConversionSet['^-' + Pos] != 'undefined') {
if (typeof ConversionSet['^-' + Pos] != 'undefined') {
Power = ConversionSet['^-' + Pos];
}
}
Expand Down

0 comments on commit a7a26a2

Please sign in to comment.