915 lines
22 KiB
Plaintext
915 lines
22 KiB
Plaintext
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$(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 += "<div class='oneGameDiv' id='oneBet"+jsonString[i]["gameId"]+"' >";
|
|||
|
htmlText += "<table id='betTable'>";
|
|||
|
htmlText += "<tr>";
|
|||
|
|
|||
|
htmlText += "<td class='td2 ";
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==1){
|
|||
|
htmlText += "onCar";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "' >" + jsonString[i]["teamOneName"]+ "</td>";
|
|||
|
htmlText += "<td class='td4' onclick='removeBetCar("+uId+","+gameId+")'>취소</td>";
|
|||
|
htmlText += "</tr>";
|
|||
|
htmlText += "<tr>";
|
|||
|
htmlText += "<td class='td2 ";
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==3){
|
|||
|
htmlText += "onCar";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "' >" + jsonString[i]["teamTwoName"]+ "</td>";
|
|||
|
|
|||
|
htmlText += "<td class='td3 ";
|
|||
|
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==2){
|
|||
|
htmlText += "onCar";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "' >";
|
|||
|
|
|||
|
htmlText += jsonString[i]["betPeiLv"];
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==1){
|
|||
|
htmlText += "(홈)";
|
|||
|
}
|
|||
|
if(jsonString[i]["localtion"]==2){
|
|||
|
htmlText += "(무)";
|
|||
|
}
|
|||
|
if(jsonString[i]["localtion"]==3){
|
|||
|
htmlText += "(원)";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["betPeiLv"]+"' class='oneBetPeiLv' name='obp"+jsonString[i]["gameId"]+"'>";//oneBetPeiLv
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["gameId"]+"' name='gameId'>";
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["localtion"]+"' name='lct"+jsonString[i]["gameId"]+"'>";//localtion
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["teamOneBenefit"]+"' name='tob"+jsonString[i]["gameId"]+"'>";//teamOneBenefit
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["teamTwoBenefit"]+"' name='ttb"+jsonString[i]["gameId"]+"'>";//teamTwoBenefit
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["betHandicap"]+"' name='bhc"+jsonString[i]["gameId"]+"'>";//betHandicap
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["betDrawBenefit"]+"' name='bdb"+jsonString[i]["gameId"]+"'>";//betDrawBenefit
|
|||
|
htmlText += "</td>";
|
|||
|
htmlText += "</tr>";
|
|||
|
htmlText += "</table>";
|
|||
|
htmlText += "</div>";
|
|||
|
}
|
|||
|
$('#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 += "<table>";
|
|||
|
htmlText += "<tr>";
|
|||
|
|
|||
|
htmlText += "<td class='td2 ";
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==1){
|
|||
|
htmlText += "onCar";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "' >" + jsonString[i]["teamOneName"]+ "</td>";
|
|||
|
htmlText += "<td class='td4' onclick='removeBetCar("+uId+","+gameId+")'>취소</td>";
|
|||
|
htmlText += "</tr>";
|
|||
|
htmlText += "<tr>";
|
|||
|
htmlText += "<td class='td2 ";
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==3){
|
|||
|
htmlText += "onCar";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "' >" + jsonString[i]["teamTwoName"]+ "</td>";
|
|||
|
|
|||
|
htmlText += "<td class='td3 ";
|
|||
|
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==2){
|
|||
|
htmlText += "onCar";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "' >";
|
|||
|
|
|||
|
htmlText += jsonString[i]["betPeiLv"];
|
|||
|
|
|||
|
if(jsonString[i]["localtion"]==1){
|
|||
|
htmlText += "(홈)";
|
|||
|
}
|
|||
|
if(jsonString[i]["localtion"]==2){
|
|||
|
htmlText += "(무)";
|
|||
|
}
|
|||
|
if(jsonString[i]["localtion"]==3){
|
|||
|
htmlText += "(원)";
|
|||
|
}
|
|||
|
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["betPeiLv"]+"' class='oneBetPeiLv' name='obp"+jsonString[i]["gameId"]+"'>";//oneBetPeiLv
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["gameId"]+"' name='gameId'>";
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["localtion"]+"' name='lct"+jsonString[i]["gameId"]+"'>";//localtion
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["teamOneBenefit"]+"' name='tob"+jsonString[i]["gameId"]+"'>";//teamOneBenefit
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["teamTwoBenefit"]+"' name='ttb"+jsonString[i]["gameId"]+"'>";//teamTwoBenefit
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["betHandicap"]+"' name='bhc"+jsonString[i]["gameId"]+"'>";//betHandicap
|
|||
|
htmlText += "<input type='hidden' value='"+jsonString[i]["betDrawBenefit"]+"' name='bdb"+jsonString[i]["gameId"]+"'>";//betDrawBenefit
|
|||
|
htmlText += "</td>";
|
|||
|
htmlText += "</tr>";
|
|||
|
htmlText += "</table>";
|
|||
|
|
|||
|
}
|
|||
|
$('#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(betTableCount<needBetCount){
|
|||
|
|
|||
|
$("#extraOddsDiv"+extraOddId).remove();
|
|||
|
|
|||
|
$("#extraOddsTd"+extraOddId).addClass("defultState");
|
|||
|
|
|||
|
$("#extraOddsTd"+extraOddId).removeClass("betState");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
changeSumBenefit();
|
|||
|
|
|||
|
if(betTableCount>0){
|
|||
|
|
|||
|
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 += "<div class='oneExtraOddDiv' id='extraOddsDiv"+extraOddId+"' >";
|
|||
|
htmlText += "<table>";
|
|||
|
htmlText += "<tr>";
|
|||
|
htmlText += "<td class='td1' >E</td>";
|
|||
|
htmlText += "<td class='td2' >" + "보너스"
|
|||
|
+ "</td>";
|
|||
|
htmlText += "<td class='td3' >";
|
|||
|
htmlText += extraOdds;
|
|||
|
htmlText += "<input type='hidden' value='"+extraOdds+"' class='oneBetPeiLv' name='extraOddsText' >";//oneBetPeiLv
|
|||
|
htmlText += "<input type='hidden' value='"+extraOddId+"' id='extraOddId' >";//oneBetPeiLv
|
|||
|
htmlText += "<input type='hidden' value='"+needBetCount+"' id='needBetCountInput' >";//oneBetPeiLv
|
|||
|
htmlText += "</td>";
|
|||
|
htmlText += "</tr>";
|
|||
|
htmlText += "</table>";
|
|||
|
htmlText += "</div>";
|
|||
|
|
|||
|
$('#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<needBetCount){
|
|||
|
|
|||
|
$("#extraOddsDiv"+extraOddId).remove();
|
|||
|
|
|||
|
$("#extraOddsTd"+extraOddId).addClass("defultState");
|
|||
|
|
|||
|
$("#extraOddsTd"+extraOddId).removeClass("betState");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
changeSumBenefit();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function changeSumBenefit(){
|
|||
|
var m = $('.oneBetPeiLv');
|
|||
|
|
|||
|
var sumBenefit = 1;
|
|||
|
|
|||
|
for(i=0;i<m.length;i++)
|
|||
|
{
|
|||
|
sumBenefit = accMul(sumBenefit,parseFloat(m.eq(i).val()));
|
|||
|
}
|
|||
|
|
|||
|
$("#sumBenefit").val(sumBenefit.toFixed(2));
|
|||
|
|
|||
|
$("#sumBenefitFont").html(sumBenefit.toFixed(2));
|
|||
|
|
|||
|
var betMoney = $("#betMoneyTxt").val().replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"");
|
|||
|
$("#getMoneyTxt").val(parseInt(accMul(sumBenefit.toFixed(2),betMoney)));
|
|||
|
$("#getMoneyFont").html(formatMoney(parseInt(accMul(sumBenefit.toFixed(2),betMoney))));
|
|||
|
|
|||
|
checkMoney();
|
|||
|
}
|
|||
|
|
|||
|
function changeMoney(obj) {
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$(obj).val(formatMoney($(obj).val()));
|
|||
|
|
|||
|
|
|||
|
var betMoney = $("#betMoneyTxt").val().replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"");
|
|||
|
$("#getMoneyTxt").val(parseInt(accMul($("#sumBenefit").val(),betMoney)));
|
|||
|
$("#getMoneyFont").html(formatMoney(parseInt(accMul($("#sumBenefit").val(),betMoney))));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function formatMoney(money){
|
|||
|
|
|||
|
money = money+",";
|
|||
|
|
|||
|
var str = money.replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"");
|
|||
|
var newStr = new Array(str.length + parseInt(str.length / 3));
|
|||
|
var strArray = str.split("");
|
|||
|
newStr[newStr.length - 1] = strArray[strArray.length - 1];
|
|||
|
var currentIndex = strArray.length - 1;
|
|||
|
for ( var i = newStr.length - 1; i >= 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(betMoneyTeam<minBetMoneyNumber){
|
|||
|
alert("배팅경기 과다로 최대당첨금액을 초과하게 되었습니다 배팅불가합니다");
|
|||
|
}
|
|||
|
}
|
|||
|
$("#isBetting").val(0);
|
|||
|
}
|
|||
|
|
|||
|
function resetMoney(money){
|
|||
|
|
|||
|
|
|||
|
var maxBetMoneyNumber = parseInt($("#maxBetMoney").val());
|
|||
|
|
|||
|
var minBetMoneyNumber = parseInt($("#minBetMoney").val());
|
|||
|
|
|||
|
var maxGetMoneyNumber = parseInt($("#maxGetMoney").val());
|
|||
|
|
|||
|
var danYaMaxBetMoney = parseInt($("#danYaMaxBetMoney").val());
|
|||
|
|
|||
|
var danYaMinBetMoney = parseInt($("#danYaMinBetMoney").val());
|
|||
|
|
|||
|
var danYaMaxGetMoney = parseInt($("#danYaMaxGetMoney").val());
|
|||
|
|
|||
|
|
|||
|
var betTableCount = $(".oneGameDiv table").length;
|
|||
|
|
|||
|
var inputMoney = 0;
|
|||
|
|
|||
|
if(betTableCount>1){
|
|||
|
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(betMoneyTeam<minBetMoneyNumber){
|
|||
|
alert("배팅경기 과다로 최대당첨금액을 초과하게 되었습니다 배팅불가합니다");
|
|||
|
}
|
|||
|
|
|||
|
$("#betMoneyTxt").val(betMoneyTeam);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
$("#betMoneyTxt").val(formatMoney($("#betMoneyTxt").val()));
|
|||
|
|
|||
|
var betMoney = $("#betMoneyTxt").val().replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"");
|
|||
|
$("#getMoneyTxt").val(parseInt(accMul($("#sumBenefit").val(),betMoney)));
|
|||
|
$("#getMoneyFont").html(formatMoney(parseInt(accMul($("#sumBenefit").val(),betMoney))));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function inputMoney(money){
|
|||
|
|
|||
|
if($("#betMoneyTxt").val()==""){
|
|||
|
$("#betMoneyTxt").val("0");
|
|||
|
}
|
|||
|
|
|||
|
var betMoneyNumber = parseInt(($("#betMoneyTxt").val()).replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,""))+parseInt(accMul(money,1000));
|
|||
|
|
|||
|
|
|||
|
$("#betMoneyTxt").val(betMoneyNumber);
|
|||
|
|
|||
|
var maxBetMoneyNumber = parseInt($("#maxBetMoney").val());
|
|||
|
|
|||
|
var minBetMoneyNumber =parseInt( $("#minBetMoney").val());
|
|||
|
|
|||
|
var maxGetMoneyNumber = parseInt($("#maxGetMoney").val());
|
|||
|
|
|||
|
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(betMoneyTeam<minBetMoneyNumber){
|
|||
|
alert("배팅경기 과다로 최대당첨금액을 초과하게 되었습니다 배팅불가합니다");
|
|||
|
}
|
|||
|
|
|||
|
$("#betMoneyTxt").val(betMoneyTeam);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
$("#betMoneyTxt").val(formatMoney($("#betMoneyTxt").val()));
|
|||
|
|
|||
|
var betMoney = $("#betMoneyTxt").val().replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"");
|
|||
|
$("#getMoneyTxt").val(parseInt(accMul($("#sumBenefit").val(),betMoney)));
|
|||
|
$("#getMoneyFont").html(formatMoney(parseInt(accMul($("#sumBenefit").val(),betMoney))));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function accMul(arg1,arg2){
|
|||
|
var m=0,s1=arg1.toString(),s2=arg2.toString();
|
|||
|
|
|||
|
try{
|
|||
|
m+=s1.split(".")[1].length;
|
|||
|
}
|
|||
|
catch(e){
|
|||
|
}
|
|||
|
|
|||
|
try{
|
|||
|
m+=s2.split(".")[1].length;
|
|||
|
}
|
|||
|
catch(e){
|
|||
|
}
|
|||
|
|
|||
|
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m) ;
|
|||
|
}
|
|||
|
|
|||
|
function checkBetting(){
|
|||
|
|
|||
|
var maxBetMoneyNumber = parseInt($("#maxBetMoney").val());
|
|||
|
|
|||
|
var minBetMoneyNumber = parseInt($("#minBetMoney").val());
|
|||
|
|
|||
|
var maxGetMoneyNumber = parseInt($("#maxGetMoney").val());
|
|||
|
|
|||
|
var userHaveMoneyNumber = $("#userHaveMoney").val();
|
|||
|
|
|||
|
var getMoney = parseInt($("#getMoneyTxt").val());
|
|||
|
|
|||
|
var betMoney = parseInt($("#betMoneyTxt").val().replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,""));
|
|||
|
|
|||
|
var betTableCount = $(".oneGameDiv table").length;
|
|||
|
|
|||
|
var needBetCountForBet = parseInt($("#needBetCountForBet").val());
|
|||
|
|
|||
|
if(betTableCount<needBetCountForBet){
|
|||
|
|
|||
|
alert("본타입에서는 최소"+needBetCountForBet+"폴더이상 조합을 하셔야 배팅가능합니다.단폴배팅은 불가합니다");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if(betTableCount>10){
|
|||
|
|
|||
|
alert("최대 10폴더 배팅가능합니다");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if(userHaveMoneyNumber<minBetMoneyNumber){
|
|||
|
|
|||
|
alert("현보유머니가 최소배팅 금액보다 적습니다 충전 혹은 포인트 전환 방법을 참고하세요");
|
|||
|
|
|||
|
return false;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if(betMoney>userHaveMoneyNumber && 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(betMoney<minBetMoneyNumber){
|
|||
|
|
|||
|
alert("배팅금액이 최소배팅금액'"+minBetMoneyNumber+"' 보다 적습니다");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if(getMoney>maxGetMoneyNumber){
|
|||
|
|
|||
|
alert("예상적중금액이 최대당첨금액'"+maxGetMoneyNumber+"' 을 초과하였습니다");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if(betTableCount==1){
|
|||
|
|
|||
|
if(betMoney>danYaMaxBetMoney){
|
|||
|
|
|||
|
alert("배팅금액이 최대배팅금액'"+danYaMaxBetMoney+"' 보다 많습니다 ");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if(betMoney<danYaMinBetMoney){
|
|||
|
|
|||
|
alert("배팅금액이 최소배팅금액'"+danYaMinBetMoney+"' 보다 적습니다");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if(getMoney>danYaMaxGetMoney){
|
|||
|
|
|||
|
alert("예상적중금액이 최대당첨금액'"+danYaMaxGetMoney+"' 을 초과하였습니다");
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$("#submitBut").hide();
|
|||
|
}
|