danoniplus 40.0.1 → 40.1.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/01
7
+ * Revised : 2025/03/02
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 40.0.1`;
12
- const g_revisedDate = `2025/03/01`;
11
+ const g_version = `Ver 40.1.0`;
12
+ const g_revisedDate = `2025/03/02`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -37,13 +37,41 @@ const current = () => {
37
37
  const targetScript = scripts.find(file => file.src.endsWith(`danoni_main.js`));
38
38
  return targetScript.src;
39
39
  };
40
+
41
+ /**
42
+ * 現在URLのクエリパラメータから指定した値を取得
43
+ * @param {string} _name
44
+ * @returns {string}
45
+ */
46
+ const getQueryParamVal = _name => {
47
+ const param = new URL(location.href).searchParams.get(_name);
48
+ return param !== null ? decodeURIComponent(param.replace(/\+/g, ` `)) : null;
49
+ };
50
+
51
+ // 常時デバッグを許可するドメイン
52
+ const g_reservedDomains = [
53
+ `danonicw.skr.jp`,
54
+ `tickle.cloudfree.jp`,
55
+ ];
56
+ Object.freeze(g_reservedDomains);
57
+
58
+ // 外部参照を許可するドメイン
59
+ const g_referenceDomains = [
60
+ `cwtickle.github.io/danoniplus`,
61
+ `support-v\\d+--danoniplus.netlify.app`,
62
+ ];
63
+ Object.freeze(g_referenceDomains);
64
+
40
65
  const g_rootPath = current().match(/(^.*\/)/)[0];
41
66
  const g_workPath = new URL(location.href).href.match(/(^.*\/)/)[0];
42
- const g_remoteFlg = g_rootPath.match(`^https://cwtickle.github.io/danoniplus/`) !== null ||
43
- g_rootPath.match(/danoniplus.netlify.app/) !== null;
67
+ const g_remoteFlg = g_referenceDomains.some(domain => g_rootPath.match(`^https://${domain}/`) !== null);
68
+
44
69
  const g_randTime = Date.now();
45
70
  const g_isFile = location.href.match(/^file/);
46
71
  const g_isLocal = location.href.match(/^file/) || location.href.indexOf(`localhost`) !== -1;
72
+ const g_isDebug = g_isLocal ||
73
+ g_reservedDomains.some(domain => location.href.match(`^https://${domain}/`) !== null) ||
74
+ getQueryParamVal(`debug`) === `true`;
47
75
  const isLocalMusicFile = _scoreId => g_isFile && !listMatching(getMusicUrl(_scoreId), [`.js`, `.txt`], { suffix: `$` });
48
76
 
49
77
  window.onload = async () => {
@@ -825,14 +853,17 @@ const createScText = (_obj, _settingLabel, { displayName = `option`, dfLabel = `
825
853
  * 各画面の汎用ショートカットキー表示
826
854
  * @param {string} _displayName
827
855
  */
828
- const createScTextCommon = _displayName =>
829
- Object.keys(g_btnPatterns[_displayName]).filter(target => document.getElementById(`btn${target}`) !== null)
830
- .forEach(target =>
831
- createScText(document.getElementById(`btn${target}`), target, {
832
- displayName: _displayName, targetLabel: `btn${target}`,
833
- dfLabel: g_lblNameObj[`sc_${_displayName}${target}`] ?? ``,
834
- x: g_btnPatterns[_displayName][target],
835
- }));
856
+ const createScTextCommon = _displayName => {
857
+ if (g_btnPatterns[_displayName]) {
858
+ Object.keys(g_btnPatterns[_displayName]).filter(target => document.getElementById(`btn${target}`) !== null)
859
+ .forEach(target =>
860
+ createScText(document.getElementById(`btn${target}`), target, {
861
+ displayName: _displayName, targetLabel: `btn${target}`,
862
+ dfLabel: g_lblNameObj[`sc_${_displayName}${target}`] ?? ``,
863
+ x: g_btnPatterns[_displayName][target],
864
+ }));
865
+ }
866
+ };
836
867
 
837
868
  /**
838
869
  * ショートカットキー有効化
@@ -849,7 +880,9 @@ const setShortcutEvent = (_displayName, _func = () => true, { displayFlg = true,
849
880
  document.onkeydown = evt => commonKeyDown(evt, _displayName, _func, dfEvtFlg);
850
881
  document.onkeyup = evt => commonKeyUp(evt);
851
882
  };
852
- if (g_initialFlg && g_btnWaitFrame[_displayName].initial) {
883
+ if (!g_btnWaitFrame[_displayName] ||
884
+ g_btnWaitFrame[_displayName].s_frame === 0 ||
885
+ (g_initialFlg && g_btnWaitFrame[_displayName].initial)) {
853
886
  evList();
854
887
  } else {
855
888
  setTimeout(() => {
@@ -1588,7 +1621,9 @@ const createCss2Button = (_id, _text, _func = () => true, {
1588
1621
 
1589
1622
  // ボタン有効化操作
1590
1623
  if (initDisabledFlg) {
1591
- if (g_initialFlg && g_btnWaitFrame[groupName].initial) {
1624
+ if (!g_btnWaitFrame[groupName] ||
1625
+ g_btnWaitFrame[groupName].b_frame === 0 ||
1626
+ (g_initialFlg && g_btnWaitFrame[groupName].initial)) {
1592
1627
  } else {
1593
1628
  style.pointerEvents = C_DIS_NONE;
1594
1629
  setTimeout(() => style.pointerEvents = rest.pointerEvents ?? C_DIS_AUTO,
@@ -2263,16 +2298,6 @@ const copyTextToClipboard = async (_textVal, _msg) => {
2263
2298
  }
2264
2299
  };
2265
2300
 
2266
- /**
2267
- * 現在URLのクエリパラメータから指定した値を取得
2268
- * @param {string} _name
2269
- * @returns {string}
2270
- */
2271
- const getQueryParamVal = _name => {
2272
- const param = new URL(location.href).searchParams.get(_name);
2273
- return param !== null ? decodeURIComponent(param.replace(/\+/g, ` `)) : null;
2274
- };
2275
-
2276
2301
  /**
2277
2302
  * ローディング文字用ラベルの作成
2278
2303
  * @returns {HTMLDivElement}
@@ -6853,7 +6878,8 @@ const getKeyCtrl = (_localStorage, _extraKeyName = ``) => {
6853
6878
  const isUpdate = prevPtn !== -1 && g_keyObj.prevKey !== g_keyObj.currentKey;
6854
6879
  g_keyCopyLists.multiple.filter(header => g_keyObj[`${header}${basePtn}`] !== undefined && isUpdate)
6855
6880
  .forEach(header => g_keyObj[`${header}${copyPtn}`] = structuredClone(g_keyObj[`${header}${basePtn}`]));
6856
- g_keyCopyLists.simple.forEach(header => g_keyObj[`${header}${copyPtn}`] = g_keyObj[`${header}${basePtn}`]);
6881
+ g_keyCopyLists.simple.filter(header => g_keyObj[`${header}${basePtn}`] !== undefined && isUpdate)
6882
+ .forEach(header => g_keyObj[`${header}${copyPtn}`] = g_keyObj[`${header}${basePtn}`]);
6857
6883
 
6858
6884
  g_keycons.groups.forEach(type => {
6859
6885
  let maxPtn = 0;
@@ -10791,8 +10817,8 @@ const mainInit = () => {
10791
10817
  [`lblCredit`, `lblDifName`].forEach(labelName => changeStyle(labelName, g_lblPosObj.musicInfoOFF));
10792
10818
  }
10793
10819
 
10794
- // ローカル時のみフレーム数を残す
10795
- if (!g_isLocal) {
10820
+ // デバッグ時のみフレーム数を残す
10821
+ if (!g_isDebug) {
10796
10822
  lblframe.style.display = C_DIS_NONE;
10797
10823
  }
10798
10824
 
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Source by tickle
7
7
  * Created : 2019/11/19
8
- * Revised : 2025/03/01 (v40.0.1)
8
+ * Revised : 2025/03/02 (v40.1.0)
9
9
  *
10
10
  * https://github.com/cwtickle/danoniplus
11
11
  */
@@ -248,7 +248,7 @@ const updateWindowSiz = () => {
248
248
  },
249
249
  btnPrecond: {
250
250
  x: g_btnX(1 / 4), y: g_sHeight - 20, w: g_btnWidth(1 / 4), h: 16, siz: 12,
251
- visibility: getQueryParamVal(`debug`) === `true` ? `visible` : `hidden`,
251
+ visibility: g_isDebug ? `visible` : `hidden`,
252
252
  },
253
253
  btnSafeMode: {
254
254
  x: g_btnX(), siz: 18,
@@ -2326,22 +2326,32 @@ const g_shortcutObj = {
2326
2326
  // b_frame: ボタンの有効化フレーム数、s_frame: ショートカットキーの有効化フレーム数
2327
2327
  // initial: 初回のみ有効化時間を設定する場合、trueを設定
2328
2328
  const g_btnWaitFrame = {
2329
- initial: { b_frame: 0, s_frame: 0 },
2330
- title: { b_frame: 0, s_frame: 0 },
2331
- dataMgt: { b_frame: 0, s_frame: 0 },
2332
- precondition: { b_frame: 0, s_frame: 0 },
2333
- option: { b_frame: 0, s_frame: 0, initial: true },
2334
- difSelector: { b_frame: 0, s_frame: 0 },
2335
- settingsDisplay: { b_frame: 0, s_frame: 0 },
2336
- exSetting: { b_frame: 0, s_frame: 0 },
2337
- keyConfig: { b_frame: 0, s_frame: 30 },
2338
- loading: { b_frame: 0, s_frame: 0 },
2339
- loadingIos: { b_frame: 0, s_frame: 0 },
2340
- main: { b_frame: 0, s_frame: 0 },
2341
- result: { b_frame: 0, s_frame: 120 },
2329
+ initial: {},
2330
+ title: {},
2331
+ dataMgt: {},
2332
+ precondition: {},
2333
+ option: { initial: true },
2334
+ difSelector: {},
2335
+ settingsDisplay: {},
2336
+ exSetting: {},
2337
+ keyConfig: { s_frame: 30 },
2338
+ loading: {},
2339
+ loadingIos: {},
2340
+ main: {},
2341
+ result: { s_frame: 120 },
2342
2342
  };
2343
+ Object.keys(g_btnWaitFrame).forEach(key => {
2344
+ if (!g_btnWaitFrame[key].b_frame) {
2345
+ g_btnWaitFrame[key].b_frame = 0;
2346
+ }
2347
+ if (!g_btnWaitFrame[key].s_frame) {
2348
+ g_btnWaitFrame[key].s_frame = 0;
2349
+ }
2350
+ });
2343
2351
 
2344
2352
  // 主要ボタンのリスト
2353
+ // - btn + プロパティ名に合致するボタンid名に対して、
2354
+ // どの位置(X方向)にショートカット名を表示するかを設定
2345
2355
  const g_btnPatterns = {
2346
2356
  title: { Start: 0, Comment: -10 },
2347
2357
  dataMgt: { Back: 0, Environment: -35, Highscores: -35, CustomKey: -35, Others: -35 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "40.0.1",
3
+ "version": "40.1.0",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "index.js",
6
6
  "scripts": {