danoniplus 40.3.0 → 40.4.0
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 +104 -46
- package/js/lib/danoni_constants.js +15 -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/12
|
|
8
8
|
*
|
|
9
9
|
* https://github.com/cwtickle/danoniplus
|
|
10
10
|
*/
|
|
11
|
-
const g_version = `Ver 40.
|
|
12
|
-
const g_revisedDate = `2025/03/
|
|
11
|
+
const g_version = `Ver 40.4.0`;
|
|
12
|
+
const g_revisedDate = `2025/03/12`;
|
|
13
13
|
|
|
14
14
|
// カスタム用バージョン (danoni_custom.js 等で指定可)
|
|
15
15
|
let g_localVersion = ``;
|
|
@@ -58,6 +58,7 @@ Object.freeze(g_reservedDomains);
|
|
|
58
58
|
// 外部参照を許可するドメイン
|
|
59
59
|
const g_referenceDomains = [
|
|
60
60
|
`cwtickle.github.io/danoniplus`,
|
|
61
|
+
`cdn.jsdelivr.net/npm`,
|
|
61
62
|
`support-v\\d+--danoniplus.netlify.app`,
|
|
62
63
|
];
|
|
63
64
|
Object.freeze(g_referenceDomains);
|
|
@@ -499,11 +500,11 @@ const viewKeyStorage = (_name, _key = ``, _colorFmt = true) => {
|
|
|
499
500
|
* @param {Number} _indent
|
|
500
501
|
* @param {boolean} [colorFmt=true] フォーマット加工フラグ
|
|
501
502
|
* @param {string} [rootKey=''] オブジェクトの最上位プロパティ名
|
|
502
|
-
* @param {Object} [_parent=null]
|
|
503
503
|
* @returns {string}
|
|
504
504
|
*/
|
|
505
505
|
const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {}) => {
|
|
506
|
-
|
|
506
|
+
const isObj = _obj => typeof _obj === C_TYP_OBJECT && _obj !== null;
|
|
507
|
+
if (!isObj(_obj)) {
|
|
507
508
|
return JSON.stringify(_obj);
|
|
508
509
|
}
|
|
509
510
|
const baseIndent = getIndent(_indent);
|
|
@@ -542,53 +543,101 @@ const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {})
|
|
|
542
543
|
// keyCtrlXの対応キー表示処理
|
|
543
544
|
return (g_kCd[_value] && _value !== 0) ? `${_value}|<span style="color:#ffff66">${g_kCd[_value]}</span>` : `----`;
|
|
544
545
|
}
|
|
545
|
-
} else if (
|
|
546
|
+
} else if (isObj(_value)) {
|
|
546
547
|
return formatObject(_value, _indent + 1, { colorFmt, rootKey: _rootKey });
|
|
547
548
|
}
|
|
548
549
|
}
|
|
549
550
|
return JSON.stringify(_value);
|
|
550
551
|
};
|
|
551
552
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
553
|
+
/**
|
|
554
|
+
* 配列の装飾処理
|
|
555
|
+
* @param {number[]|string[]} _obj
|
|
556
|
+
* @returns {string}
|
|
557
|
+
*/
|
|
558
|
+
const formatArrayValue = (_obj) => {
|
|
559
|
+
|
|
560
|
+
const formatSetArray = (_list, _numOfSet = 2) => {
|
|
561
|
+
if (_list.findIndex(val => val === rootKey) >= 0) {
|
|
562
|
+
let result = `[`;
|
|
563
|
+
for (let j = 0; j < _obj.length; j += _numOfSet) {
|
|
564
|
+
result += `<br>${nestedIndent}${_obj[j]}: ${_obj[j + 1]}`;
|
|
565
|
+
for (let k = 0; k < _numOfSet - 2; k++) {
|
|
566
|
+
const idx = j + k + 2;
|
|
567
|
+
if (idx < _obj.length) {
|
|
568
|
+
result += `, ${formatValue(_obj[idx], rootKey)}`;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
result += (_obj.length === 0 ? `` : `<br>${baseIndent}`) + `]`;
|
|
573
|
+
return result;
|
|
574
|
+
}
|
|
575
|
+
return ``;
|
|
576
|
+
};
|
|
577
|
+
if (colorFmt) {
|
|
578
|
+
if (typeof _obj[0] === C_TYP_NUMBER) {
|
|
579
|
+
let result;
|
|
580
|
+
Object.keys(g_dataSetObj).forEach(key =>
|
|
581
|
+
result ||= formatSetArray(g_dataSetObj[key], Number(key)));
|
|
582
|
+
if (result !== ``) {
|
|
583
|
+
return result;
|
|
561
584
|
}
|
|
585
|
+
}
|
|
586
|
+
if (_obj.length > 100) {
|
|
587
|
+
const filteredArray = _obj.reduce((result, value, index) => {
|
|
588
|
+
if (hasVal(value)) {
|
|
589
|
+
result.push(`${index}: ${formatValue(value, rootKey)}`);
|
|
590
|
+
}
|
|
591
|
+
return result;
|
|
592
|
+
}, []);
|
|
593
|
+
return `[<br>${nestedIndent}${filteredArray.join(`,<br>${nestedIndent}`)}<br>${baseIndent}]`;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return ``;
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* 配列・オブジェクトのネスト整形処理
|
|
601
|
+
* @returns {string}
|
|
602
|
+
*/
|
|
603
|
+
const formatCollection = () => {
|
|
604
|
+
const isArray = Array.isArray(_obj);
|
|
605
|
+
const isArrayOfArrays = isArray && _obj.every(item => Array.isArray(item));
|
|
606
|
+
const getNextObject = (_item, _rootKey) => isObj(_item)
|
|
607
|
+
? formatObject(_item, _indent + 1, { colorFmt, rootKey: _rootKey })
|
|
608
|
+
: formatValue(_item, _rootKey);
|
|
609
|
+
|
|
610
|
+
if (isArray) {
|
|
611
|
+
let result = formatArrayValue(_obj);
|
|
612
|
+
if (result !== ``) {
|
|
562
613
|
return result;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
const
|
|
568
|
-
.map(
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
let result = `{${formattedEntries}<br>${baseIndent}}`;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// 配列またはオブジェクトの各要素をフォーマット
|
|
618
|
+
const formattedEntries = (isArray
|
|
619
|
+
? _obj.map(item => {
|
|
620
|
+
const formattedValue = isArrayOfArrays
|
|
621
|
+
? `<br>${nestedIndent}${formatValue(item, rootKey)}`
|
|
622
|
+
: getNextObject(item, rootKey);
|
|
623
|
+
return formattedValue;
|
|
624
|
+
})
|
|
625
|
+
: Object.entries(_obj).map(([key, value]) => {
|
|
626
|
+
const formattedValue = getNextObject(value, rootKey === `` ? key : rootKey);
|
|
627
|
+
return `<br>${nestedIndent}"${key}": ${formattedValue}`;
|
|
628
|
+
})).filter(val => !hasVal(val) || val !== `----`);
|
|
629
|
+
|
|
630
|
+
// 配列なら[]で囲む、オブジェクトなら{}で囲む
|
|
631
|
+
if (isArray) {
|
|
632
|
+
return _obj.length === 0
|
|
633
|
+
? '[]'
|
|
634
|
+
: `[${formattedEntries.join(', ')}${isArrayOfArrays ? `<br>${baseIndent}` : ''}]`;
|
|
635
|
+
} else {
|
|
636
|
+
return `{${formattedEntries.join(',')}<br>${baseIndent}}`;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
let result = formatCollection();
|
|
592
641
|
if (!colorFmt) {
|
|
593
642
|
result = result.replaceAll(`<br>`, `\r\n`).replaceAll(` `, ` `);
|
|
594
643
|
}
|
|
@@ -1038,7 +1087,7 @@ const loadMultipleFiles2 = async (_fileData, _loadType) => {
|
|
|
1038
1087
|
if (_loadType === `js`) {
|
|
1039
1088
|
await loadScript2(filePath, false);
|
|
1040
1089
|
} else if (_loadType === `css`) {
|
|
1041
|
-
const cssPath = filePath.split(`.js
|
|
1090
|
+
const cssPath = filePath.split(`.js?`).join(`.css?`);
|
|
1042
1091
|
await importCssFile2(cssPath);
|
|
1043
1092
|
}
|
|
1044
1093
|
}));
|
|
@@ -3086,7 +3135,16 @@ const preheaderConvert = _dosObj => {
|
|
|
3086
3135
|
|
|
3087
3136
|
// 外部スキンファイルの指定
|
|
3088
3137
|
const tmpSkinType = _dosObj.skinType ?? g_presetObj.skinType ?? `default`;
|
|
3089
|
-
const tmpSkinTypes = tmpSkinType.split(`,`)
|
|
3138
|
+
const tmpSkinTypes = tmpSkinType.split(`,`).map(file => {
|
|
3139
|
+
|
|
3140
|
+
// スキンタイプを取得(ディレクトリパス、カレント指定(..)を除去)
|
|
3141
|
+
const match = file.match(/.*\/(.+)|\(\.\.\)([^/]+)|(.+)/);
|
|
3142
|
+
const skinName = match[1] || match[2] || match[3];
|
|
3143
|
+
|
|
3144
|
+
// デフォルトセット以外はリモート先のデータを使用しない
|
|
3145
|
+
return g_defaultSkinSet.findIndex(val => val === skinName) < 0 ?
|
|
3146
|
+
convLocalPath(file, `skin`) : file;
|
|
3147
|
+
});
|
|
3090
3148
|
obj.defaultSkinFlg = tmpSkinTypes.includes(`default`) && setBoolVal(_dosObj.bgCanvasUse ?? g_presetObj.bgCanvasUse, true);
|
|
3091
3149
|
setJsFiles(tmpSkinTypes, C_DIR_SKIN, `skin`);
|
|
3092
3150
|
|
|
@@ -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/12 (v40.4.0)
|
|
9
9
|
*
|
|
10
10
|
* https://github.com/cwtickle/danoniplus
|
|
11
11
|
*/
|
|
@@ -3202,6 +3202,9 @@ const g_titleLists = {
|
|
|
3202
3202
|
|
|
3203
3203
|
};
|
|
3204
3204
|
|
|
3205
|
+
// デフォルトスキンセット(リモート取得対象)
|
|
3206
|
+
const g_defaultSkinSet = [`default`, `light`, `skyblue`];
|
|
3207
|
+
|
|
3205
3208
|
const g_animationData = [`back`, `mask`, `style`];
|
|
3206
3209
|
const g_animationFunc = {
|
|
3207
3210
|
make: {
|
|
@@ -3259,6 +3262,17 @@ const g_dataMinObj = {
|
|
|
3259
3262
|
style: 1,
|
|
3260
3263
|
};
|
|
3261
3264
|
|
|
3265
|
+
/**
|
|
3266
|
+
* データフォーマット管理用
|
|
3267
|
+
* - セット数: 対象の配列名の組で記述
|
|
3268
|
+
*/
|
|
3269
|
+
const g_dataSetObj = {
|
|
3270
|
+
2: [`speedData`, `boostData`],
|
|
3271
|
+
4: [`colorData`, `arrowCssMotionData`, `frzCssMotionData`,
|
|
3272
|
+
`dummyArrowCssMotionData`, `dummyFrzCssMotionData`],
|
|
3273
|
+
5: [`ncolorData`, `scrollchData`],
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3262
3276
|
const g_dfColorObj = {
|
|
3263
3277
|
|
|
3264
3278
|
// 矢印初期色情報
|