From af747b1bc32c187a73f8e1161d1cc69eed26e2f2 Mon Sep 17 00:00:00 2001 From: lifeadventurer Date: Sun, 19 Nov 2023 20:22:36 +0800 Subject: [PATCH] adjust fortune status and exchange the colors with a const variable --- fortune_generator/fortune.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/fortune_generator/fortune.js b/fortune_generator/fortune.js index dc72ae4..31c2235 100644 --- a/fortune_generator/fortune.js +++ b/fortune_generator/fortune.js @@ -24,16 +24,18 @@ fetch("special.json") // color adjust const goodColor = "#e74c3c"; const badColor = "#000000bf"; +const middleColor = "#5eb95e"; const descColor = "#7f7f7f"; +const dateColor = "#054310C9"; -const textColor = [goodColor, goodColor, goodColor, goodColor, goodColor, "#5eb95e", "#5eb95e", badColor, badColor, badColor]; -const fortuneStatus = ["大吉", "中吉", "中吉", "小吉", "小吉", "中平", "中平", "凶", "凶", "大凶"]; +const textColor = [goodColor, goodColor, goodColor, goodColor, goodColor, middleColor, badColor, badColor]; +const fortuneStatus = ["大吉", "中吉", "小吉", "吉", "末吉", "中平", "凶", "大凶"]; const chineseMonth = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]; const week = ['日', '一', '二', '三', '四', '五', '六']; -const title = `今日運勢`; -const allGood = `萬事皆宜`; -const allBad = `諸事不宜`; +const title = `今日運勢`; +const allGood = `萬事皆宜`; +const allBad = `諸事不宜`; // date const d = new Date(); @@ -43,9 +45,9 @@ const month = d.getMonth() + 1; const year = d.getFullYear(); // before press button -const showMonth = `${chineseMonth[month - 1] + "月"}`; -const showDate = `${("0" + date).substr(-2)}`; -const showDay = `${"星期" + week[day]}`; +const showMonth = `${chineseMonth[month - 1] + "月"}`; +const showDate = `${("0" + date).substr(-2)}`; +const showDay = `${"星期" + week[day]}`; $('#month').html(showMonth); $('#date').html(showDate); @@ -54,15 +56,15 @@ $('#weekday').html(showDay); let special = false; function good_span(event){ - return `宜: ${event}`; + return `宜: ${event}`; } function bad_span(event){ - return `忌: ${event}`; + return `忌: ${event}`; } function desc_span(desc){ - return `${desc}`; + return `${desc}`; } function Appear() { @@ -97,11 +99,11 @@ function Appear() { let seed2 = (num[0] << (hashDate + 2)) * (num[1] << hashDate) + (num[2] << 1) * (num[3] << 3) + (date << (hashDate - 1)) * (month << 4) + year >> hashDate; let status_index = seed1 % statusLen; - let status = `§ ${fortuneStatus[status_index]} §`; + let status = `§ ${fortuneStatus[status_index]} §`; if(special){ status_index = special_events[special_events_index].status_index; - let special_status = `§ ${fortuneStatus[status_index]} §`; + let special_status = `§ ${fortuneStatus[status_index]} §`; $('#ip-to-fortune').html(special_status); } else{ @@ -174,7 +176,6 @@ function Appear() { else{ if(seed1 % statusLen == 0){ $('#r-1-event').html(allGood); - } else{ $('#r-1-event').html(r_1_event);