danoniplus 40.3.0 → 40.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/danoni_main.js +92 -44
- package/js/lib/danoni_constants.js +12 -1
- package/package.json +1 -1
package/js/danoni_main.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Source by tickle
|
|
6
6
|
* Created : 2018/10/08
|
|
7
|
-
* Revised : 2025/03/
|
|
7
|
+
* Revised : 2025/03/10
|
|
8
8
|
*
|
|
9
9
|
* https://github.com/cwtickle/danoniplus
|
|
10
10
|
*/
|
|
11
|
-
const g_version = `Ver 40.3.
|
|
12
|
-
const g_revisedDate = `2025/03/
|
|
11
|
+
const g_version = `Ver 40.3.1`;
|
|
12
|
+
const g_revisedDate = `2025/03/10`;
|
|
13
13
|
|
|
14
14
|
// カスタム用バージョン (danoni_custom.js 等で指定可)
|
|
15
15
|
let g_localVersion = ``;
|
|
@@ -499,11 +499,11 @@ const viewKeyStorage = (_name, _key = ``, _colorFmt = true) => {
|
|
|
499
499
|
* @param {Number} _indent
|
|
500
500
|
* @param {boolean} [colorFmt=true] フォーマット加工フラグ
|
|
501
501
|
* @param {string} [rootKey=''] オブジェクトの最上位プロパティ名
|
|
502
|
-
* @param {Object} [_parent=null]
|
|
503
502
|
* @returns {string}
|
|
504
503
|
*/
|
|
505
504
|
const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {}) => {
|
|
506
|
-
|
|
505
|
+
const isObj = _obj => typeof _obj === C_TYP_OBJECT && _obj !== null;
|
|
506
|
+
if (!isObj(_obj)) {
|
|
507
507
|
return JSON.stringify(_obj);
|
|
508
508
|
}
|
|
509
509
|
const baseIndent = getIndent(_indent);
|
|
@@ -542,53 +542,101 @@ const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {})
|
|
|
542
542
|
// keyCtrlXの対応キー表示処理
|
|
543
543
|
return (g_kCd[_value] && _value !== 0) ? `${_value}|<span style="color:#ffff66">${g_kCd[_value]}</span>` : `----`;
|
|
544
544
|
}
|
|
545
|
-
} else if (
|
|
545
|
+
} else if (isObj(_value)) {
|
|
546
546
|
return formatObject(_value, _indent + 1, { colorFmt, rootKey: _rootKey });
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
return JSON.stringify(_value);
|
|
550
550
|
};
|
|
551
551
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
552
|
+
/**
|
|
553
|
+
* 配列の装飾処理
|
|
554
|
+
* @param {number[]|string[]} _obj
|
|
555
|
+
* @returns {string}
|
|
556
|
+
*/
|
|
557
|
+
const formatArrayValue = (_obj) => {
|
|
558
|
+
|
|
559
|
+
const formatSetArray = (_list, _numOfSet = 2) => {
|
|
560
|
+
if (_list.findIndex(val => val === rootKey) >= 0) {
|
|
561
|
+
let result = `[`;
|
|
562
|
+
for (let j = 0; j < _obj.length; j += _numOfSet) {
|
|
563
|
+
result += `<br>${nestedIndent}${_obj[j]}: ${_obj[j + 1]}`;
|
|
564
|
+
for (let k = 0; k < _numOfSet - 2; k++) {
|
|
565
|
+
const idx = j + k + 2;
|
|
566
|
+
if (idx < _obj.length) {
|
|
567
|
+
result += `, ${formatValue(_obj[idx], rootKey)}`;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
561
570
|
}
|
|
571
|
+
result += (_obj.length === 0 ? `` : `<br>${baseIndent}`) + `]`;
|
|
562
572
|
return result;
|
|
563
|
-
}
|
|
564
|
-
return
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
573
|
+
}
|
|
574
|
+
return ``;
|
|
575
|
+
};
|
|
576
|
+
if (colorFmt) {
|
|
577
|
+
if (typeof _obj[0] === C_TYP_NUMBER) {
|
|
578
|
+
let result;
|
|
579
|
+
Object.keys(g_dataSetObj).forEach(key =>
|
|
580
|
+
result ||= formatSetArray(g_dataSetObj[key], Number(key)));
|
|
581
|
+
if (result !== ``) {
|
|
582
|
+
return result;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (_obj.length > 100) {
|
|
586
|
+
const filteredArray = _obj.reduce((result, value, index) => {
|
|
587
|
+
if (hasVal(value)) {
|
|
588
|
+
result.push(`${index}: ${formatValue(value, rootKey)}`);
|
|
589
|
+
}
|
|
590
|
+
return result;
|
|
591
|
+
}, []);
|
|
592
|
+
return `[<br>${nestedIndent}${filteredArray.join(`,<br>${nestedIndent}`)}<br>${baseIndent}]`;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return ``;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* 配列・オブジェクトのネスト整形処理
|
|
600
|
+
* @returns {string}
|
|
601
|
+
*/
|
|
602
|
+
const formatCollection = () => {
|
|
603
|
+
const isArray = Array.isArray(_obj);
|
|
604
|
+
const isArrayOfArrays = isArray && _obj.every(item => Array.isArray(item));
|
|
605
|
+
const getNextObject = (_item, _rootKey) => isObj(_item)
|
|
606
|
+
? formatObject(_item, _indent + 1, { colorFmt, rootKey: _rootKey })
|
|
607
|
+
: formatValue(_item, _rootKey);
|
|
608
|
+
|
|
609
|
+
if (isArray) {
|
|
610
|
+
let result = formatArrayValue(_obj);
|
|
611
|
+
if (result !== ``) {
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// 配列またはオブジェクトの各要素をフォーマット
|
|
617
|
+
const formattedEntries = (isArray
|
|
618
|
+
? _obj.map(item => {
|
|
619
|
+
const formattedValue = isArrayOfArrays
|
|
620
|
+
? `<br>${nestedIndent}${formatValue(item, rootKey)}`
|
|
621
|
+
: getNextObject(item, rootKey);
|
|
622
|
+
return formattedValue;
|
|
623
|
+
})
|
|
624
|
+
: Object.entries(_obj).map(([key, value]) => {
|
|
625
|
+
const formattedValue = getNextObject(value, rootKey === `` ? key : rootKey);
|
|
626
|
+
return `<br>${nestedIndent}"${key}": ${formattedValue}`;
|
|
627
|
+
})).filter(val => !hasVal(val) || val !== `----`);
|
|
628
|
+
|
|
629
|
+
// 配列なら[]で囲む、オブジェクトなら{}で囲む
|
|
630
|
+
if (isArray) {
|
|
631
|
+
return _obj.length === 0
|
|
632
|
+
? '[]'
|
|
633
|
+
: `[${formattedEntries.join(', ')}${isArrayOfArrays ? `<br>${baseIndent}` : ''}]`;
|
|
634
|
+
} else {
|
|
635
|
+
return `{${formattedEntries.join(',')}<br>${baseIndent}}`;
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
let result = formatCollection();
|
|
592
640
|
if (!colorFmt) {
|
|
593
641
|
result = result.replaceAll(`<br>`, `\r\n`).replaceAll(` `, ` `);
|
|
594
642
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Source by tickle
|
|
7
7
|
* Created : 2019/11/19
|
|
8
|
-
* Revised : 2025/03/
|
|
8
|
+
* Revised : 2025/03/10 (v40.3.1)
|
|
9
9
|
*
|
|
10
10
|
* https://github.com/cwtickle/danoniplus
|
|
11
11
|
*/
|
|
@@ -3259,6 +3259,17 @@ const g_dataMinObj = {
|
|
|
3259
3259
|
style: 1,
|
|
3260
3260
|
};
|
|
3261
3261
|
|
|
3262
|
+
/**
|
|
3263
|
+
* データフォーマット管理用
|
|
3264
|
+
* - セット数: 対象の配列名の組で記述
|
|
3265
|
+
*/
|
|
3266
|
+
const g_dataSetObj = {
|
|
3267
|
+
2: [`speedData`, `boostData`],
|
|
3268
|
+
4: [`colorData`, `arrowCssMotionData`, `frzCssMotionData`,
|
|
3269
|
+
`dummyArrowCssMotionData`, `dummyFrzCssMotionData`],
|
|
3270
|
+
5: [`ncolorData`, `scrollchData`],
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3262
3273
|
const g_dfColorObj = {
|
|
3263
3274
|
|
|
3264
3275
|
// 矢印初期色情報
|