danoniplus 40.5.3 → 40.6.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 CHANGED
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Source by tickle
6
6
  * Created : 2018/10/08
7
- * Revised : 2025/03/13
7
+ * Revised : 2025/03/16
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 40.5.3`;
12
- const g_revisedDate = `2025/03/13`;
11
+ const g_version = `Ver 40.6.0`;
12
+ const g_revisedDate = `2025/03/16`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -58,14 +58,16 @@ Object.freeze(g_reservedDomains);
58
58
  // 外部参照を許可するドメイン
59
59
  const g_referenceDomains = [
60
60
  `cwtickle.github.io/danoniplus`,
61
- `cdn.jsdelivr.net/npm`,
61
+ `cdn.jsdelivr.net`,
62
+ `unpkg.com`,
62
63
  `support-v\\d+--danoniplus.netlify.app`,
63
64
  ];
64
65
  Object.freeze(g_referenceDomains);
65
66
 
66
67
  const g_rootPath = current().match(/(^.*\/)/)[0];
67
68
  const g_workPath = new URL(location.href).href.match(/(^.*\/)/)[0];
68
- const g_remoteFlg = g_referenceDomains.some(domain => g_rootPath.match(`^https://${domain}/`) !== null);
69
+ const hasRemoteDomain = _path => g_referenceDomains.some(domain => _path.match(`^https://${domain}/`) !== null);
70
+ const g_remoteFlg = hasRemoteDomain(g_rootPath);
69
71
 
70
72
  const g_randTime = Date.now();
71
73
  const g_isFile = location.href.match(/^file/);
@@ -523,7 +525,9 @@ const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {})
523
525
  // カラーコードの色付け処理
524
526
  _value = escapeHtml(_value).replaceAll(`\n`, `<br>`);
525
527
  const colorCodePattern = /(#|0x)(?:[A-Fa-f0-9]{6}(?:[A-Fa-f0-9]{2})?|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})/g;
526
- if (colorCodePattern.test(_value)) {
528
+ if (_value === C_FLG_ON) {
529
+ return `<span style="color:#66ff66">&#x2714; ON</span>`;
530
+ } else if (colorCodePattern.test(_value)) {
527
531
  return _value.replace(colorCodePattern, (match) =>
528
532
  `<span style="color:${match.replace(`0x`, `#`)}">◆</span>${match.replace(`0x`, `#`)}`);
529
533
  }
@@ -539,8 +543,9 @@ const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {})
539
543
  // scrollDirXのスクロール方向表示処理
540
544
  return _value === 1 ? `1|<span style="color:#ff9999">↑</span>` : `-1|<span style="color:#66ff66">↓</span>`;
541
545
 
542
- } else if (_rootKey.startsWith(`keyCtrl`) && !_rootKey.startsWith(`keyCtrlPtn`)) {
543
- // keyCtrlXの対応キー表示処理
546
+ } else if (listMatching(_rootKey, [`keyCtrl`, `keyRetry`, `keyTitleBack`], { prefix: `^` })
547
+ && !_rootKey.startsWith(`keyCtrlPtn`)) {
548
+ // keyCtrlX, keyRetryX, keyTitleBackX の対応キー表示処理
544
549
  return (g_kCd[_value] && _value !== 0) ? `${_value}|<span style="color:#ffff66">${g_kCd[_value]}</span>` : `----`;
545
550
  }
546
551
  } else if (isObj(_value)) {
@@ -1100,6 +1105,9 @@ const loadMultipleFiles2 = async (_fileData, _loadType) => {
1100
1105
  * @returns {string[]} [ファイルキーワード, ルートディレクトリ]
1101
1106
  */
1102
1107
  const getFilePath = (_fileName, _directory = ``) => {
1108
+ if (_fileName.startsWith(`https://`)) {
1109
+ return [_fileName, ``];
1110
+ }
1103
1111
  let fullPath;
1104
1112
  if (_fileName.startsWith(C_MRK_CURRENT_DIRECTORY)) {
1105
1113
  fullPath = `${g_workPath}${_fileName.slice(C_MRK_CURRENT_DIRECTORY.length)}`;
@@ -2757,13 +2765,13 @@ const loadChartFile = async (_scoreId = g_stateObj.scoreId) => {
2757
2765
  const filename = `${fileCommon}${g_stateObj.dosDivideFlg ?
2758
2766
  setDosIdHeader(_scoreId, g_stateObj.scoreLockFlg) : ''}.${fileExtension}`;
2759
2767
 
2760
- await loadScript2(`${g_workPath}${filename}?${Date.now()}`, false, charset);
2768
+ await loadScript2(`${filename}?${Date.now()}`, false, charset);
2761
2769
  if (typeof externalDosInit === C_TYP_FUNCTION) {
2762
2770
  deleteDiv(divRoot, `lblLoading`);
2763
2771
 
2764
2772
  // 外部データを読込(ファイルが見つからなかった場合は譜面追記をスキップ)
2765
2773
  externalDosInit();
2766
- if (g_loadObj[`${g_workPath}${filename}`]) {
2774
+ if (g_loadObj[filename]) {
2767
2775
  Object.assign(g_rootObj, dosConvert(g_externalDos));
2768
2776
  }
2769
2777
 
@@ -3135,7 +3143,9 @@ const preheaderConvert = _dosObj => {
3135
3143
  });
3136
3144
 
3137
3145
  const convLocalPath = (_file, _type) =>
3138
- g_remoteFlg && hasVal(_file) && !_file.includes(`(..)`) ? `(..)../${_type}/${_file}` : _file;
3146
+ g_remoteFlg && hasVal(_file) && !_file.includes(`(..)`) && !hasRemoteDomain(_file)
3147
+ ? `(..)../${_type}/${_file}`
3148
+ : _file;
3139
3149
 
3140
3150
  // 外部スキンファイルの指定
3141
3151
  const tmpSkinType = _dosObj.skinType ?? g_presetObj.skinType ?? `default`;
@@ -3218,6 +3228,7 @@ const headerConvert = _dosObj => {
3218
3228
  extension: imgTypes[1] || `svg`,
3219
3229
  rotateEnabled: setBoolVal(imgTypes[2], true),
3220
3230
  flatStepHeight: setVal(imgTypes[3], C_ARW_WIDTH, C_TYP_FLOAT),
3231
+ remoteDir: imgTypes[4] || ``,
3221
3232
  };
3222
3233
  g_keycons.imgTypes[j] = (imgTypes[0] === `` ? `Original` : imgTypes[0]);
3223
3234
  });
@@ -3225,7 +3236,7 @@ const headerConvert = _dosObj => {
3225
3236
 
3226
3237
  // 末尾にデフォルト画像セットが入るよう追加
3227
3238
  if (obj.imgType.findIndex(imgSets => imgSets.name === ``) === -1) {
3228
- obj.imgType.push({ name: ``, extension: `svg`, rotateEnabled: true, flatStepHeight: C_ARW_WIDTH });
3239
+ obj.imgType.push({ name: ``, extension: `svg`, rotateEnabled: true, flatStepHeight: C_ARW_WIDTH, remoteDir: `` });
3229
3240
  g_keycons.imgTypes.push(`Original`);
3230
3241
  }
3231
3242
  g_imgType = g_keycons.imgTypes[0];
@@ -3897,6 +3908,7 @@ const getMusicNameMultiLine = _musicName => {
3897
3908
  * @param {object} _imgType
3898
3909
  * @param {string} _imgType.name
3899
3910
  * @param {string} _imgType.extension
3911
+ * @param {string} _imgType.remoteDir
3900
3912
  * @param {boolean} _initFlg
3901
3913
  */
3902
3914
  const updateImgType = (_imgType, _initFlg = false) => {
@@ -3910,9 +3922,13 @@ const updateImgType = (_imgType, _initFlg = false) => {
3910
3922
  Object.keys(g_imgObj).forEach(key => g_imgObj[key] = `${g_rootPath}${orgImgObj[key]}`);
3911
3923
 
3912
3924
  // リモート時は作品ページ側にある画像を優先し、リモートに存在するもののみリモートから取得する
3925
+ // titleArrowについては他のImgTypeから取得するため、remoteDir属性には依存させない
3913
3926
  if (g_remoteFlg) {
3914
3927
  Object.keys(g_imgObj).forEach(key => g_imgObj[key] = `${g_workPath}${orgImgObj[key]}`);
3915
- if (g_defaultSets.imgType.findIndex(val => val === _imgType.name) >= 0) {
3928
+ if (_imgType.remoteDir !== `` && hasRemoteDomain(_imgType.remoteDir)) {
3929
+ g_defaultSets.imgList.filter(val => val !== `titleArrow`)
3930
+ .forEach(key => g_imgObj[key] = `${_imgType.remoteDir}img/${orgImgObj[key]}`);
3931
+ } else if (g_defaultSets.imgType.findIndex(val => val === _imgType.name) >= 0) {
3916
3932
  g_defaultSets.imgList.forEach(key => g_imgObj[key] = `${g_rootPath}${orgImgObj[key]}`);
3917
3933
  }
3918
3934
  }
@@ -0,0 +1,17 @@
1
+ 
2
+ /**
3
+ * jsdelivrのdanoni_main.jsを取得するスクリプトサンプル
4
+ *
5
+ * - このファイルを danoni_main.js と差し替えて、
6
+ * ___version にバージョン名を格納することで jsdelivr のファイルを取りに行くようになります。
7
+ * - ___version にはバージョン名 (x.y.z形式) を入れて下さい。
8
+ */
9
+
10
+ // 適用するバージョン名
11
+ const __version = `40.5.2`;
12
+
13
+ // バージョン情報を取得してスクリプトタグを生成
14
+ const __script = document.createElement('script');
15
+ __script.src = `https://cdn.jsdelivr.net/npm/danoniplus@${__version}/js/danoni_main.min.js`;
16
+ document.head.appendChild(__script); // スクリプトをヘッダーに追加
17
+ console.log(`Loaded version: ${__version}`);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  /**
3
3
  * Dancing☆Onigiri 設定用jsファイル
4
- * Template Update: 2025/03/01 (v40.0.0)
4
+ * Template Update: 2025/03/16 (v40.6.0)
5
5
  *
6
6
  * このファイルでは、作品全体に対しての初期設定を行うことができます。
7
7
  * 譜面データ側で個別に同様の項目が設定されている場合は、譜面データ側の設定が優先されます。
@@ -172,16 +172,18 @@ g_presetObj.customDesignUse = {
172
172
 
173
173
  /**
174
174
  デフォルト画像セットの設定
175
- (セット対象のフォルダ名, 拡張子, 画像回転有無(true or false), Flat時ステップ間隔の順に指定)
175
+ (セット対象のフォルダ名, 拡張子, 画像回転有無(true or false), Flat時ステップ間隔, リモート時のディレクトリの順に指定)
176
176
 
177
177
  事前に、[img]フォルダ配下にセット対象のサブフォルダを作成し、その中に一式を入れておく必要あり
178
178
  下記の場合は[classic]フォルダに[png]形式の画像一式をデフォルト画像セットとして使用する
179
+ なお、リモート時のディレクトリ(jsdelivr)を指定した場合はサブフォルダの作成及び格納は不要
179
180
 
180
181
  未指定の場合のデフォルト値は以下の通り
181
182
  セット対象のフォルダ名:`` (imgフォルダ直下)
182
183
  拡張子:`svg`形式
183
184
  画像回転有無:true(回転有り)
184
185
  Flat時ステップ間隔:50(px) ※矢印サイズ
186
+ リモート時のディレクトリ:`` (指定なし。自サーバーの画像を使用する)
185
187
  */
186
188
  //g_presetObj.imageSets = [``, `classic,png`, `classic-thin,png`, `note,svg,false,0`];
187
189
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "40.5.3",
3
+ "version": "40.6.0",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
- "main": "index.js",
5
+ "main": "./js/danoni_main.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
@@ -1,23 +0,0 @@
1
- 
2
- /**
3
- * jsdelivrのdanoni_main.jsを取得するスクリプトサンプル
4
- *
5
- * - このファイルを danoni_main.js と差し替えて、
6
- * jsフォルダに「version.txt」を格納することで jsdelivr のファイルを取りに行くようになります。
7
- * - version.txt にはバージョン名 (x.y.z形式) を入れて下さい。
8
- * - カレントパス指定には対応していないので、version.txtのパスは必要に応じて変えてください。
9
- */
10
-
11
- // バージョン情報を取得してスクリプトタグを生成
12
- const randTime = Date.now();
13
- fetch(`../js/version.txt?${randTime}`)
14
- .then(response => response.text())
15
- .then(version => {
16
- const script = document.createElement('script');
17
- script.src = `https://cdn.jsdelivr.net/npm/danoniplus@${version}/js/danoni_main.min.js`;
18
- document.head.appendChild(script); // スクリプトをヘッダーに追加
19
- console.log(`Loaded version: ${version}`);
20
- })
21
- .catch(error => {
22
- console.error('Failed to load version:', error);
23
- });