diff --git a/fortune_generator/fortune.js b/fortune_generator/fortune.js index 9b0adfb..91a9327 100644 --- a/fortune_generator/fortune.js +++ b/fortune_generator/fortune.js @@ -44,22 +44,17 @@ async function fetch_data(){ } // color adjust -const goodColor = "#e74c3c"; -const badColor = "#000000bf"; -const middleColor = "#5eb95e"; -const descColor = "#7f7f7f"; -const dateColor = "#096e1bC9"; const specialEventColor = "#3e4fbb"; const daystoSpecialEvent = "#485ccd"; -const textColor = [goodColor, goodColor, goodColor, goodColor, goodColor, middleColor, badColor, badColor]; +const textColorClass = ["good-fortune", "good-fortune", "good-fortune", "good-fortune", "good-fortune", "middle-fortune", "bad-fortune", "bad-fortune"]; const fortuneStatus = ["大吉", "中吉", "小吉", "吉", "末吉", "中平", "凶", "大凶"]; const chineseMonth = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]; const week = ['日', '一', '二', '三', '四', '五', '六']; -const title = `今日運勢`; -const allGood = `萬事皆宜`; -const allBad = `諸事不宜`; +const title = `今日運勢`; +const allGood = `萬事皆宜`; +const allBad = `諸事不宜`; // date const d = new Date(); @@ -101,9 +96,9 @@ async function init_page(){ $('#result-page').hide(); // show date before button pressed - 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); @@ -124,26 +119,26 @@ async function init_page(){ // if there is upcoming event then show if(eventIndex_1 != -1){ let days = daysDiff(eventIndex_1); - let upcoming_event_1 = `距離${special_events[eventIndex_1].event}還剩${days}天`; + let upcoming_event_1 = `距離${special_events[eventIndex_1].event}還剩${days}天`; $('#upcoming-event-1').html(upcoming_event_1); } if(eventIndex_2 != -1){ let days = daysDiff(eventIndex_2); - let upcoming_event_2 = `距離${special_events[eventIndex_2].event}還剩${days}天`; + let upcoming_event_2 = `距離${special_events[eventIndex_2].event}還剩${days}天`; $('#upcoming-event-2').html(upcoming_event_2); } // show special event if today is a special day if(special){ - let special_event_today = `今日是${special_events[special_events_index].event}`; + let special_event_today = `今日是${special_events[special_events_index].event}`; $('#special-day').html(special_event_today); } } // event bar -const good_span = event => `宜: ${event}`; -const bad_span = event => `忌: ${event}`; -const desc_span = desc => `${desc}`; +const good_span = event => `宜: ${event}`; +const bad_span = event => `忌: ${event}`; +const desc_span = desc => `${desc}`; function Appear() { $('#title').html(title); @@ -169,11 +164,11 @@ function Appear() { // decide the status let status_index = ((seed1 + seed2) % statusLen + statusLen) % 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]} §`; J_ip_to_fortune.html(special_status); } else{ diff --git a/fortune_generator/index.html b/fortune_generator/index.html index 3c84eaa..cbb474e 100644 --- a/fortune_generator/index.html +++ b/fortune_generator/index.html @@ -56,7 +56,7 @@