Files
2026-07-17 20:07:01 +09:00

106 lines
7.7 KiB
JavaScript

// fetch('history.json')
// .then(response => response.json())
// .then(data => {
// let jsonData = JSON.parse(data);
// console.log(jsonData.hello);
// })
// .catch(error => {
// console.error('Error reading the JSON file:', error);
// });
document.addEventListener('DOMContentLoaded', function () {
let oneToThree = ["낮", "논", "닭", "땀", "못", "빛", "솥", "짐", "턱", "코", "학", "회", "힘", "털", "칼", "춤", "칡", "죄", "값", "겁", "공", "너", "돌", "롤", "망", "벗", "실", "윷", "중", "초", "칼", "통", "폰", "홀", "검도", "결혼", "녹차", "나비", "행운", "등교", "루비", "만두", "무용", "박사", "보물", "사랑", "수리", "어깨", "역사", "윤곽", "자연", "저축", "졸업", "행복", "공간", "궁궐", "남자", "농심", "동심", "달력", "락스", "라임", "모집", "명동", "바람", "보정", "성종", "식기", "유행", "여우", "종점", "자리", "초코", "추위", "킬러", "콩밥", "틴더", "터널", "필적", "포도", "홍수", "형제", "자긍심", "전염병", "주인공", "칸막이", "친근감", "태양풍", "폐막식", "하반신", "황무지", "횡격막", "경기도", "농산물", "단백질", "대통령", "대장균", "동남아", "무기질", "오렌지", "캥거루", "칼국수", "거제도", "공유기", "네이버", "놀이터", "두리안", "달걀찜", "루시퍼", "롤리팝", "망아지", "메아리", "비비빅", "바밤바", "송중기", "성시경", "우리집", "아버지", "지킴이", "정관장", "청국장", "청록색", "큐피드", "코레일", "탕후루", "탕평책", "피해자", "폴라포", "헤이즈", "하르방"];
let fourToSix = ["어림짐작", "인문과학", "작심삼일", "착시효과", "중구난방", "천재지변", "팔방미인", "포화상태", "하루아침", "해수욕장", "허수아비", "홍익인간", "훈민정음", "거두절미", "대중교통", "두드러기", "만유인력", "물리화학", "가시광선", "고등학교", "가위눌림", "고기국수", "나무위키", "너비아니", "데리야끼", "도리토스", "라면사리", "롯데마트", "마음가짐", "모의재판", "보니하니", "바이올린", "세일즈맨", "삼단화환", "오징어회", "어버이날", "장례식장", "종종걸음", "초코머핀", "총알받이", "키득키득", "카이스트", "텔레토비", "토카토카", "피실험자", "페퍼로니", "호랑이굴", "하이마트", "우스갯소리", "청딱따구리", "크리스마스", "아르헨티나", "헌법재판소", "황소개구리", "게으름뱅이", "이데올로기", "순두부찌개", "대중목욕탕", "동음이의어", "프로그래밍", "정월대보름", "식기세척기", "지구온난화", "아이스크림", "오케스트라", "김치볶음밥", "최소공배수", "장수풍댕이", "괭이갈매기", "거짓말쟁이", "나이지리아", "나이팅게일", "담쟁이덩굴", "뒤치닥거리", "라티푼디움", "룩셈부르크", "막대그래프", "뮤직비디오", "바빌로니아", "바다코끼리", "산후조리원", "삼강행실도", "오므라이스", "오리온자리", "중모리장단", "증조할머니", "초코바나나", "초조대장경", "카트라이더", "카자흐스탄", "토이스토리", "타임스퀘어", "폴리에틸렌", "페이퍼타올", "하늘바라기", "하룻강아지", "어중이떠중이", "자이로스코프", "진인사대천명", "한해살이식물", "목도리도마뱀", "패러글라이딩", "자유의여신상", "콘트라베이스", "베이킹파우더", "에스컬레이터", "장대높이뛰기", "히말라야산맥", "나무아미타불", "스카치테이프", "아르키메데스", "조선왕조실록", "증조할아버지", "가시불가사리", "금메달리스트", "폭탄먼지벌레", "가슴지느러미", "가운뎃발가락", "고구마입벌레", "고리대급업자", "네안데르탈인", "뉴펀들랜드주", "덩굴무늬매듭", "덧치마저고리", "라스베이거스", "라이스페이퍼", "마다가스카르", "마이크로미터", "빨강불가사리", "브레인스토밍", "상정고금예문", "샌프란시스코", "아메리칸드림", "알렉산드리아", "작은할아버지", "전민변정도감", "청분홍메뚜기", "콤팩트디스크", "코니아일랜드", "타이포그래피", "트리케라톱스", "파운드케이크", "프랑켄슈타인", "피보나치수열"];
let words = [];
let currentIndex = 0;
let onecurrentIndex = 0;
let fourcurrentIndex = 0;
let wordsNumber = 10;
let interval = 2000; // 기본 시간 간격 (밀리초 단위)
let curEnd = 0;
const wordDisplay = document.getElementById('Word');
const startButton = document.getElementById('start');
const shuffleButton = document.getElementById('shuffleButton');
const intervalInput = document.getElementById('interval');
const wordNumberInput = document.getElementById('wordNumber');
const exportButton = document.getElementById('export');
shuffleButton.addEventListener('click', () => {
oneToThree = oneToThree.sort(() => Math.random() - 0.5);
fourToSix = fourToSix.sort(() => Math.random() - 0.5);
console.log('Mixed')
console.log(oneToThree);
console.log(fourToSix);
});
intervalInput.addEventListener('change', (e) => {
interval = e.target.value * 1000;
});
wordNumberInput.addEventListener('change', (e) => {
wordsNumber = e.target.value;
});
startButton.addEventListener('click', () => {
let shortLong = '';
let wordLength = document.getElementById('wordLength');
if (wordLength.options[wordLength.selectedIndex].value == 13) {
words = oneToThree;
curEnd = onecurrentIndex + Number(wordsNumber);
currentIndex = onecurrentIndex;
shortLong = '짧은';
} else {
words = fourToSix;
curEnd = fourcurrentIndex + Number(wordsNumber);
currentIndex = fourcurrentIndex;
shortLong = '긴';
}
document.getElementById('wordNumberValue').textContent = `${wordsNumber}개의 ${shortLong} 무작위 단어들이 제시됩니다.`;
document.getElementById('intervalValue').textContent = `단어당 제시되는 시간은 ${interval / 1000}초이며 후에 1초의 공백이 표시됩니다.`;
document.getElementById('settings').style.display = 'none';
document.getElementById('Intro').style.display = 'block';
wordDisplay.style.color = '#000000';
});
document.addEventListener('keydown', function (event) {
if (event.code === 'Space') {
test()
document.getElementById('Intro').style.display = 'none';
document.getElementById('Word').style.display = 'block';
console.log(words.slice(currentIndex, curEnd))
}
if (event.code === 'KeyR') {
document.getElementById('Word').style.display = 'none';
document.getElementById('settings').style.display = 'block';
}
});
const test = () => {
if (currentIndex == curEnd) {
wordDisplay.textContent = 'Finish';
wordDisplay.style.color = '#D1080B';
let wordLength = document.getElementById('wordLength');
if (wordLength.options[wordLength.selectedIndex].value == 13) {
onecurrentIndex = currentIndex;
} else {
fourcurrentIndex = currentIndex;
}
return
}
wordDisplay.textContent = words[currentIndex];
setTimeout(() => {
wordDisplay.textContent = '';
setTimeout(() => {
currentIndex += 1;
test();
}, 1000)
}, interval)
};
});