Skip to content

Commit ab01e2d

Browse files
Merge pull request #4 from kichi2004/feature/#1
リファクタリング等
2 parents 6c527cf + fc41233 commit ab01e2d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

AtCoderColorNEWS.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99

1010
(function () {
1111
//お気に入りリストを取得
12-
let favList = localStorage.fav;
13-
favList = favList.split('"');
12+
let favList = JSON.parse(localStorage.fav);
1413

1514
//レートを色に変換するリスト
1615
let color = ['灰', '茶', '緑', '水', '青', '黄', '橙', '赤', '自由'];
1716

1817
let string = ""; //通知用string
19-
for (let i = 1; i < favList.length; i += 2) {
18+
for (let i = 0; i < favList.length; i++) {
2019
//favList[i]:=お気に入りの人のusername
2120

2221
let preRate = 1000;
@@ -32,8 +31,8 @@
3231
if (!joinFlag) continue;
3332

3433
//Rateを色に変換する
35-
preRate = Math.floor(preRate / 400);
36-
nowRate = Math.floor(nowRate / 400);
34+
preRate = Math.min(8, Math.floor(preRate / 400));
35+
nowRate = Math.min(8, Math.floor(nowRate / 400));
3736

3837
//前の色よりも今の色のほうが高い場合通知。
3938
if (preRate < nowRate) {

0 commit comments

Comments
 (0)