diff --git a/Kuli/index.html b/Kuli/index.html index 3df0beb..3ecfdf7 100644 --- a/Kuli/index.html +++ b/Kuli/index.html @@ -4,10 +4,10 @@ - 苦力 Beta + 苦力 -
+
播放音乐
○ @@ -46,6 +46,7 @@ + diff --git a/Kuli/mkWrongChoice.js b/Kuli/mkWrongChoice.js index 2fca258..20e5ebd 100644 --- a/Kuli/mkWrongChoice.js +++ b/Kuli/mkWrongChoice.js @@ -13,7 +13,8 @@ const consPhoneme = [ ["J", "Q", "Zh", "Ch", "Z", "C"], ["X", "Sh", "S"], ["L", "R"], - ["H", "F"] + ["H", "F"], + ["ng"], ]; const vowPhoneme = [ ["ā", "á", "ǎ", "à"], @@ -21,7 +22,6 @@ const vowPhoneme = [ ["ū", "ú", "ǔ", "ù"], ["ē", "é", "ě", "è"], ["ō", "ó", "ǒ", "ò"], - ["ng"] ]; let consPhonemeType; let foundConsPhoneme = []; @@ -30,8 +30,6 @@ let consWrongList = []; let wrongList = []; let consWrong; let vowWrong; -let temp; -let temptemp; let zhCheck = -1; let chCheck = -1; let shCheck = -1; @@ -148,10 +146,15 @@ function mkWrongChoice(choice){ } //同グループの自分以外の子音に置換される for(let i = 0; i < foundConsPhoneme.length; ++i){ - for(let j = 0; j < consPhoneme[foundConsPhoneme[i][0]].length; j++){ - if(j == foundConsPhoneme[i][1]) continue; - consWrong = choice.replace(consPhoneme[foundConsPhoneme[i][0]][foundConsPhoneme[i][1]], consPhoneme[foundConsPhoneme[i][0]][j]) - consWrongList.push(consWrong) + if(consPhoneme[foundConsPhoneme[i][0]][foundConsPhoneme[i][1]] == "ng"){ + consWrong = choice.replace("ng", "n") + consWrongList.push(consWrong) + }else{ + for(let j = 0; j < consPhoneme[foundConsPhoneme[i][0]].length; j++){ + if(j == foundConsPhoneme[i][1]) continue; + consWrong = choice.replace(consPhoneme[foundConsPhoneme[i][0]][foundConsPhoneme[i][1]], consPhoneme[foundConsPhoneme[i][0]][j]) + consWrongList.push(consWrong) + } } } consWrongList.push(choice) @@ -184,7 +187,4 @@ function mkWrongChoice(choice){ console.log({wrongList}); return wrongList; -} - -mkWrongChoice("Zhōngguó"); -mkWrongChoice("kuàngquánshuǐ"); \ No newline at end of file +} \ No newline at end of file diff --git a/Kuli/script.js b/Kuli/script.js index 46467c6..f037a02 100644 --- a/Kuli/script.js +++ b/Kuli/script.js @@ -5,7 +5,7 @@ let targetLen = target.length; console.log(targetLen); let body = document.getElementsByTagName("body")[0]; -let clsChg = document.getElementById("clsChg"); +let BGMButton = document.getElementById("BGMButton"); let display = document.getElementById("display"); let word = document.getElementById("word"); let pronunc = document.getElementById("pronunc"); @@ -24,8 +24,11 @@ let replay = document.getElementById("replay"); let corrSound = document.getElementById("corrSound"); let corrSound2 = document.getElementById("corrSound2"); let wrongSound = document.getElementById("wrongSound"); -corrSound.volume = 0.7; +let BGM = document.getElementById("BGM"); +corrSound.volume = 1; wrongSound.volume = 0.5; +BGM.loop = true; +BGM.volume = 1; let curWordIdx; let curCorrIdx; @@ -52,6 +55,7 @@ let mistakenWordPronunc; let mistakenWordPronuncLen; let mistakenWordPronuncTxt; let wrongsTxt; +let isOnTheBeat = false; function randElem(arr) { //与配列からランダムに要素を一つ取り出して返す関数 @@ -99,9 +103,9 @@ function quiz() { mistakenWordIdx = wrongs[i][0]; //間違い方リストから正答番号を取り出した mistakenWordPronuncTxt = "‘" + mistakenWordPronunc + "’"; - wrongsTxt += "‘" + target[mistakenWordIdx]["word"] + "’" - + "是 ‘" - + target[mistakenWordIdx]["pronunc"] + "’,不是‘" + wrongs[i][1] + "’。
" + wrongsTxt += "‘" + target[mistakenWordIdx]["word"] + "’" + + "‘" + + target[mistakenWordIdx]["pronunc"] + "’,不是‘" + wrongs[i][1] + "’。
" } imperfect.innerHTML = wrongsTxt.slice(0, -4); return [null, null]; @@ -161,6 +165,7 @@ function start() { result.style.animation = ""; } start(); + ans[0].addEventListener("click", () => { if (curCorrIdx == 0) { //正解の場合 @@ -253,4 +258,16 @@ ans[3].addEventListener("click", () => { wrongs.push([curWordIdx, ans[3].textContent]); } }) -replay.addEventListener("click", start) \ No newline at end of file +replay.addEventListener("click", start) + +BGMButton.addEventListener("click", () => { + if(isOnTheBeat){ + BGM.pause(); + BGMButton.innerText = "播放音乐"; + isOnTheBeat = false; + }else{ + BGM.play(); + BGMButton.innerText = "停止音乐"; + isOnTheBeat = true; + } +}) \ No newline at end of file diff --git a/Kuli/src/circle.svg b/Kuli/src/circle.svg index c8ae11d..a723741 100644 --- a/Kuli/src/circle.svg +++ b/Kuli/src/circle.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/Kuli/src/cross.svg b/Kuli/src/cross.svg index 79d1757..188b86d 100644 --- a/Kuli/src/cross.svg +++ b/Kuli/src/cross.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/Kuli/src/gongzuobeige.mp3 b/Kuli/src/gongzuobeige.mp3 new file mode 100644 index 0000000..33f3a64 Binary files /dev/null and b/Kuli/src/gongzuobeige.mp3 differ diff --git a/Kuli/src/words_list.js b/Kuli/src/words_list.js index a2f5713..534d6f0 100644 --- a/Kuli/src/words_list.js +++ b/Kuli/src/words_list.js @@ -1,6 +1,6 @@ function words() { return[ - { "word": "你", "meaning": ["あなた"], "pronunc": ["nı̌ "] }, + { "word": "你", "meaning": ["あなた"], "pronunc": ["nǐ"] }, { "word": "好", "meaning": ["良い"], "pronunc": ["hǎo"] }, { "word": "我", "meaning": ["わたし"], "pronunc": ["wǒ"] }, { "word": "叫", "meaning": ["~という名前である"], "pronunc": ["jiào"] }, @@ -68,7 +68,7 @@ function words() { { "word": "老师", "meaning": ["先生"], "pronunc": ["lǎoshī"] }, { "word": "朋友", "meaning": ["友達"], "pronunc": ["péngyou"] }, { "word": "日本人", "meaning": ["日本人"], "pronunc": ["Rìběnrén"] }, - { "word": "大学生", "meaning": ["大学生"], "pronunc": ["dàxuéshenḡ"] }, + { "word": "大学生", "meaning": ["大学生"], "pronunc": ["dàxuéshēng"] }, { "word": "职员", "meaning": ["職員"], "pronunc": ["zhíyuán"] }, { "word": "小刘", "meaning": ["刘ちゃん(固有名詞)"], "pronunc": ["Xiǎo Liú"] }, { "word": "都", "meaning": ["みんな"], "pronunc": ["dōu"] }, @@ -87,7 +87,7 @@ function words() { { "word": "女儿", "meaning": ["娘"], "pronunc": ["nǚér"] }, { "word": "兄弟姐妹", "meaning": ["兄弟姉妹"], "pronunc": ["xiōngdìjiěmèi"] }, { "word": "刘燕", "meaning": ["刘燕(固有名詞)"], "pronunc": ["Liú Yàn"] }, - { "word": "吗", "meaning": ["~か?"], "pronunc": ["ma"] }, +// { "word": "吗", "meaning": ["~か?"], "pronunc": ["ma"] }, { "word": "田中明香", "meaning": ["田中明香(固有名詞)"], "pronunc": ["Tiánzhōng Míngxiāng"] }, { "word": "不", "meaning": ["~ない"], "pronunc": ["bù"] }, { "word": "这儿", "meaning": ["ここ"], "pronunc": ["zhèr"] }, @@ -106,7 +106,7 @@ function words() { { "word": "太", "meaning": ["とても"], "pronunc": ["tài"] }, { "word": "景山", "meaning": ["景山(固有名詞)"], "pronunc": ["Jǐngshān"] }, { "word": "故宫", "meaning": ["故宮(固有名詞)"], "pronunc": ["Gùgōng"] }, - { "word": "角楼", "meaning": ["隅櫓"], "pronunc": ["Jiǎolóu"] }, + { "word": "角楼", "meaning": ["隅櫓"], "pronunc": ["jiǎolóu"] }, { "word": "和", "meaning": ["~と"], "pronunc": ["hé"] }, { "word": "筒子河", "meaning": ["筒子河(固有名詞)"], "pronunc": ["Tǒngzihé"] }, { "word": "对了", "meaning": ["ところで"], "pronunc": ["Duì le"] }, @@ -124,7 +124,7 @@ function words() { { "word": "挺…的", "meaning": ["とても"], "pronunc": ["tǐng … de"] }, { "word": "太…了", "meaning": ["とても"], "pronunc": ["tài … le"] }, { "word": "有点儿", "meaning": ["ちょっと"], "pronunc": ["yǒudiǎnr"] }, - { "word": "的", "meaning": ["~の"], "pronunc": ["de"] }, +// { "word": "的", "meaning": ["~の"], "pronunc": ["de"] }, { "word": "这", "meaning": ["これ"], "pronunc": ["zhè"] }, { "word": "哪", "meaning": ["どれ"], "pronunc": ["nǎ"] }, { "word": "这个", "meaning": ["この"], "pronunc": ["zhège/zhèi ge"] }, @@ -182,7 +182,7 @@ function words() { { "word": "现在", "meaning": ["現在"], "pronunc": ["xiànzài"] }, { "word": "就", "meaning": ["すぐに"], "pronunc": ["jiù"] }, { "word": "带", "meaning": ["~を連れる"], "pronunc": ["dài"] }, - { "word": "吧", "meaning": ["~でしょう?", "~しましょう"], "pronunc": ["ba"] }, +// { "word": "吧", "meaning": ["~でしょう?", "~しましょう"], "pronunc": ["ba"] }, { "word": "里面", "meaning": ["中に"], "pronunc": ["lǐmiàn"] }, { "word": "有", "meaning": ["(~に~が)ある"], "pronunc": ["yǒu"] }, { "word": "小卖部", "meaning": ["小売店"], "pronunc": ["xiǎomàibù"] }, @@ -254,7 +254,7 @@ function words() { { "word": "商店", "meaning": ["お店"], "pronunc": ["shāngdiàn"] }, { "word": "公共汽车", "meaning": ["バス"], "pronunc": ["gōnggòngqìchē"] }, { "word": "做", "meaning": ["~をする"], "pronunc": ["zuò"] }, - { "word": "呢", "meaning": ["~だよね"], "pronunc": ["ne"] }, +// { "word": "呢", "meaning": ["~だよね"], "pronunc": ["ne"] }, { "word": "王府井", "meaning": ["王府井(固有名詞)"], "pronunc": ["Wángfǔjǐng"] }, { "word": "大街", "meaning": ["繁華街"], "pronunc": ["dàjiē"] }, { "word": "借", "meaning": ["~を借りる"], "pronunc": ["jiè"] }, @@ -404,7 +404,7 @@ function words() { { "word": "夜景", "meaning": ["夜景"], "pronunc": ["yèjǐng"] }, { "word": "古建筑", "meaning": ["昔の建築"], "pronunc": ["gǔ jiànzhù"] }, { "word": "鼓楼", "meaning": ["鼓楼"], "pronunc": ["Gǔlóu"] }, - { "word": "钟楼", "meaning": ["鐘楼"], "pronunc": ["Zhōnglóu"] }, + { "word": "钟楼", "meaning": ["鐘楼"], "pronunc": ["zhōnglóu"] }, { "word": "研究", "meaning": ["研究"], "pronunc": ["yánjiū"] }, { "word": "一大早", "meaning": ["朝早く"], "pronunc": ["yídàzǎo"] }, { "word": "已经", "meaning": ["すでに"], "pronunc": ["yǐjīng"] }, @@ -420,7 +420,7 @@ function words() { { "word": "一定", "meaning": ["きっと"], "pronunc": ["yídìng"] }, { "word": "隆福寺", "meaning": ["隆福寺(固有名詞)"], "pronunc": ["Lóngfúsì"] }, { "word": "小吃", "meaning": ["ちょっとした食事"], "pronunc": ["xiǎochī"] }, - { "word": "过 (アスペクト助詞)", "meaning": ["~したことがある"], "pronunc": ["guo"] }, +// { "word": "过 (アスペクト助詞)", "meaning": ["~したことがある"], "pronunc": ["guo"] }, { "word": "点", "meaning": ["~時"], "pronunc": ["diǎn"] }, { "word": "分", "meaning": ["~分"], "pronunc": ["fēn"] }, { "word": "钟", "meaning": ["鐘", "(~時)ちょうど"], "pronunc": ["zhōng"] }, @@ -531,7 +531,7 @@ function words() { { "word": "人力", "meaning": ["人力"], "pronunc": ["rénlì"] }, { "word": "建造", "meaning": ["~を建造する"], "pronunc": ["jiànzào"] }, { "word": "山", "meaning": ["山"], "pronunc": ["shān"] }, - { "word": "得", "meaning": ["(様態補語を伴う動詞に続く)"], "pronunc": ["de"] }, +// { "word": "得", "meaning": ["(様態補語を伴う動詞に続く)"], "pronunc": ["de"] }, { "word": "睡", "meaning": ["寝る"], "pronunc": ["shuì"] }, { "word": "高中", "meaning": ["高校"], "pronunc": ["gāozhōng"] }, { "word": "小时", "meaning": ["~時間"], "pronunc": ["xiǎoshí"] }, diff --git a/Kuli/style.css b/Kuli/style.css index eba880d..f136040 100644 --- a/Kuli/style.css +++ b/Kuli/style.css @@ -35,6 +35,29 @@ body { color: gold; } +#BGMButton { + font-family: 'Microsoft YaHei', sans-serif; + position: absolute; + display: block; + width: auto; + height: auto; + padding: 5px; + text-align: center; + border-radius: 2rem; + border: 3px solid gold; + background-color: red; + color: gold; + font-size: 4vh; + cursor: pointer; + user-select: none; + transition: all 0.3s; + box-shadow: 0 3px 5px rgba(0, 0, 0, .3); +} + +#BGMButton:hover{ + opacity: 0.6; +} + #ans_0 { width: 50%; height: 40%; @@ -92,7 +115,7 @@ body { text-align: left; border: 5px solid gold; background-color: red; - color:gold; + color:black; box-shadow: 0 3px 6px rgba(0, 0, 0, .4); }