Skip to content

Commit

Permalink
Merge pull request #464 from cwtickle/hotfix/0075-clear-window
Browse files Browse the repository at this point in the history
[0075-clear-window] 初回読込時のclearWindowをカット 他
  • Loading branch information
cwtickle committed Oct 2, 2019
2 parents cf3aaa5 + 288584e commit 12f8372
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions js/danoni_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,7 @@ function loadDos(_initFlg) {

const dosInput = document.querySelector(`#dos`);
const externalDosInput = document.querySelector(`#externalDos`);
const divRoot = document.querySelector(`#divRoot`);

if (dosInput === null && externalDosInput === null) {
makeWarningWindow(C_MSG_E_0023);
Expand Down Expand Up @@ -1933,9 +1934,11 @@ function loadDos(_initFlg) {
Object.assign(g_rootObj, dosConvert(dosInput.value));
if (externalDosInput === null) {
if (_initFlg) {
clearWindow();
const randTime = new Date().getTime();
loadScript(`../js/danoni_setting.js?${randTime}`, _ => {
if (document.querySelector(`#lblLoading`) !== null) {
divRoot.removeChild(document.querySelector(`#lblLoading`));
}
initAfterDosLoaded();
});
} else {
Expand All @@ -1946,7 +1949,6 @@ function loadDos(_initFlg) {

// 外部dos読み込み
if (externalDosInput !== null) {
clearWindow();
let charset = document.characterSet;
const charsetInput = document.querySelector(`#externalDosCharset`);
if (charsetInput !== null) {
Expand All @@ -1962,6 +1964,9 @@ function loadDos(_initFlg) {
const randTime = new Date().getTime();
loadScript(`${filename}?${randTime}`, _ => {
if (typeof externalDosInit === `function`) {
if (document.querySelector(`#lblLoading`) !== null) {
divRoot.removeChild(document.querySelector(`#lblLoading`));
}

// 外部データを読込
externalDosInit();
Expand Down Expand Up @@ -2753,6 +2758,7 @@ function makeWarningWindow(_text) {
lblWarning = getTitleDivLabel(`lblWarning`, `<p>${_text}</p>`, 0, 70);
lblWarning.style.backgroundColor = `#ffcccc`;
lblWarning.style.opacity = 0.9;
divRoot.appendChild(lblWarning);
} else {
lblWarning = document.querySelector(`#lblWarning`);
lblWarning.innerHTML += `<p>${_text}</p>`;
Expand All @@ -2765,8 +2771,6 @@ function makeWarningWindow(_text) {
lblWarning.style.color = `#660000`;
lblWarning.style.textAlign = C_ALIGN_LEFT;
lblWarning.style.fontFamily = getBasicFont();

divRoot.appendChild(lblWarning);
}

/**
Expand Down Expand Up @@ -3724,6 +3728,12 @@ function musicAfterLoaded() {
g_audio.removeEventListener(`canplaythrough`, f, false);
loadingScoreInit();
})(), false);

// エラー時
g_audio.addEventListener(`error`, (_ => function f() {
g_audio.removeEventListener(`error`, f, false);
makeWarningWindow(C_MSG_E_0041.split(`{0}`).join(g_audio.src));
})(), false);
}
}

Expand Down

0 comments on commit 12f8372

Please sign in to comment.