Skip to content

Commit

Permalink
jsonの読み込み処理を関数化
Browse files Browse the repository at this point in the history
  • Loading branch information
Robot-Inventor committed May 13, 2021
1 parent 260dd22 commit 294de41
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 16 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Edition: ORIZIN Agent HTML

## リリース

### [v5.2.148.0dev-Eagle] - 2021-05-12
### [v5.2.148.0dev-Eagle] - 2021-05-13

#### 追加

Expand All @@ -58,6 +58,10 @@ Edition: ORIZIN Agent HTML
- experiment-cardコンポーネントのデザインを改善しました [#193](https://github.com/Robot-Inventor/ORIZIN-Agent-HTML/issues/193)
- details要素のデザインを改善し、アニメーションを追加ました [#195](https://github.com/Robot-Inventor/ORIZIN-Agent-HTML/issues/195)

#### 修正

- リファクタリングを行いました

### [v5.1.147.2-Eagle] - 2021-05-11

#### 追加
Expand Down
1 change: 1 addition & 0 deletions resource/html/information.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</style>
<script src="/eel.js"></script>
<script src="../javascript/orizin_ui.min.js"></script>
<script src="../javascript/basic.js"></script>
<script src="../javascript/bundle.js"></script>
<script src="../javascript/mousetrap.min.js"></script>
<script src="../javascript//mousetrap-bind-dictionary.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion resource/information.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"Version": "v5.2.148.0dev",
"Channel": "develop",
"Code Name": "Eagle",
"Date": "2021-05-12 JST"
"Date": "2021-05-13 JST"
}
7 changes: 3 additions & 4 deletions resource/javascript/about_oa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
async function load_info() {
const fetch_data = await fetch("../information.json");
const response = await fetch_data.json();
Object.keys(response).forEach((key) => {
document.getElementById("information").insertAdjacentText("beforeend", `${key}: ${response[key]}\n`);
const information = await load_json("../information.json");
Object.keys(information).forEach((key) => {
document.getElementById("information").insertAdjacentText("beforeend", `${key}: ${information[key]}\n`);
});
}

Expand Down
7 changes: 7 additions & 0 deletions resource/javascript/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ function load_script(url) {
document.body.appendChild(script_element);
}

// eslint-disable-next-line no-unused-vars
async function load_json(path) {
const fetch_response = await fetch(path);
const result = await fetch_response.json();
return result;
}


document.querySelector("header").innerHTML = `
<div id="top_app_bar">
Expand Down
3 changes: 1 addition & 2 deletions resource/javascript/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ function show_error(message_content) {
}

async function get_oa_info() {
const fetch_response = await fetch("../information.json");
const information_content = await fetch_response.json();
const information_content = await load_json("../information.json");
return information_content;
}

Expand Down
3 changes: 1 addition & 2 deletions resource/javascript/flag.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ load_script("../javascript/component/search_box.js");
load_script("../javascript/component/warning_message.js");

(async () => {
const fetch_response = await fetch("../json/flag.json");
const experiment_list = await fetch_response.json();
const experiment_list = await load_json("../json/flag.json");

Object.keys(experiment_list).forEach((experiment_name) => {
const experiment = experiment_list[experiment_name];
Expand Down
3 changes: 1 addition & 2 deletions resource/javascript/information.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ async function load_information() {
return string;
}

const fetch_response = await fetch("../information.json");
const information_content = await fetch_response.json();
const information_content = await load_json("../information.json");

const information_area = document.getElementById("information_area");
information_area.textContent = "";
Expand Down
3 changes: 1 addition & 2 deletions resource/javascript/oss_license.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
async function insert_license() {
const fetch_response = await fetch("../json/oss_license.json");
const response_content = await fetch_response.json();
const response_content = await load_json("../json/oss_license.json");

Object.keys(response_content).forEach((oss_name) => {
document.getElementById("license_section").insertAdjacentHTML("beforeend", `
Expand Down
3 changes: 1 addition & 2 deletions resource/javascript/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ document.getElementById("check_update").addEventListener("click", async function
}

document.getElementById("update_detail").innerHTML = "アップデートを確認中です...";
const response = await fetch("../information.json");
const information_data = await response.json();
const information_data = await load_json("../information.json");
const version_information = information_data.Version;
const release_data = await eel.get_release(information_data.Channel)();

Expand Down

0 comments on commit 294de41

Please sign in to comment.