Showing
3 changed files
with
28 additions
and
26 deletions
... | @@ -56,12 +56,12 @@ body { | ... | @@ -56,12 +56,12 @@ body { |
56 | text-align: center; | 56 | text-align: center; |
57 | width: 100%; | 57 | width: 100%; |
58 | position: absolute; | 58 | position: absolute; |
59 | - top: calc(50% + 160px); | 59 | + top: calc(35% + 160px); |
60 | } | 60 | } |
61 | 61 | ||
62 | #stats progress { | 62 | #stats progress { |
63 | width: 600px; | 63 | width: 600px; |
64 | - max-width: calc(100% - 2em); | 64 | + max-width: calc(85% - 2em); |
65 | } | 65 | } |
66 | 66 | ||
67 | #lottotable { | 67 | #lottotable { |
... | @@ -73,7 +73,7 @@ body { | ... | @@ -73,7 +73,7 @@ body { |
73 | position: absolute; | 73 | position: absolute; |
74 | display: flex; | 74 | display: flex; |
75 | flex-flow: wrap; | 75 | flex-flow: wrap; |
76 | - top: calc(50% + 225px); | 76 | + top: calc(35% + 225px); |
77 | counter-reset: li; | 77 | counter-reset: li; |
78 | overflow: hidden; | 78 | overflow: hidden; |
79 | } | 79 | } |
... | @@ -191,7 +191,7 @@ body { | ... | @@ -191,7 +191,7 @@ body { |
191 | margin: auto; | 191 | margin: auto; |
192 | text-align: center; | 192 | text-align: center; |
193 | position: absolute; | 193 | position: absolute; |
194 | - top: calc(50% - 100px); | 194 | + top: calc(35% - 100px); |
195 | left: calc(50% - 300px); | 195 | left: calc(50% - 300px); |
196 | transition: .25s, top 0s; | 196 | transition: .25s, top 0s; |
197 | } | 197 | } |
... | @@ -202,7 +202,7 @@ body { | ... | @@ -202,7 +202,7 @@ body { |
202 | margin: auto; | 202 | margin: auto; |
203 | text-align: center; | 203 | text-align: center; |
204 | position: absolute; | 204 | position: absolute; |
205 | - top: calc(85% - 100px); | 205 | + top: calc(70% - 100px); |
206 | left: calc(50% - 300px); | 206 | left: calc(50% - 300px); |
207 | transition: .25s, top 0s; | 207 | transition: .25s, top 0s; |
208 | font-size : 20px; | 208 | font-size : 20px; |
... | @@ -215,7 +215,7 @@ body { | ... | @@ -215,7 +215,7 @@ body { |
215 | margin: auto; | 215 | margin: auto; |
216 | text-align: center; | 216 | text-align: center; |
217 | position: absolute; | 217 | position: absolute; |
218 | - top: calc(105% - 100px); | 218 | + top: calc(90% - 100px); |
219 | left: calc(53% - 300px); | 219 | left: calc(53% - 300px); |
220 | transition: .25s, top 0s; | 220 | transition: .25s, top 0s; |
221 | } | 221 | } | ... | ... |
1 | var data; | 1 | var data; |
2 | -var acum_list = new Array(); | 2 | + |
3 | +var acum_list = new Array(); // 번호별 누적횟수를 구하기 위한 배열 | ||
3 | for (i=0;i<45;i++){ | 4 | for (i=0;i<45;i++){ |
4 | acum_list[i]=0; | 5 | acum_list[i]=0; |
5 | } | 6 | } |
6 | 7 | ||
7 | 8 | ||
8 | - | 9 | +//회차별 당첨번호를 가지고 오기 위하여 테이블을 만들고 data를 가지고 오기 위해 주소를 변경하는 함수 |
9 | $(document).ready(function () { | 10 | $(document).ready(function () { |
10 | var dropdown = $('#selectBox'); | 11 | var dropdown = $('#selectBox'); |
11 | var form = $('#form'); | 12 | var form = $('#form'); |
... | @@ -22,7 +23,9 @@ $(document).ready(function () { | ... | @@ -22,7 +23,9 @@ $(document).ready(function () { |
22 | alert('뭔가 선택을 하세요.'); | 23 | alert('뭔가 선택을 하세요.'); |
23 | dropdown.focus(); | 24 | dropdown.focus(); |
24 | } else { | 25 | } else { |
26 | + //회차별로 api에서 당첨번호를 끌어오기 위한 문자열 주소 조합 | ||
25 | document.getElementById("lotto_api_src").src="http://lotto.kaisyu.com/api?method=get&gno="+dropdown.val()+";callback=loadlot"; | 27 | document.getElementById("lotto_api_src").src="http://lotto.kaisyu.com/api?method=get&gno="+dropdown.val()+";callback=loadlot"; |
28 | + //api에서 data를 끌어올때 최초 1회만 끌어올수 있는 문제를 해결하기 위한 방안 | ||
26 | var lotto_parent = document.getElementById("lotto_api_data"); | 29 | var lotto_parent = document.getElementById("lotto_api_data"); |
27 | var lotto_child=document.getElementById("lotto_api_src"); | 30 | var lotto_child=document.getElementById("lotto_api_src"); |
28 | lotto_child.remove(); | 31 | lotto_child.remove(); |
... | @@ -37,7 +40,7 @@ $(document).ready(function () { | ... | @@ -37,7 +40,7 @@ $(document).ready(function () { |
37 | }); | 40 | }); |
38 | 41 | ||
39 | 42 | ||
40 | - | 43 | +//로또 번호 생성 |
41 | function dice(n, s, b) { | 44 | function dice(n, s, b) { |
42 | var out = 0; | 45 | var out = 0; |
43 | for (i = 0; i < n; i++) { | 46 | for (i = 0; i < n; i++) { |
... | @@ -46,6 +49,7 @@ function dice(n, s, b) { | ... | @@ -46,6 +49,7 @@ function dice(n, s, b) { |
46 | return out + b; | 49 | return out + b; |
47 | } | 50 | } |
48 | 51 | ||
52 | +//로또 번호를 생성하고 번호별로 style을 주며 당첨등을 총괄하기 위한 함수 | ||
49 | function count() { | 53 | function count() { |
50 | // console.log($('#inputnum').val()); | 54 | // console.log($('#inputnum').val()); |
51 | 55 | ||
... | @@ -179,6 +183,7 @@ function count() { | ... | @@ -179,6 +183,7 @@ function count() { |
179 | ' | 4등: ' + win4 + "<span class='translation'>(" + (win4 / list_length * 100).toFixed(2) + "%)</span>" + | 183 | ' | 4등: ' + win4 + "<span class='translation'>(" + (win4 / list_length * 100).toFixed(2) + "%)</span>" + |
180 | ' | 5등: ' + win5 + "<span class='translation'>(" + (win5 / list_length * 100).toFixed(2) + "%)</span>" + | 184 | ' | 5등: ' + win5 + "<span class='translation'>(" + (win5 / list_length * 100).toFixed(2) + "%)</span>" + |
181 | " | 총당첨율: " + ((win1 + win2 + win3 + win4 + win5) / list_length * 100).toFixed(2) + "%" + | 185 | " | 총당첨율: " + ((win1 + win2 + win3 + win4 + win5) / list_length * 100).toFixed(2) + "%" + |
186 | + " | 손수익 : " + (((win1*2000000000)+(win2*50000000)+(win3*1000000)+(win4*50000)+(win5*5000))-(totalbuy*1000)).toFixed(0)+"원"+ | ||
182 | '<br><progress value="' + list_length + '" max="' + totalbuy + '"></progress>' | 187 | '<br><progress value="' + list_length + '" max="' + totalbuy + '"></progress>' |
183 | ); | 188 | ); |
184 | $('#lottotable').append('<li class="' + win_class + '">' + list + '</li>'); | 189 | $('#lottotable').append('<li class="' + win_class + '">' + list + '</li>'); |
... | @@ -191,6 +196,7 @@ function count() { | ... | @@ -191,6 +196,7 @@ function count() { |
191 | 196 | ||
192 | } | 197 | } |
193 | 198 | ||
199 | +//api로부터 당첨 data를 끌어오기 위한 함수 | ||
194 | function loadlot(a) { | 200 | function loadlot(a) { |
195 | $("#lottok").html('제 ' + a.gno + '회차 당첨 결과(' + a.gdate + ')'); // + '<br/>' + | 201 | $("#lottok").html('제 ' + a.gno + '회차 당첨 결과(' + a.gdate + ')'); // + '<br/>' + |
196 | //a.nums + a.bnum; | 202 | //a.nums + a.bnum; |
... | @@ -215,12 +221,13 @@ function loadlot(a) { | ... | @@ -215,12 +221,13 @@ function loadlot(a) { |
215 | data = a; | 221 | data = a; |
216 | } | 222 | } |
217 | 223 | ||
224 | +//생성한 번호별 누적횟수와 추천번호를 위한 함수 | ||
218 | function accumulate_number() { | 225 | function accumulate_number() { |
219 | -/* | 226 | + |
220 | - for(i=0;i<45;i++){ | 227 | + $('#lottotable').html(""); //초기화 |
221 | - <-document.write((i+1)+"번 : "+acum_list[i]+"<br>"); | 228 | + $('#accumulate_table').html(""); //초기화 |
222 | - } | 229 | + $('#recom_table').html(""); //초기화 |
223 | - */ | 230 | + |
224 | var temp= JSON.parse(JSON.stringify( acum_list )); | 231 | var temp= JSON.parse(JSON.stringify( acum_list )); |
225 | var out_temp= JSON.parse(JSON.stringify( acum_list )); | 232 | var out_temp= JSON.parse(JSON.stringify( acum_list )); |
226 | 233 | ||
... | @@ -265,9 +272,6 @@ function accumulate_number() { | ... | @@ -265,9 +272,6 @@ function accumulate_number() { |
265 | 272 | ||
266 | 273 | ||
267 | 274 | ||
268 | - $('#lottotable').html(""); //초기화 | ||
269 | - $('#accumulate_table').html(""); //초기화 | ||
270 | - | ||
271 | var list = ""; | 275 | var list = ""; |
272 | 276 | ||
273 | var num_class= "c2 "; | 277 | var num_class= "c2 "; |
... | @@ -294,11 +298,12 @@ function accumulate_number() { | ... | @@ -294,11 +298,12 @@ function accumulate_number() { |
294 | 298 | ||
295 | } | 299 | } |
296 | 300 | ||
301 | +//현재 보이는 화면을 초기화함과 동시에 누적번호 또한 초기화 하기 위한 함수 | ||
297 | function resets() { | 302 | function resets() { |
298 | $('#lottotable').html(""); //초기화 | 303 | $('#lottotable').html(""); //초기화 |
299 | $('#accumulate_table').html(""); //초기화 | 304 | $('#accumulate_table').html(""); //초기화 |
300 | - $('#recom_table').html(""); | 305 | + $('#recom_table').html(""); //초기화 |
301 | - $('#stats').html(""); | 306 | + $('#stats').html(""); //초기화 |
302 | 307 | ||
303 | for (i=0;i<45;i++){ | 308 | for (i=0;i<45;i++){ |
304 | acum_list[i]=0; | 309 | acum_list[i]=0; | ... | ... |
... | @@ -27,12 +27,10 @@ | ... | @@ -27,12 +27,10 @@ |
27 | <div class="col-xs-12"> | 27 | <div class="col-xs-12"> |
28 | <form name="form" id="form"> | 28 | <form name="form" id="form"> |
29 | <div class="form-group"> | 29 | <div class="form-group"> |
30 | - <label for="selectBox">몇 회차 로또 결과를 볼까요?</label> | 30 | + <label for="selectBox">회차별 당첨 번호</label> |
31 | - <select id="selectBox" name="selectBox" class="form-control"> | 31 | + <select id="selectBox" name="selectBox" class="form-control"><option value="" selected disabled>선택</option></select> |
32 | - <option value="" selected disabled>선택하세요...</option> | 32 | + <button class="btn btn-primary" type="submit">당첨 번호 보기</button> |
33 | - </select> | ||
34 | </div> | 33 | </div> |
35 | - <button class="btn btn-primary" type="submit">결과 보기</button> | ||
36 | </form> | 34 | </form> |
37 | </div> | 35 | </div> |
38 | </div> | 36 | </div> |
... | @@ -43,7 +41,7 @@ | ... | @@ -43,7 +41,7 @@ |
43 | </div> | 41 | </div> |
44 | 42 | ||
45 | 43 | ||
46 | - <p style="position:absolute;top:calc(50% + 100px);width:100%;"> | 44 | + <p style="position:absolute;top:calc(35% + 100px);width:100%;"> |
47 | 랜덤 번호 생성 <input type="text" id="inputnum" value="5" size="2">번 <span class="key" onclick="count()">시작</span><span class="key" onclick=" | 45 | 랜덤 번호 생성 <input type="text" id="inputnum" value="5" size="2">번 <span class="key" onclick="count()">시작</span><span class="key" onclick=" |
48 | accumulate_number()">누적번호&번호추천</span><span class="key" onclick="resets()">초기화</span> | 46 | accumulate_number()">누적번호&번호추천</span><span class="key" onclick="resets()">초기화</span> |
49 | </p> | 47 | </p> |
... | @@ -61,7 +59,6 @@ accumulate_number()">누적번호&번호추천</span><span class="key" onclick=" | ... | @@ -61,7 +59,6 @@ accumulate_number()">누적번호&번호추천</span><span class="key" onclick=" |
61 | </section> | 59 | </section> |
62 | 60 | ||
63 | <div id="stats"></div> | 61 | <div id="stats"></div> |
64 | - | ||
65 | <ol id="lottotable"></ol> | 62 | <ol id="lottotable"></ol> |
66 | <ol id="accumulate_table"></ol> | 63 | <ol id="accumulate_table"></ol> |
67 | <ol id="recom_table"></ol> | 64 | <ol id="recom_table"></ol> | ... | ... |
-
Please register or login to post a comment