$(document).ready(function(){ var game_tr = $('tr.gamelist_row'); game_tr.each(function (index,tr) { var this_class = $(this).attr('datateam_h'); var this_ports = $(this).attr('datasports'); var cnt_class = $('.game_list_table tr[datateam_h="'+this_class+'"][datasports="'+this_ports+'"]').length; if (cnt_class>1) { cnt_class = cnt_class-1; $(this).find('.plus_count').text("+"+cnt_class); }; }) }); $(function(){ $('.plus_count').on('click',function(){ var this_class = $(this).attr('data-hn'); var this_ports = $(this).attr('data-sn'); var this_display = $('.game_list_table tr.notShow_gamelist_row[datateam_h="'+this_class+'"][datasports="'+this_ports+'"]').css('display'); if (this_display !='none') { $('.game_list_table tr.notShow_gamelist_row[datateam_h="'+this_class+'"][datasports="'+this_ports+'"]').css('display','none'); $(this).text($(this).text().replace("-","+")); }else{ $('.game_list_table tr.notShow_gamelist_row[datateam_h="'+this_class+'"][datasports="'+this_ports+'"]').css('display','table-row'); $(this).text($(this).text().replace("+","-")); } }); }); function resetGameBoxPosition(){ console.log($('#gameBoxCheckBox').prop("checked")); $("#anchor").animate({ top : '0px' }, 1); } function cartMove() { var timer = null; return function(){ if(timer) { clearTimeout(timer) } timer = setTimeout(function(){ fooScroll() },100); } } function fooScroll(){ //console.log("start now"); //console.log($('#gameBoxCheckBox').val()); if (!$('#gameBoxCheckBox').prop("checked")) { var top = document.documentElement.scrollTop == 0 ? document.body.scrollTop : document.documentElement.scrollTop; if (top > 430) { $("#anchor").animate({ top : top - 60 + 'px' }, 1); } else { $("#anchor").animate({ top : '0px' }, 1); } }else{ $("#anchor").animate({ top : '0px' }, 1); } } function onMouseOverBar(obj) { if ($(obj).hasClass("defultState")) { $(obj).addClass("onState"); $(obj).removeClass("defultState"); } } function onMouseOutBar(obj) { if ($(obj).hasClass("onState")) { $(obj).addClass("defultState"); $(obj).removeClass("onState"); } } function selectGameToCart(obj, gameId, betLocaltion) { if($("#isBetting").val()==0){ $("#isBetting").val(1); if ($(obj).attr("id").indexOf("teamOne") > -1) { $("#teamCenter" + gameId).addClass("defultState"); $("#teamCenter" + gameId).removeClass("betState"); $("#teamTwo" + gameId).addClass("defultState"); $("#teamTwo" + gameId).removeClass("betState"); } if ($(obj).attr("id").indexOf("teamCenter") > -1) { $("#teamOne" + gameId).addClass("defultState"); $("#teamOne" + gameId).removeClass("betState"); $("#teamTwo" + gameId).addClass("defultState"); $("#teamTwo" + gameId).removeClass("betState"); } if ($(obj).attr("id").indexOf("teamTwo") > -1) { $("#teamCenter" + gameId).addClass("defultState"); $("#teamCenter" + gameId).removeClass("betState"); $("#teamOne" + gameId).addClass("defultState"); $("#teamOne" + gameId).removeClass("betState"); } if ($(obj).hasClass("onState")) { $(obj).addClass("betState"); $(obj).removeClass("onState"); } else if ($(obj).hasClass("betState")) { $(obj).addClass("onState"); $(obj).removeClass("betState"); } var uId = $("#userId").val(); betCartDwr.selectGameToCartDwr(uId, gameId, betLocaltion, function(data) { selectGameToCartCallBack(data, obj,uId, gameId); }); } } function selectGameToCartCallBack(data, obj,uId, gameId) { var opAndJson = data.split(",|,"); var op = opAndJson[0]; if (op.indexOf("add") > -1) { var json = opAndJson[1]; var jsonString = eval(json); var htmlText = ""; for ( var i = 0; i < jsonString.length; i++) { htmlText += "
"; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += "
" + jsonString[i]["teamOneName"]+ "취소
" + jsonString[i]["teamTwoName"]+ ""; htmlText += jsonString[i]["betPeiLv"]; if(jsonString[i]["localtion"]==1){ htmlText += "(홈)"; } if(jsonString[i]["localtion"]==2){ htmlText += "(무)"; } if(jsonString[i]["localtion"]==3){ htmlText += "(원)"; } htmlText += "";//oneBetPeiLv htmlText += ""; htmlText += "";//localtion htmlText += "";//teamOneBenefit htmlText += "";//teamTwoBenefit htmlText += "";//betHandicap htmlText += "";//betDrawBenefit htmlText += "
"; htmlText += "
"; } $('#betCartBox').append(htmlText); var good = $(obj), goodLeft = good.offset().left, goodTop = good.offset().top; var copyGood = good.clone(); var shopCar = $("#betFaker").offset(); $('body').append(copyGood); copyGood.css( { position : 'absolute', left : goodLeft, top : goodTop }); copyGood.animate( { width : 20, height : 20, left : shopCar.left, top : shopCar.top, opacity : 0.5 }, 400, function() { copyGood.remove(); }); } if (op.indexOf("loginError") > -1) { alert(op.split(",")[1]); window.location.href = "index.jsp"; } if (op.indexOf("gameIsCanNotBet") > -1) { alert(op.split(",")[1]); window.location.reload(); } if (op.indexOf("sportBlackWallError") > -1) { alert(op.split(",")[1]); $(obj).addClass("defultState"); $(obj).removeClass("betState"); } if (op.indexOf("error") > -1) { alert(op.split(",")[1]); $(obj).addClass("defultState"); $(obj).removeClass("betState"); //window.location.href = "index.jsp"; } if (op.indexOf("delete") > -1) { $("#oneBet" + op.split(",")[1]).remove(); } if (op.indexOf("update") > -1) { var json = opAndJson[1]; var jsonString = eval(json); var htmlText = ""; for ( var i = 0; i < jsonString.length; i++) { htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += "
" + jsonString[i]["teamOneName"]+ "취소
" + jsonString[i]["teamTwoName"]+ ""; htmlText += jsonString[i]["betPeiLv"]; if(jsonString[i]["localtion"]==1){ htmlText += "(홈)"; } if(jsonString[i]["localtion"]==2){ htmlText += "(무)"; } if(jsonString[i]["localtion"]==3){ htmlText += "(원)"; } htmlText += "";//oneBetPeiLv htmlText += ""; htmlText += "";//localtion htmlText += "";//teamOneBenefit htmlText += "";//teamTwoBenefit htmlText += "";//betHandicap htmlText += "";//betDrawBenefit htmlText += "
"; } $('#oneBet' + op.split(",")[1]).html(htmlText); } var betTableCount = $(".oneGameDiv table").length; if($("#extraOddId").length>0){ var needBetCount = parseInt($("#needBetCountInput").val()); var extraOddId = $("#extraOddId").val(); if(betTableCount0){ openBetting(); } if(betTableCount<1){ close_icon(); } } function selectExtraOddsToCart(obj,extraOdds,extraOddId){ var betTableCount = $(".oneGameDiv table").length; var needBetCount = parseInt($("#needBetCount"+extraOddId).val()); if($("#sumBenefit").val()>=extraOdds){ if(betTableCount>=needBetCount){ if($(".oneExtraOddDiv").size()>0){ if($("#extraOddsDiv"+extraOddId).length > 0){ $(obj).addClass("onState"); $(obj).removeClass("betState"); $("#extraOddsDiv"+extraOddId).remove(); }else{ alert("보너스배당은 하나만 선택하실수 있습니다"); } }else{ if ($(obj).hasClass("onState")) { $(obj).addClass("betState"); $(obj).removeClass("onState"); } else if ($(obj).hasClass("betState")) { $(obj).addClass("onState"); $(obj).removeClass("betState"); } var htmlText = ""; htmlText += "
"; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += ""; htmlText += "
E" + "보너스" + ""; htmlText += extraOdds; htmlText += "";//oneBetPeiLv htmlText += "";//oneBetPeiLv htmlText += "";//oneBetPeiLv htmlText += "
"; htmlText += "
"; $('#betCartBox').append(htmlText); } var good = $(obj), goodLeft = good.offset().left, goodTop = good.offset().top; var copyGood = good.clone(); var shopCar = $("#betFaker").offset(); $('body').append(copyGood); copyGood.css( { position : 'absolute', left : goodLeft, top : goodTop }); copyGood.animate( { width : 20, height : 20, left : shopCar.left, top : shopCar.top, opacity : 0.5 }, 400, function() { copyGood.remove(); }); }else{ alert("해당 보너스는 '"+needBetCount+"' 폴더이상 조합하셔야 이용가능합니다"); } }else{ alert("선택경기 총배당이 보너스 배당보다 작으므로 베팅불가합니다"); } changeSumBenefit(); } function removeBetCar(uId,gameId){ betCartDwr.removeBetCar(uId, gameId, function() { removeBetCarCallBack(gameId); }); } function removeBetCarCallBack(gameId){ if ($("#teamCenter" + gameId).hasClass("betState")) { $("#teamCenter" + gameId).addClass("defultState"); $("#teamCenter" + gameId).removeClass("betState"); } if ($("#teamOne" + gameId).hasClass("betState")) { $("#teamOne" + gameId).addClass("defultState"); $("#teamOne" + gameId).removeClass("betState"); } if ($("#teamTwo" + gameId).hasClass("betState")) { $("#teamTwo" + gameId).addClass("defultState"); $("#teamTwo" + gameId).removeClass("betState"); } $("#oneBet" + gameId).remove(); var betTableCount = $(".oneGameDiv table").length; if($("#extraOddId").length>0){ var needBetCount = parseInt($("#needBetCountInput").val()); var extraOddId = $("#extraOddId").val(); if(betTableCount= 0; i--) { if ((newStr.length - i) % 4 == 0) { newStr[i] = ","; } else { newStr[i] = strArray[currentIndex--]; } } var newMoney = newStr.join(""); if (newMoney.indexOf(",") == 0) { newMoney = newMoney.replace(",", ""); } return newMoney; } function checkMoney(){ var betMoneyNumber=parseInt($("#betMoneyTxt").val().replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"")); var maxBetMoneyNumber = parseInt($("#maxBetMoney").val()); var minBetMoneyNumber = parseInt($("#minBetMoney").val()); var maxGetMoneyNumber = parseInt($("#maxGetMoney").val()); var userHaveMoneyNumber = parseInt($("#userHaveMoney").val()); if(betMoneyNumber>userHaveMoneyNumber){ alert("배팅하신 금액이 현보유머니를 초과하였습니다 배팅불가합니다"); } if(($("#sumBenefit").val()*10000)*betMoneyNumber/10000>maxGetMoneyNumber){ var betMoneyTeam = maxGetMoneyNumber/$("#sumBenefit").val(); betMoneyTeam = parseInt(parseInt(betMoneyTeam)/100)*100; if(betMoneyTeam1){ if(money==2){ inputMoney=maxBetMoneyNumber; }else if(money==2){ inputMoney=minBetMoneyNumber; } }else{ if(money==2){ inputMoney=danYaMaxBetMoney; }else if(money==2){ inputMoney=danYaMinBetMoney; } } var betMoneyNumber = parseInt(inputMoney); $("#betMoneyTxt").val(betMoneyNumber); var userHaveMoneyNumber = parseInt($("#userHaveMoney").val()); if(betMoneyNumber>userHaveMoneyNumber){ $("#betMoneyTxt").val(userHaveMoneyNumber); } if(betMoneyNumber>maxBetMoneyNumber){ $("#betMoneyTxt").val(maxBetMoneyNumber); } if(accMul($("#sumBenefit").val(),betMoneyNumber)>maxGetMoneyNumber){ var betMoneyTeam = maxGetMoneyNumber/$("#sumBenefit").val(); betMoneyTeam = parseInt(parseInt(betMoneyTeam)/100)*100; if(betMoneyTeamuserHaveMoneyNumber){ $("#betMoneyTxt").val(userHaveMoneyNumber); } if(betMoneyNumber>maxBetMoneyNumber){ $("#betMoneyTxt").val(maxBetMoneyNumber); } if(accMul($("#sumBenefit").val(),betMoneyNumber)>maxGetMoneyNumber){ var betMoneyTeam = maxGetMoneyNumber/$("#sumBenefit").val(); betMoneyTeam = parseInt(parseInt(betMoneyTeam)/100)*100; if(betMoneyTeam10){ alert("최대 10폴더 배팅가능합니다"); return false; } if(userHaveMoneyNumberuserHaveMoneyNumber && userHaveMoneyNumber>minBetMoneyNumber){ alert("현 보유머니가 부족합니다 충전 혹은 선택경기에서 조율해주세요"); return false; } if($("#sumBenefit").val()==1 || $("#sumBenefit").val()==0){ alert("배팅하실 게임을 하나이상 선택해주세요"); return false; } if($("#sumBenefit").val()>=50){ alert("예상 배당률 50 이상은 베팅하실 수 없습니다."); return false; } var danYaMaxBetMoney = parseInt($("#danYaMaxBetMoney").val()); var danYaMinBetMoney = parseInt($("#danYaMinBetMoney").val()); var danYaMaxGetMoney = parseInt($("#danYaMaxGetMoney").val()); if(betTableCount>1){ if(betMoney>maxBetMoneyNumber){ alert("배팅금액이 최대배팅금액'"+maxBetMoneyNumber+"' 보다 많습니다 "); return false; } if(betMoneymaxGetMoneyNumber){ alert("예상적중금액이 최대당첨금액'"+maxGetMoneyNumber+"' 을 초과하였습니다"); return false; } } if(betTableCount==1){ if(betMoney>danYaMaxBetMoney){ alert("배팅금액이 최대배팅금액'"+danYaMaxBetMoney+"' 보다 많습니다 "); return false; } if(betMoneydanYaMaxGetMoney){ alert("예상적중금액이 최대당첨금액'"+danYaMaxGetMoney+"' 을 초과하였습니다"); return false; } } $("#submitBut").hide(); }