Skip to content

Commit a7a26a2

Browse files
committed
Common classes patch.
1 parent a13f1e8 commit a7a26a2

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

assets/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# License: GNU/GPLv2
88
# @see LICENSE.txt
99
#
10-
# This file: Configuration defaults file (last modified: 2024.04.30).
10+
# This file: Configuration defaults file (last modified: 2024.06.26).
1111
##/
1212

1313
frontend:
@@ -26,7 +26,7 @@ frontend:
2626
Arabic-2: "١٬٢٣٤٬٥٦٧٫٨٩"
2727
Arabic-3: "۱٬۲۳۴٬۵۶۷٫۸۹"
2828
Arabic-4: "۱۲٬۳۴٬۵۶۷٫۸۹"
29-
Armenian: "Ռ̅Մ̅Լ̅ՏՇԿԷ"
29+
Armenian: "Ճ̅Ի̅Գ̅ՏՇԿԷ"
3030
Base-12: "4b6547.a8"
3131
Base-16: "12d687.e3"
3232
Bengali-1: "১২,৩৪,৫৬৭.৮৯"
@@ -37,6 +37,7 @@ frontend:
3737
Chinese-Traditional: "一百二十三萬四千五百六十七點八九"
3838
Chinese-Traditional-Financial: "壹佰貳拾叄萬肆仟伍佰陸拾柒點捌玖"
3939
Fullwidth: "1234567.89"
40+
Geez: "፻፳፫፼፵፭፻፷፯"
4041
Hebrew: "א׳׳ב׳קג׳יד׳ךסז"
4142
India-1: "12,34,567.89"
4243
India-2: "१२,३४,५६७.८९"

assets/numberJs.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,20 @@ function nft(Number, Decimals = 0) {
4646
} else {
4747
WholeLen = Number.length;
4848
}
49-
let ThouPos = GroupOffset;
50-
for (let Unit = 0, Pos = WholeLen - 1; Pos > -1; Pos--, Unit++) {
49+
for (let OddEven = 'o', Unit = 0, Pos = WholeLen - 1, ThouPos = GroupOffset; Pos > -1; Pos--, Unit++, OddEven = OddEven === 'o' ? 'e' : 'o') {
5150
if (ThouPos >= GroupSize) {
5251
ThouPos = 1;
5352
Formatted = GroupSeparator + Formatted;
5453
} else {
5554
ThouPos++;
5655
}
56+
if (Unit === 0) {
57+
var Myriads = false;
58+
var Hundreds = false;
59+
} else {
60+
var Myriads = (Unit %% 4) === 0;
61+
var Hundreds = Myriads === false && (Unit %% 2) === 0;
62+
}
5763
var Key = Number.substring(Pos, Pos + 1);
5864
var Double = (Pos > 0) ? Number.substring(Pos - 1, Pos) + Key : '';
5965
let Power = '';
@@ -65,9 +71,17 @@ function nft(Number, Decimals = 0) {
6571
} else if (typeof ConversionSet['+' + Key] != 'undefined') {
6672
Digit = ConversionSet['+' + Key];
6773
} else {
68-
Digit = (typeof ConversionSet[Key] != 'undefined') ? ConversionSet[Key] : Key;
69-
if (typeof ConversionSet['^' + Unit + '*' + Key] != 'undefined') {
70-
Power = ConversionSet['^' + Unit + '*' + Key];
74+
Digit = (typeof ConversionSet[OddEven + Key] != 'undefined') ? ConversionSet[OddEven + Key] : (typeof ConversionSet[Key] != 'undefined') ? ConversionSet[Key] : Key;
75+
if (Myriads === true && (typeof ConversionSet['Myriads'] != 'undefined')) {
76+
Power = ConversionSet['Myriads'];
77+
if (typeof ConversionSet['Myriads+' + Key] != 'undefined') {
78+
Digit = ConversionSet['Myriads+' + Key];
79+
}
80+
} else if (Hundreds === true && (typeof ConversionSet['Hundreds'] != 'undefined')) {
81+
Power = ConversionSet['Hundreds'];
82+
if (typeof ConversionSet['Hundreds+' + Key] != 'undefined') {
83+
Digit = ConversionSet['Hundreds+' + Key];
84+
}
7185
} else if (typeof ConversionSet['^' + Unit] != 'undefined') {
7286
Power = ConversionSet['^' + Unit];
7387
}
@@ -90,9 +104,7 @@ function nft(Number, Decimals = 0) {
90104
} else {
91105
Digit = (typeof ConversionSet[Key] != 'undefined') ? ConversionSet[Key] : Key;
92106
}
93-
if (typeof ConversionSet['^-' + Pos + '*' + Key] != 'undefined') {
94-
Power = ConversionSet['^-' + Pos + '*' + Key];
95-
} else if (typeof ConversionSet['^-' + Pos] != 'undefined') {
107+
if (typeof ConversionSet['^-' + Pos] != 'undefined') {
96108
Power = ConversionSet['^-' + Pos];
97109
}
98110
}

0 commit comments

Comments
 (0)