My Lotto > JAVASCRIPT ONLY

본문 바로가기

사이트 내 전체검색

뒤로가기 JAVASCRIPT ONLY

My Lotto

페이지 정보

작성자 최고관리자 작성일 24-09-16 09:18 조회 57 댓글 0

본문

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="theme-color" content="#003152">
<meta http-equiv="imagetoolbar" content="no">
<meta property="og:image" content="https://blog.kakaocdn.net/dn/bB5fdX/btsEiVSs6YB/Pfsk3dlZHAvMZZ53SvgoxK/img.png">
<title>[ Lotto Editor ]</title>
</head>
<style>
@font-face { font-family:'NEXON Lv1 Gothic OTF'; src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/NEXON Lv1 Gothic OTF.woff') format('woff'); }
* { font-size:18px; font-family:'NEXON Lv1 Gothic OTF' !important; }
@media screen and (hover:none) and (pointer:coarse) { * { font-size:16px; } }
body::-webkit-scrollbar { width:10px; height:10px; }
body::-webkit-scrollbar-thumb { background-color:#003152; border-radius:10px; }
body::-webkit-scrollbar-track { background-color:#transparent; }
#lottoDiv { max-width:720px; margin:0 auto; }
#lottoTitle { color:#ffffff; font-weight:bold; background-color:#003152; text-align:center; margin-bottom:10px; padding:15px; }
#lotto45Div { box-sizing:border-box; border-top:1px solid #cccccc; }
#lotto45Div div { color:#000000; font-weight:bold; width:10%; float:left; text-align:center; padding:10px 0px; box-sizing:border-box; border-bottom:1px solid #cccccc; border-right:1px solid #cccccc; background-color:#eeeeee; cursor:pointer;  }
.lotto-left-border { border-left : 1px solid #cccccc; }
#lotto45Div input { color:#c00000; font-weight:bold; text-align:center; width:calc(20% - 1px); border:1px solid #cccccc; border-top:none; float:right; outline:none; padding:10px 0px; background-color:#f7d7e4; }
#lottoButton { color:#f9ee07; font-weight:bold; cursor:pointer; background-color:#900000; text-align:center; margin-top:10px; padding:15px;}
#lotto6sDiv { color:#0b3b0b; font-weight:bold; text-align:center; padding:15px; border:1px solid #cccccc; background-color:#d9eccc; box-sizing:border-box; }
#lotto6sDiv span { display:inline-block; text-align:center; color:#0b3861; font-weight:bold; width:9%; padding:1%; background-color:#d5e6f9; border:1px solid #ffffff; border-radius:10px; }
</style>
<body>
<div id="lottoDiv">
    <div id="lottoTitle">로또번호 추출기</div>
    <div id="lotto45Div"></div>
    <div id="lottoButton">로또번호 생성</div>
    <div id="lotto6sDiv">MADE by WITTAZZURRI</div>
</div>
<script>
function firstMade() {
    first = choiceLotto;
    for (i in first) {
        firstRandom = Math.floor(Math.random() * first.length);
        firstChange = first[firstRandom];
        first[firstRandom] = first[i];
        first[i] = firstChange; 
    }
    first = first.slice(0, 6).sort(function(...sort) { return sort[0] - sort[1]; });
}
for (lotto45 = 1; lotto45 <= 45; lotto45++) {
    if (lotto45 == 45) lotto45Div.innerHTML += "<div>" + lotto45 + "</div><input id='lastInput' value=5><input id='firstInput' style='color:#0b3861;background-color:#d5e6f9;border-right:none' value=5><br style='clear:both'>";
    else if (lotto45 % 10 == 1) lotto45Div.innerHTML += "<div class='lotto-left-border'>" + lotto45 + "</div>";
    else lotto45Div.innerHTML += "<div>" + lotto45 + "</div>";
}
for (choice of document.querySelectorAll("#lotto45Div div")) {
    choice.addEventListener("click", function() {
        if (this.style.fontWeight == "normal") {
            this.style.fontWeight = "bold";
            this.style.color = "#000000";
            this.style.backgroundColor = "#eeeeee";
        }
        else {
            this.style.fontWeight = "normal";
            this.style.color = "#cccccc";
            this.style.backgroundColor = "#ffffff";
        }
    });
}
function lastMade() {
    last = choiceLotto.filter(filter => !firstLotto.includes(filter));
    if (last.length < 6) {
        last = ["NO"];
        lastAuto = 1;
    }
    for (i in last) {
        lastRandom = Math.floor(Math.random() * last.length);
        lastChange = last[lastRandom];
        last[lastRandom] = last[i];
        last[i] = lastChange; 
    }
    last = last.slice(0, 6).sort(function(...sort) { return sort[0] - sort[1]; });
}
 document.querySelector("#lottoButton").addEventListener("click", function() {
    firstAuto= firstInput.value.trim();
    lastAuto = lastInput.value.trim();
    choiceLotto = [];
    for (choice of document.querySelectorAll("#lotto45Div div")) {
        if (choice.style.fontWeight != "normal") choiceLotto.push(choice.innerHTML);
    }
    for (firstLotto = [], j = 1; j <= firstAuto; j++) {
        firstMade();
        firstLotto = firstLotto.concat(first);
    }
    for (lastLotto = [], j = 1; j <= lastAuto; j++) {
        lastMade();
        lastLotto = lastLotto.concat(last);
    }
    totalLotto = firstLotto.concat(lastLotto);
    lotto6sDiv.innerHTML = "";
    lotto6sDiv.style.backgroundColor = "#ffffff";
    for (k in totalLotto) {
        if (k ==  totalLotto.length - 1) lotto6sDiv.innerHTML += "<span>" + totalLotto[k] + "</span>";
        else if (k ==  firstAuto * 6 - 1) lotto6sDiv.innerHTML += "<span>" +  totalLotto[k] + "</span><div style='height:10px'></div>";
        else if (k % 6 == 5) lotto6sDiv.innerHTML += "<span>" + totalLotto[k] + "</span><br>";
        else lotto6sDiv.innerHTML += "<span>" + totalLotto[k] + "</span>";
    }
    for (bg in document.querySelectorAll("#lotto6sDiv span")) {
        if (bg >  firstAuto * 6 - 1)  {
            document.querySelectorAll("#lotto6sDiv span")[bg].style.color = "#c00000";
            document.querySelectorAll("#lotto6sDiv span")[bg].style.backgroundColor = "#f7d7e4";
        }
    }
});
</script>
</body>
</html>
[ Lotto Editor ]
로또번호 추출기
로또번호 생성
MADE by WITTAZZURRI

댓글목록 0

등록된 댓글이 없습니다.


로또번호 만들기

Copyright © EGIS.KR All rights reserved.

사이트 정보

Kim's Company / CEO : Kimchulyong
Contact : kimchulyong100@gmail.com

PC 버전으로 보기