back.js
1 2 3 4 5 6 7 8 9 10 | window.onload=function(){ document.addEventListener('tizenhwkey', function(ev){ if(ev.keyName==='back'){//confirm when user click back key var re=confirm('아령하세요를 종료하시겠습니까?'); if(re==true){ tizen.application.getCurrentApplication().exit(); } } }); } | cs |
character.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | // Copyright 2011 William Malone (www.williammalone.com) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. var name_arr=[]; var i = 0; var value = 0; var canvas; //canvas요소 생성 var context; var images = {}; var totalResources = 7; //이미지의 총 개수 var numResourcesLoaded = 0; //현재 로드된 이미지의 개수 var fps = 30; //기본 프레임 var x=80,y=130; var breathInc = 0.1; //호흡의 빠르기를 지정 var breathDir = 1; //들숨인지 날숨인지 판별할 변수 var breathAmt = 0; //호흡의 총량을 결정할 변수 var breathMax = 2; //호흡의 max값을 결정할 변수 var breathInterval = setInterval(updateBreath, 1000 / fps); //숨을 쉬는 간격에 대한 변수 var area = 5; //window.open("workout.html?workout:"+name+"&sets:"+sets+"&reps:"+reps+"&weights:"+weights+"&rest_time:"+rest_time); var temp=location.href.split("?"); var data=temp[1].split(/:|&/);//data:workout,dumbbell-curl,sets,1,reps,2,weights,3,rest_time,10 var name=decodeURI(data[1]);//이전 페이지에서 인코딩되어서 넘어 온 한글을 디코딩해야 안깨짐 var sets=data[3]; var reps=data[5]; var weights=data[7]; var lev=weights*sets*reps; $(document).ready( prepareCanvas(document.getElementById("canvasDiv"), 250, 200)); function prepareCanvas(canvasDiv, canvasWidth, canvasHeight) //canvas를 준비하는 변수 { canvas = document.createElement('canvas'); //canva요소 생성 canvas.setAttribute('width', canvasWidth); //canvas의 넓이 canvas.setAttribute('height', canvasHeight); //canvas의 높이 canvas.setAttribute('id', 'canvas'); //canvas의 이름 canvasDiv.appendChild(canvas); //canvas의 요소를 그림 if(typeof G_vmlCanvasManager != 'undefined') { canvas = G_vmlCanvasManager.initElement(canvas); } context = canvas.getContext("2d"); // Grab the 2d canvas context if(lev<30){ loadImage("leftArm2"); loadImage("leg2"); loadImage("torso2"); loadImage("hair2"); loadImage("rightArm2"); loadImage("ld"); loadImage("ld2"); loadImage("ld3"); loadImage("ld4"); loadImage("ld5"); loadImage("ld6"); loadImage("ld7"); loadImage("ld8"); loadImage("ld9"); }else{ loadImage("leftArm2"); loadImage("thin_leg"); loadImage("thin_stomach"); loadImage("thin_head"); loadImage("rightArm2"); loadImage("ld"); loadImage("ld2"); loadImage("ld3"); loadImage("ld4"); loadImage("ld5"); loadImage("ld6"); loadImage("ld7"); loadImage("ld8"); loadImage("ld9"); } name_arr=["ld","ld2","ld3","ld4","ld5","ld6","ld7","ld8","ld9"]; } function loadImage(name) { //이미지를 불러올 함수 images[name] = new Image(); //새로운 이미지를 생성하고, 이미지 배열에 저장 images[name].onload = function() { //이미지를 준비 resourceLoaded(); //이미지에 대한 함수 } images[name].src = "images/" + name + ".png"; //이미지 배열에 불러온 이미지를 저장 } function resourceLoaded() { //이미지에 대한 함수 numResourcesLoaded += 1; //이미지를 불러오고 현재 이미지를 몇번째 불러오는지를 저장 if(numResourcesLoaded === totalResources) { //만약 6장 다 불러왔다면 setInterval(redraw, 1000 / fps); //이미지 배치 함수를 주기적으로 실행 } } function redraw() { //이미지의 배치에 대한 함수 canvas.width = canvas.width; // clears the canvas drawEllipse(x + 48, y + 23, 170 - breathAmt, 7); // Shadow if(lev<30){ context.drawImage(images["leftArm2"], x + 42, y - 55 - breathAmt); context.drawImage(images[name_arr[i]], x + 34, y - 122 - breathAmt); context.drawImage(images["leg2"], x + 5, y - 24); context.drawImage(images["torso2"], x+10 , y-60); context.drawImage(images["hair2"], x - 37, y - 130 - breathAmt); context.drawImage(images["rightArm2"], x - 10, y - 51 - breathAmt); }else{ context.drawImage(images["leftArm2"], x + 42, y - 55 - breathAmt); context.drawImage(images[name_arr[i]], x + 34, y - 122 - breathAmt); context.drawImage(images["thin_leg"], x + 5, y - 24); context.drawImage(images["thin_stomach"], x+10 , y-60); context.drawImage(images["thin_head"], x - 37, y - 130 - breathAmt); context.drawImage(images["rightArm2"], x - 10, y - 51 - breathAmt); } if (i >= 0 && value == 0){ i++; if(i == 8) value = 1; } if (i <= 8 && value == 1){ i--; if(i == 0) value = 0; } } function drawEllipse(centerX, centerY, width, height) { context.beginPath(); //그림을 그리기 위한 선언 context.moveTo(centerX, centerY - height/2); //지정한 위치로 포인터를 이동 //3차 베지에 곡선을 그림 context.bezierCurveTo( centerX + width/2, centerY - height/2, centerX + width/2, centerY + height/2, centerX, centerY + height/2); context.bezierCurveTo( centerX - width/2, centerY + height/2, centerX - width/2, centerY - height/2, centerX, centerY - height/2); context.fillStyle = "black"; //black으로 그린 부분을 채워줌 context.fill(); context.closePath(); } function updateBreath() { if (breathDir === 1) { // breath in breathAmt -= breathInc; //호홉의 총량에 호흡의 빠르기를 빼줌 if (breathAmt < -breathMax) { //호흡의 총량이 max값보다 작아진다면 breathDir = -1; //날숨으로 바꿈 } } else { // breath out breathAmt += breathInc; if(breathAmt > breathMax) { breathDir = 1; } } } | cs |
Chart.min.js
forWorkout.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | var adapter = tizen.bluetooth.getDefaultAdapter(); var addr; //window.open("workout.html?workout:"+name+"&sets:"+sets+"&reps:"+reps+"&weights:"+weights+"&rest_time:"+rest_time); var temp=location.href.split("?"); var data=temp[1].split(/:|&/);//data:workout,dumbbell-curl,sets,1,reps,2,weights,3,rest_time,10 var name=decodeURI(data[1]);//이전 페이지에서 인코딩되어서 넘어 온 한글을 디코딩해야 안깨짐 var sets=data[3]; var reps=data[5]; var weights=data[7]; var rest_time=data[9]; $("#name").html(name+'/'+weights+'kg'); $("#sets").html('/'+sets); $("#reps").html('/'+reps); $("#rest_time").html(rest_time+'초'); var count; var cur_sets=0; var cur_reps=0; var cur_rest_time=0; $("#cur_sets").html(cur_sets); $("#cur_reps").html(cur_reps); var listDeviceElement; var listDevice; var socket0; var blueClose; $("#con").click(function(){ addr = "20:15:03:02:62:01";//addr변수에 블루투스의 주소값 넣음 adapter.getDevice(addr, /*addr 주소를 갖는 블루투스 연결*/onDeviceReady, function(e){ alert('연결실패'); }); }) var set_done=function(){///운동 종료 시 지금까지의 데이터 서버로 전송. $.ajax({ type:'post', dataType:'json', url:'http://115.68.232.116/records/intensityUp.php', data:{ sets:cur_sets, reps:cur_reps, rest_time:cur_rest_time }, success:function(json){ if(json.res=='good'){ }else{ alert('DB 서버 오류'); } }, complete:function(){ }, error:function (jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error.\n' + jqXHR.responseText; } alert(msg); } }) }; var finish=function(){ $.ajax({ type:'post', dataType:'json', url:'http://115.68.232.116/records/intensityUp.php', data:{ sets:cur_sets, reps:cur_reps, rest_time:cur_rest_time }, success:function(json){ if(json.res=='good'){ }else{ alert('DB 서버 오류'); } }, complete:function(){ if(socket0!==undefined){ alert(socket0); blueClose=setInterval(function(){ socket0.close() },1000); } else{ location.replace("selection.html"); } }, error:function (jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error.\n' + jqXHR.responseText; } alert(msg); } }) }; var onSocketError = function(err){ alert('소켓에러 발생'); } var onSocketConnected = function(socket) { socket0=socket; console.log ("소켓이 연결됨"); socket.writeData([0]);//운동 시작 시 아두이노의 count값을 0으로 초기화 해줘야 함. alert('운동 시작!'); socket.onmessage=function(){ count=socket.readData();//아두이노에서 값 받아오기 cur_reps=count%reps; if((count!=0)&&(count%reps==0)){//지정된 반복 수만큼 운동했다면 cur_sets+=count/reps;//set에 반영 if(cur_sets>=sets){//현재 세트가 지정된 세트보다 같거나 크면 DB에 데이터 저장 후 종료 alert('수고하셨습니다.'); finish(); }else{ temp_time=rest_time; var rest_start=confirm('휴식 시작'); if(rest_start==true){ //rest_time만큼 휴식 취하게 하기. var timer=setInterval(function(){ $("#rest_time").html(temp_time-=1); if(temp_time==0){ clearInterval(timer); var rest_end=confirm('휴식 종료!'); if(rest_end==true){ //휴식 시간이 끝나면 count=0됨. $("#rest_time").html(rest_time); socket.writeData([0]);//아스키코드 48은 정수 0 } } },1000); cur_rest_time+=rest_time; } set_done(); } } $("#cur_sets").html(cur_sets); $("#cur_reps").html(cur_reps); }; socket.onclose = function() { clearInterval(blueClose); alert("기기가 종료되었습니다." + socket.peer.name); location.replace("selection.html"); }; }; onDeviceReady = function(device){ console.log(device); var uuids = "" + device.uuids; // string형태로 변경 if (device.uuids.indexOf(uuids) != -1) { device.connectToServiceByUUID(uuids, onSocketConnected, onSocketError ); } else{ alert("연결할수 없습니다.") } } onBondingSuccess = function(device){ console.log("-----") console.log(device); } //Initialize function var init = function () { // TODO:: Do your initialization job console.log("init() called"); listDeviceElement = document.getElementById("listDevice"); listDevice = tau.widget.Listview(listDeviceElement); tau.event.on(listDeviceElement, "tap", function(event){//탐색된 블루투스 클릭 시 alert('연결 중'); addr = event.target.getAttribute("deviceaddress");//addr변수에 블루투스의 주소값 넣음 adapter.getDevice(addr, /*addr 주소를 갖는 블루투스 연결*/onDeviceReady, function(e){ alert('연결실패'); }); }); document.addEventListener('tizenhwkey', function(ev){ if(ev.keyName==='back'){//confirm when user click back key var res=confirm('운동을 종료하시겠습니까?'); if(res==true){ finish(); } } }); }; $(document).bind( 'pageinit', init ); $(document).unload( unregister ); | cs |
goHome.js
1 2 3 4 5 6 7 8 | ( function () { window.addEventListener( 'tizenhwkey', function( ev ) { if( ev.keyName === "back" ) { location.replace("index.html"); //window.location="index.html"; } } ); } () ); | cs |
goSelection.js
1 2 3 4 5 6 7 8 | window.onload=function(){ document.addEventListener('tizenhwkey', function(ev){ if(ev.keyName==='back'){//confirm when user click back key screen.lockOrientation("portrait-primary"); location.replace('selection.html'); } }); } | cs |
goSignIn.js
1 2 3 4 5 6 7 8 9 | window.onload=function(){ $('#logout').click(function(){ var re=confirm('로그아웃 하시겠습니까?'); if(re==true){ //disconnect session of server. location.replace('signIn.html'); } }); } | cs |
loginAndWorkout.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | $(function(){ var memberId = $('#memberId'); var memberPw = $('#memberPw'); var btn = $('#sbmt'); btn.click(function(){ console.log(memberId.val()); $.ajax({ type: 'post', dataType: 'json', url: 'http://115.68.232.116/member/loginsuc.php', data: {memberId: memberId.val(),memberPw: memberPw.val()}, success: function (json) { if(json.res == 'good') { console.log(json.res); location.replace("selection.html"); //tau.changePage("selection.html"); //페이지 전환 시 이렇게 해야 함. TAU lib 없으면 }else{ alert("아이디 또는 비밀번호가 일치하지 않습니다."); } }, error: function(){ console.log('failed'); } }) }); }); | cs |
mainToSignInSignUp.js
1 2 3 4 5 6 7 8 9 10 | $(function(){ var btn = $('#signUp'); btn.click(function(){ location.replace("signUpForm.html"); }); var btn = $('#signIn'); btn.click(function(){ location.replace("signIn.html"); }); }); | cs |
myDateRecord.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | 'use strict'; var year,month,day,r,i,j; $.stack=function(){ year = $("#yearselect").val(); month = $("#monthselect").val(); $.ajax({ type: 'post', dataType: 'json', url: 'http://115.68.232.116/records/stackBar.php', //doDumbbells DB에 접근해서 ID에 맞는 정보 검색 data:{ year : year, month : month }, success : function(result) { if(result.success == false) { alert(result.msg); return; }else if(result.notnull!=true){//빈 데이터 alert('결과 값이 없습니다.'); var stackCanvas=document.getElementById('canvas'); var ctx=stackCanvas.getContext('2d');//chart 그리기 위한 canvas window.myBar = new Chart(ctx, { type: 'bar', data: {}, options: { title: { display: true, text: '월별 운동 기록' }, tooltips: {//Print info during hover mode: 'index', intersect: false }, responsive: true, scales: { xAxes: [{ stacked: true, }], yAxes: [{ stacked: true }] } } }); var newDataset = { label: [],//운동 각각 하나 backgroundColor : [],//색깔 변하게 data: [] //날짜마다 수행한 운동 값, 운동 안했으면 0 }; barChartData.datasets.push(newDataset); ctx.clearRect(0,0,1000,1000); window.myBar.update();//chart 갱신 }else{ r=result; i=0,j=0; var days=[]; var uniquedays=[]; var color=[]; var workouts=[]; var uniqueworkouts=[]; var done=[]; var c = ['rgb(255, 99, 132)', //red 'rgb(255, 159, 64)', //orange 'rgb(255, 205, 86)', //yellow 'rgb(75, 192, 192)', //green 'rgb(54, 162, 235)', //blue 'rgb(153, 102, 255)', //purple 'rgb(201, 203, 207)' //grey ]; while(result[i]){//서버에서 가져온 data를 알맞게 배열에 넣음 days.push(result[i][7]); workouts.push(result[i][0]); done.push(parseInt(result[i][1]) * parseInt(result[i][2]) * parseInt(result[i][3])); color.push(c[i]); i+=1; } $.each(workouts,function(i,el){ if($.inArray(el,uniqueworkouts)===-1)uniqueworkouts.push(el); }); $.each(days,function(i,el){ if($.inArray(el,uniquedays)===-1)uniquedays.push(el);//배열 내에 el과 일치하는 값을 찾지 못하면 uniquedays에 날짜 삽입 }); var thirtyone=[]; for(i=0;i<31;i++){ thirtyone.push(i+1); } var barChartData = {//Schema for bar chart. labels:thirtyone, datasets:[ ] }; //var ctx = document.getElementById('canvas').getContext('2d');//chart 그리기 위한 canvas var stackCanvas=document.getElementById('canvas'); var ctx=stackCanvas.getContext('2d');//chart 그리기 위한 canvas window.myBar = new Chart(ctx, { type: 'bar', data: barChartData,//위에서 설정한 object options: { title: { display: true, text: year+'년'+month+'월 운동 기록(세트 기준)' }, tooltips: {//Print info during hover mode: 'index', intersect: false }, responsive: true, scales: { xAxes: [{ stacked: true, }], yAxes: [{ stacked: true }] } } }); i=0; var d; var w; var count=0; var workset=[]; var worksets=[]; var k; while(w=uniqueworkouts[i]){//운동 하나 선택 j=0; workset=[]; //운동 값 for(k=0;k<31;k++){ workset[k]=0; } while(result[j]){ //운동 기록 탐색 if(w==result[j][0]){//운동이 같다면 workset[result[j][7]-1]+=parseInt(result[j][1]);//차트상 day에 set 넣기 } j+=1; } var newDataset = { label: uniqueworkouts[i],//운동 각각 하나 backgroundColor : color[i],//색깔 변하게 data: workset //날짜마다 수행한 운동 값, 운동 안했으면 0 }; barChartData.datasets.push(newDataset); i+=1; } ctx.clearRect(0,0,1000,1000); window.myBar.update();//chart 갱신 } }, error : function(xhr,status,error){ alert(error); } }) } $.doughnut=function(){ var result=[]; var arr=[]; var arr2=[]; var i=0; var back_color = ["#F7464A","#46BFBD","#FDB45C","#E92B9E","#5FD3E8","#4861E8", "#A4647F","#D8E55D","#7B82E1","#C54DBF","#BA23CF","#123456","#789ABC"];//일단 색 6개만.. var bc = []; day = $("#day").val(); i=0; while(r[i]){ if(day==r[i][7]){//사용자가 선택한 날짜와 일치하는 데이터를 result에 넣기 result[i]=r[i]; } i+=1; } for(var j=0;j<i;j++){ if(result[j]!=null || result[j]!=undefined){ arr.push(parseInt(result[j][1])*parseInt(result[j][2])*parseInt(result[j][3])*0.01); arr2.push(String(result[j][0])+': '+String(result[j][1])+'세트 '+String(result[j][2])+'회 '+String(result[j][3])+'kg' +'시작'+String(result[j][4])+'종료'+String(result[j][5])+'운동시간'+String(result[j][6])+'환산 점수 '); } } var j=0; while(j<i){ bc.push(back_color[j]);//bc 배열에 색깔 집어 넣기 j+=1; } var config = { type: 'pie', data: { datasets: [{ data: arr,//그래프 그릴 때 쓰는 실제 값 backgroundColor: bc, label: 'Dataset 1' }, ], labels: //운동 종목,세트,반복 횟수,무게 등의 정보 arr2 }, options: { responsive: true, legend: { position: "top", }, title: { display: true, text:year+'년 '+month+'월 '+day+"일의 기록" } } }; var dn = document.getElementById("mychart").getContext("2d"); window.myDoughnut = new Chart(dn, config); dn.clearRect(0,0,1000,1000); window.myDoughnut.update(); } setTimeout(function(){ screen.lockOrientation("landscape-primary"); }, 1); | cs |
mySignInForm.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | var incheckSubmit=function (){ var memberId = $('#memberId'); var memberPw = $('#memberPw'); if(memberId.val() == ''){ alert('아이디를 입력해 주세요.'); return false; } if(memberPw.val() == ''){ alert('비밀번호를 입력해 주세요.'); return false; } return true; } | cs |
mySignUpForm.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | $(function(){ var memberIdCheck = $('.memberIdCheck'); var memberId = $('#memberId'); var memberIdComment = $('.memberIdComment'); var memberPw = $('#memberPw'); var memberPw2 = $('#memberPw2'); var memberPw2Comment = $('.memberPw2Comment'); var memberNickName = $('#memberNickName'); var memberNickNameComment = $('.memberNickNameComment'); var memberEmailAddress = $('#memberEmailAddress'); var memberEmailAddressComment = $('.memberEmailAddressComment'); var memberBirthDay = $('#memberBirthDay'); var memberBirthDayComment = $('.memberBirthDayComment'); var idCheck = $('#idCheck'); var pwCheck2 = $('#pwCheck2'); var eMailCheck = $('.eMailCheck'); memberIdCheck.click(function(){ console.log(memberId.val()); $.ajax({ type: 'post', dataType: 'json', url: 'http://115.68.232.116/member/memberIdCheck.php', data: {memberId: memberId.val()}, success: function (json) { if(json.res == 'good') { console.log(json.res); memberIdComment.text('사용가능한 아이디 입니다.'); idCheck.val('1'); }else{ memberIdComment.text('다른 아이디를 입력해 주세요.'); memberId.focus(); } }, error: function(){ console.log('failed'); } }) }); //비밀번호 동일 한지 체크 memberPw2.blur(function(){ if(memberPw.val() == memberPw2.val()){ memberPw2Comment.text('비밀번호가 일치합니다.'); pwCheck2.val('1'); }else{ memberPw2Comment.text('비밀번호가 일치하지 않습니다.'); } }); //이메일 유효성 검사 memberEmailAddress.blur(function(){ var regex=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/; if(regex.test(memberEmailAddress.val()) === false){ memberEmailAddressComment.text('이메일이 유효성에 맞지 않습니다.'); eMailCheck.val('1'); }else{ memberEmailAddressComment.text('올바른 이메일 입니다.'); } }); }); function checkSubmit(){ var idCheck = $('#idCheck'); var pwCheck2 = $('#pwCheck2'); var eMailCheck = $('.eMailCheck'); var memberBirthDay = $('#memberBirthDay'); var memberNickName = $('#memberNickName'); var memberName = $('#memberName'); if(idCheck.val() == '1'){ res = true; }else{ res = false; } if(pwCheck2.val() == '1'){ res = true; }else{ res = false; } if(eMailCheck.val() == '1'){ res = true; }else{ res = false; } if(memberName.val() != ''){ res = true; }else{ res = false; } if(memberBirthDay.val() != ''){ res = true; }else{ res = false; } if(memberNickName.val() != ''){ res = true; }else{ res = false; } if(res == false){ alert('회원가입 폼을 정확히 채워 주세요.'); } return res; } | cs |
myWoRecord.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | $.showUser = function(workout){ var obj; var i; $.ajax({ type: 'post', dataType: 'json', url: 'http://115.68.232.116/records/womyrec.php', //doDumbbells DB에 접근해서 ID에 맞는 정보 검색 data:{ workout : workout }, success : function(result) { if(result.success == false) { alert(result.msg); return; }else{ i=0; var tbl = ""; tbl += '<table border=1 class="table"><thead class="thead-dark"><tr><th>date</th><th>sets</th><th>reps</th><th>weight</th></tr></thead>'; while(result[i]){ tbl += '<tr><td>'+result[i].date+'</td><td>'+result[i].sets+'</td><td>'+result[i].reps+'</td><td>'+result[i].weight+'</td></tr>'; i++; } tbl += '</table>' document.getElementById("txtHint").innerHTML = tbl; } }, error : function(xhr,status,erre){ alert(error); } }) } | cs |
sendAndMove.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | $(function(){ var btn = $('#toBlueHtml'); btn.click(function(){ var workout=$('input[name="workout"]:checked').val(); var name=$('input[name="workout"]:checked').data("wo"); var sets=$('#sets').val(); var reps=$('#reps').val(); var weights=$('#weights').val(); var rest_time=$('#rest_time option:selected').val(); $.ajax({ type:'post', dataType:'json', url:'http://115.68.232.116/records/setting.php', data:{ workout:workout, sets:sets, reps:reps, weights:weights, rest_time:rest_time }, success:function(json){ if(json.res=='good'){ //workout.html이라는 문서를 열고 키:값을 넘겨준다. window.open("workout.html?workout:"+name+"&sets:"+sets+"&reps:"+reps+"&weights:"+weights+"&rest_time:"+rest_time); }else{ alert('DB 서버 오류'); } }, error:function(){ alert('error'); console.log('error workout.html'); } }) }); }); | cs |
slct.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | var workout="?"; var sets="?"; var reps="?"; var weight="?"; var rest_time='?'; function confirm(){ //workout = $("input[name=workout]:checked").val(); workout = $("input[name=workout]:checked").data("wo"); sets = $("#sets").val(); reps = $("#reps").val(); weight = $("#weights").val(); rest_time=$("#rest_time option:selected").val(); document.getElementById("prnt").innerHTML=workout+" => "+" 세트:"+sets+" 반복:"+reps+" 무게:"+weight+" 쉬는 시간:"+rest_time+"초"; } | cs |
woRank.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | //'use strict'; $(function(){ //화면을 가로로 setTimeout(function(){ screen.lockOrientation("landscape-primary"); }, 1); $.rank=function(){ var year,month,workout,i=0; year = $("#yearselect").val(); month = $("#monthselect").val(); workout = $("#workoutselect").val(); $.ajax({ type:'post', dataType:'json', url:'http://115.68.232.116/records/monthrank.php', data:{ year:year, month:month, workout:workout }, success:function(result){ if(result.success == false){ alert(result.msg); return; } var tbl="" tbl+='<table border=1 class="table"><thead class="thead-dark"><tr><th>Rank</th><th>Nickname</th><th>Sets</th><th>Reps</th><th>Weight</th><th>Point</th><th>Date</th></tr></thead>'; while(result[i]){ tbl+='<tr><td>'+result[i][0]+'</td><td>'+result[i][1]+'</td><td>'+result[i][3]+'</td><td>'+result[i][4]+'</td><td>' +result[i][5]+'</td><td>'+result[i][6]+'</td><td>'+result[i][7]; i+=1; } tbl+='</table>' document.getElementById("tbl").innerHTML=tbl; }, error:function (jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error.\n' + jqXHR.responseText; } alert('msg:'+msg); } }) } }) | cs |
'졸업작품' 카테고리의 다른 글
타이젠 웹 앱 CSS (0) | 2018.11.09 |
---|---|
타이젠 웹 앱 HTML (0) | 2018.11.09 |
타이젠 웹 앱 실행 화면 (0) | 2018.11.09 |
리눅스 Database (0) | 2018.11.09 |
리눅스 PHP 파일, 코드 (0) | 2018.11.08 |