Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김한준
/
OSS-Term-Project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김한준
2019-06-04 21:03:28 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d9705ef8264383471c91a8e1efeb2013d009f75e
d9705ef8
1 parent
0aaff3b8
주석 추가 및 손수익 기능 추가
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
26 deletions
css/style.css
js/main.js
public/index.html
css/style.css
View file @
d9705ef
...
...
@@ -56,12 +56,12 @@ body {
text-align
:
center
;
width
:
100%
;
position
:
absolute
;
top
:
calc
(
50
%
+
160px
);
top
:
calc
(
35
%
+
160px
);
}
#stats
progress
{
width
:
600px
;
max-width
:
calc
(
100
%
-
2em
);
max-width
:
calc
(
85
%
-
2em
);
}
#lottotable
{
...
...
@@ -73,7 +73,7 @@ body {
position
:
absolute
;
display
:
flex
;
flex-flow
:
wrap
;
top
:
calc
(
50
%
+
225px
);
top
:
calc
(
35
%
+
225px
);
counter-reset
:
li
;
overflow
:
hidden
;
}
...
...
@@ -191,7 +191,7 @@ body {
margin
:
auto
;
text-align
:
center
;
position
:
absolute
;
top
:
calc
(
50
%
-
100px
);
top
:
calc
(
35
%
-
100px
);
left
:
calc
(
50%
-
300px
);
transition
:
.25s
,
top
0s
;
}
...
...
@@ -202,7 +202,7 @@ body {
margin
:
auto
;
text-align
:
center
;
position
:
absolute
;
top
:
calc
(
85
%
-
100px
);
top
:
calc
(
70
%
-
100px
);
left
:
calc
(
50%
-
300px
);
transition
:
.25s
,
top
0s
;
font-size
:
20px
;
...
...
@@ -215,7 +215,7 @@ body {
margin
:
auto
;
text-align
:
center
;
position
:
absolute
;
top
:
calc
(
105
%
-
100px
);
top
:
calc
(
90
%
-
100px
);
left
:
calc
(
53%
-
300px
);
transition
:
.25s
,
top
0s
;
}
...
...
js/main.js
View file @
d9705ef
var
data
;
var
acum_list
=
new
Array
();
var
acum_list
=
new
Array
();
// 번호별 누적횟수를 구하기 위한 배열
for
(
i
=
0
;
i
<
45
;
i
++
){
acum_list
[
i
]
=
0
;
}
//회차별 당첨번호를 가지고 오기 위하여 테이블을 만들고 data를 가지고 오기 위해 주소를 변경하는 함수
$
(
document
).
ready
(
function
()
{
var
dropdown
=
$
(
'#selectBox'
);
var
form
=
$
(
'#form'
);
...
...
@@ -22,7 +23,9 @@ $(document).ready(function () {
alert
(
'뭔가 선택을 하세요.'
);
dropdown
.
focus
();
}
else
{
//회차별로 api에서 당첨번호를 끌어오기 위한 문자열 주소 조합
document
.
getElementById
(
"lotto_api_src"
).
src
=
"http://lotto.kaisyu.com/api?method=get&gno="
+
dropdown
.
val
()
+
";callback=loadlot"
;
//api에서 data를 끌어올때 최초 1회만 끌어올수 있는 문제를 해결하기 위한 방안
var
lotto_parent
=
document
.
getElementById
(
"lotto_api_data"
);
var
lotto_child
=
document
.
getElementById
(
"lotto_api_src"
);
lotto_child
.
remove
();
...
...
@@ -37,7 +40,7 @@ $(document).ready(function () {
});
//로또 번호 생성
function
dice
(
n
,
s
,
b
)
{
var
out
=
0
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
...
...
@@ -46,6 +49,7 @@ function dice(n, s, b) {
return
out
+
b
;
}
//로또 번호를 생성하고 번호별로 style을 주며 당첨등을 총괄하기 위한 함수
function
count
()
{
// console.log($('#inputnum').val());
...
...
@@ -179,6 +183,7 @@ function count() {
' | 4등: '
+
win4
+
"<span class='translation'>("
+
(
win4
/
list_length
*
100
).
toFixed
(
2
)
+
"%)</span>"
+
' | 5등: '
+
win5
+
"<span class='translation'>("
+
(
win5
/
list_length
*
100
).
toFixed
(
2
)
+
"%)</span>"
+
" | 총당첨율: "
+
((
win1
+
win2
+
win3
+
win4
+
win5
)
/
list_length
*
100
).
toFixed
(
2
)
+
"%"
+
" | 손수익 : "
+
(((
win1
*
2000000000
)
+
(
win2
*
50000000
)
+
(
win3
*
1000000
)
+
(
win4
*
50000
)
+
(
win5
*
5000
))
-
(
totalbuy
*
1000
)).
toFixed
(
0
)
+
"원"
+
'<br><progress value="'
+
list_length
+
'" max="'
+
totalbuy
+
'"></progress>'
);
$
(
'#lottotable'
).
append
(
'<li class="'
+
win_class
+
'">'
+
list
+
'</li>'
);
...
...
@@ -191,6 +196,7 @@ function count() {
}
//api로부터 당첨 data를 끌어오기 위한 함수
function
loadlot
(
a
)
{
$
(
"#lottok"
).
html
(
'제 '
+
a
.
gno
+
'회차 당첨 결과('
+
a
.
gdate
+
')'
);
// + '<br/>' +
//a.nums + a.bnum;
...
...
@@ -215,12 +221,13 @@ function loadlot(a) {
data
=
a
;
}
//생성한 번호별 누적횟수와 추천번호를 위한 함수
function
accumulate_number
()
{
/*
for(i=0;i<45;i++){
<-document.write((i+1)+"번 : "+acum_list[i]+"<br>");
}
*/
$
(
'#lottotable'
).
html
(
""
);
//초기화
$
(
'#accumulate_table'
).
html
(
""
);
//초기화
$
(
'#recom_table'
).
html
(
""
);
//초기화
var
temp
=
JSON
.
parse
(
JSON
.
stringify
(
acum_list
));
var
out_temp
=
JSON
.
parse
(
JSON
.
stringify
(
acum_list
));
...
...
@@ -265,9 +272,6 @@ function accumulate_number() {
$
(
'#lottotable'
).
html
(
""
);
//초기화
$
(
'#accumulate_table'
).
html
(
""
);
//초기화
var
list
=
""
;
var
num_class
=
"c2 "
;
...
...
@@ -294,11 +298,12 @@ function accumulate_number() {
}
//현재 보이는 화면을 초기화함과 동시에 누적번호 또한 초기화 하기 위한 함수
function
resets
()
{
$
(
'#lottotable'
).
html
(
""
);
//초기화
$
(
'#accumulate_table'
).
html
(
""
);
//초기화
$
(
'#recom_table'
).
html
(
""
);
$
(
'#stats'
).
html
(
""
);
$
(
'#recom_table'
).
html
(
""
);
//초기화
$
(
'#stats'
).
html
(
""
);
//초기화
for
(
i
=
0
;
i
<
45
;
i
++
){
acum_list
[
i
]
=
0
;
...
...
public/index.html
View file @
d9705ef
...
...
@@ -27,12 +27,10 @@
<div
class=
"col-xs-12"
>
<form
name=
"form"
id=
"form"
>
<div
class=
"form-group"
>
<label
for=
"selectBox"
>
몇 회차 로또 결과를 볼까요?
</label>
<select
id=
"selectBox"
name=
"selectBox"
class=
"form-control"
>
<option
value=
""
selected
disabled
>
선택하세요...
</option>
</select>
<label
for=
"selectBox"
>
회차별 당첨 번호
</label>
<select
id=
"selectBox"
name=
"selectBox"
class=
"form-control"
><option
value=
""
selected
disabled
>
선택
</option></select>
<button
class=
"btn btn-primary"
type=
"submit"
>
당첨 번호 보기
</button>
</div>
<button
class=
"btn btn-primary"
type=
"submit"
>
결과 보기
</button>
</form>
</div>
</div>
...
...
@@ -43,7 +41,7 @@
</div>
<p
style=
"position:absolute;top:calc(
50
% + 100px);width:100%;"
>
<p
style=
"position:absolute;top:calc(
35
% + 100px);width:100%;"
>
랜덤 번호 생성
<input
type=
"text"
id=
"inputnum"
value=
"5"
size=
"2"
>
번
<span
class=
"key"
onclick=
"count()"
>
시작
</span><span
class=
"key"
onclick=
"
accumulate_number()"
>
누적번호
&
번호추천
</span><span
class=
"key"
onclick=
"resets()"
>
초기화
</span>
</p>
...
...
@@ -61,7 +59,6 @@ accumulate_number()">누적번호&번호추천</span><span class="key" onclick="
</section>
<div
id=
"stats"
></div>
<ol
id=
"lottotable"
></ol>
<ol
id=
"accumulate_table"
></ol>
<ol
id=
"recom_table"
></ol>
...
...
Please
register
or
login
to post a comment