Skip to content

Commit

Permalink
モバイルブラウザ向けの不具合対応
Browse files Browse the repository at this point in the history
Object.values()メソッドを.map()へ変更
  • Loading branch information
youthkee committed Apr 20, 2017
1 parent a02424f commit ea9554e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
8 changes: 6 additions & 2 deletions detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ <h1 id="title"></h1>
$('artist0').innerHTML = '<p>' + item.artists.artist0.name + '</p>';
//1人目のセットリストの内容をオブジェクトとして取得
var firstSetlistNum = Object.keys(item.artists.artist0.setlist).length;
var firstSetlistItem = Object.values(item.artists.artist0.setlist);
var firstSetlistItem = Object.keys(item.artists.artist0.setlist).map(function(key) {
return item.artists.artist0.setlist[key];
});
//1人目のアーティスト名の下にセットリスト欄を追加
var firstArtistList = document.getElementById('artist0');
var firstSetlistArea = document.createElement('div');
Expand Down Expand Up @@ -156,7 +158,9 @@ <h1 id="title"></h1>
currentArtistList.parentNode.appendChild(nextArtistList);
//次のアーティストのセットリストの内容をオブジェクトとして取得
var nextSetlistNum = Object.keys(item.artists[nextArtistId].setlist).length;
var nextSetlistItem = Object.values(item.artists[nextArtistId].setlist);
var nextSetlistItem = Object.keys(item.artists[nextArtistId].setlist).map(function(key) {
return item.artists[nextArtistId].setlist[key];
});
//次のアーティスト名の下にセットリスト欄を追加
var nextSetlistArea = document.createElement('div');
nextSetlistArea.innerHTML = '<p>SETLIST(<a href="setlist.html?live=' + count + '&artist=' + i + '">編集</a>)</p>';
Expand Down
26 changes: 18 additions & 8 deletions import.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h1>IMPORT</h1>
</form>

<div id="result"></div>
<p id="error"></p>

<p>コピー&ペーストでインポートする場合は<a href="import2.html">こちら</a></p>

Expand Down Expand Up @@ -143,7 +144,9 @@ <h1>IMPORT</h1>
//localStorageのkeyを格納するための配列を生成
var key = Object.keys(loadData);
//localStorageのvalueを格納するための配列を生成
var value = Object.values(loadData);
var value = Object.keys(loadData).map(function(key) {
return loadData[key];
});

//JSONチェック用の関数にkey, valueを渡して結果を変数に代入
var checkImport = jsonCheck(key, value);
Expand All @@ -169,8 +172,8 @@ <h1>IMPORT</h1>

}catch(e){

console.log(e);
displayError();
$('error').innerText = e;

}

Expand Down Expand Up @@ -230,7 +233,9 @@ <h1>IMPORT</h1>
}

//各データのartist内の配列を取得
var artist = Object.values(value[i].artists);
var artist = Object.keys(value[i].artists).map(function(key) {
return value[i].artists[key];
});

//各データのartists内の項目チェック
for (obj in artist) {
Expand All @@ -245,7 +250,11 @@ <h1>IMPORT</h1>
var setlist = artist[obj].setlist;
var setlistKeys = Object.keys(setlist).sort();

if (!Object.values(setlist).length) {
var setlistValues = Object.keys(setlist).map(function(key) {
return setlist[key];
});

if (!setlistValues.length) {

} else {

Expand All @@ -268,7 +277,11 @@ <h1>IMPORT</h1>
var members = artist[obj].members;
var membersKeys = Object.keys(members).sort();

if (!Object.values(members).length) {
var memberValues = Object.keys(members).map(function(key) {
return members[key];
});

if (!memberValues.length) {

} else {

Expand All @@ -287,9 +300,6 @@ <h1>IMPORT</h1>

}

//membersの値の一覧をオブジェクトとして取得
var memberValues = Object.values(members);

for (obj2 in memberValues) {
//members内のkeyの一覧を取得
var memberKeys = Object.keys(memberValues[obj2]).sort();
Expand Down
32 changes: 24 additions & 8 deletions import2.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ライブをメモするLivelog</title>
<style>
.message {
color: #ff0000;
}
</style>
</head>
<body>

Expand All @@ -26,6 +31,7 @@ <h1>IMPORT</h1>
</form>

<div id="result"></div>
<p id="error"></p>

<hr>

Expand Down Expand Up @@ -117,12 +123,15 @@ <h1>IMPORT</h1>
try{

var loadData = JSON.parse($('import').value);

//オブジェクトに登録されているデータの個数を取得
var loadDataNum = Object.keys(loadData).length;
//localStorageのkeyを格納するための配列を生成
var key = Object.keys(loadData);
//localStorageのvalueを格納するための配列を生成
var value = Object.values(loadData);
var value = Object.keys(loadData).map(function(key) {
return loadData[key];
});

//JSONチェック用の関数にkey, valueを渡して結果を変数に代入
var checkImport = jsonCheck(key, value);
Expand All @@ -148,8 +157,8 @@ <h1>IMPORT</h1>

}catch(e){

console.log(e);
displayError();
$('error').innerText = e;

}

Expand Down Expand Up @@ -209,7 +218,9 @@ <h1>IMPORT</h1>
}

//各データのartist内の配列を取得
var artist = Object.values(value[i].artists);
var artist = Object.keys(value[i].artists).map(function(key) {
return value[i].artists[key];
});

//各データのartists内の項目チェック
for (obj in artist) {
Expand All @@ -224,7 +235,11 @@ <h1>IMPORT</h1>
var setlist = artist[obj].setlist;
var setlistKeys = Object.keys(setlist).sort();

if (!Object.values(setlist).length) {
var setlistValues = Object.keys(setlist).map(function(key) {
return setlist[key];
});

if (!setlistValues.length) {

} else {

Expand All @@ -247,7 +262,11 @@ <h1>IMPORT</h1>
var members = artist[obj].members;
var membersKeys = Object.keys(members).sort();

if (!Object.values(members).length) {
var memberValues = Object.keys(members).map(function(key) {
return members[key];
});

if (!memberValues.length) {

} else {

Expand All @@ -266,9 +285,6 @@ <h1>IMPORT</h1>

}

//membersの値の一覧をオブジェクトとして取得
var memberValues = Object.values(members);

for (obj2 in memberValues) {
//members内のkeyの一覧を取得
var memberKeys = Object.keys(memberValues[obj2]).sort();
Expand Down

0 comments on commit ea9554e

Please sign in to comment.