var iUnreadQna = null;
function checkUnreadQna() {
$.get('/ajax/myinfo.asp', {'field': 'answered'}, function (response) {
var unreadCount = parseInt(response.row.answered);
if (unreadCount>0 ) {
iUnreadQna = setInterval(function() {
playSoundUnreadQna(unreadCount)
}, 1000*5);
}
}, 'json')
}
var cntUnreadQnaCheck = 0;
function playSoundUnreadQna(cnt) {
var alarmSound2 = new Audio('/sound/notice.mp3');
alarmSound2.loop = false;
var promise = alarmSound2.play();
if (promise !== undefined) {
promise.then(_ => {
// Autoplay started!
clearInterval(iUnreadQna);
}).catch(error => {
cntUnreadQnaCheck++;
if(cntUnreadQnaCheck>3) {
UIkit.modal.alert('문의하신내용에 답변이 달렸습니다.').then(function () {
clearInterval(iUnreadQna);
alarmSound2.play();
SLB_POPUP('/mypage.asp', 'my_qna');
})
}
});
}
$("#answered_count").text(parseInt(cnt));
$("#_btn_qna").css('background','red');
$("#_txt_qna").css('color','yellow');
}
function newAnswer() {
var alarmSound2 = new Audio('/sound/notice.mp3');
alarmSound2.loop = false;
UIkit.modal.alert('문의하신내용에 답변이 달렸습니다.').then(function () {
alarmSound2.play();
SLB_POPUP('/mypage.asp', 'my_qna');
});
}
function _openCasinoGame(cid, gameid, platform) {
$.get('/game/notice.asp', {'cid': cid}, function (response) {
if(response.status=='200') { // 카지노게임시작전 알림공지있음
$('#game_notice .gameStart.button').unbind( "click" ).click(function() {
window.open("/game/start?cid=" + cid + "&gameid=" + gameid + "&platform=" + platform, "gameWindow", "width=1200, height=800, left=100, top=50");
UIkit.modal('#game_notice').hide();
});
$('#game_notice #game_notice_title').html(response.title);
$('#game_notice #game_notice_message').html(response.message);
UIkit.modal('#game_notice').show();
} else {
// 모바일에서 팝업차단된경우 처리
try {
var win = window.open("/game/start?cid=" + cid + "&gameid=" + gameid + "&platform=" + platform, "gameWindow", "width=1200, height=800, left=100, top=50");
console.log(win.closed);
} catch(e) {
$('#game_notice .gameStart.button').unbind( "click" ).click(function() {
window.open("/game/start?cid=" + cid + "&gameid=" + gameid + "&platform=" + platform, "gameWindow", "width=1200, height=800, left=100, top=50");
UIkit.modal('#game_notice').hide();
});
$('#game_notice #game_notice_title').html('팝업 설정 확인');
$('#game_notice #game_notice_message').html('팝업차단이 설정되어있습니다.
추후 원할한 게임을 위해 팝업차단을 비활성화 해주세요');
UIkit.modal('#game_notice').show();
}
}
}, 'json')
}
function openCasinoGame(cat,game_uuid,platform) {
if (game_uuid == '6529')
{
openCasinoGames(cat, game_uuid, platform);
return false;
}
var ogurl = '/api/ApigamesinitSD.asp?game_uuid='+game_uuid+'&lobbyidx='+cat;
$.ajax({
type: 'POST',
async: true,
url: ogurl,
dataType: 'json',
success: function(res) {
if (res.status == "0")
{
var gameurl = res.data.return_url;
var popup = window.open(gameurl, "GamePopWin", "width=100%,height=100%,scrollbars=yes");
if (popup == null)
alert('!팝업설정을 확인하세요.\n!Please change your popup settings.');
else {
popup.moveTo(0, 0);
popup.resizeTo(screen.width, screen.height);
}
}else{
log("CallGame Result Error." + res.message);
alert("게임사 정보요청 중 오류가 발생했습니다.\n관리자에게 문의 하세요sd.\n" + res.message);
}
log('1.CallGame Done...');
},
error: function(res, xhr, aa) {
log("CallGame Call Error." + res.message);
alert("게임 호출 중 오류가 발생했습니다.");
}
});
}
function openCasinoGames(cat,game_uuid,platform) {
//var ogurl = '/api/ApigamesinitSD.asp?game_uuid='+game_uuid+'&lobbyidx='+cat;
var ogurl = '/api/ApigamesinitBB.asp?game_uuid=baccarat&provider_id=6';
$.ajax({
type: 'POST',
async: true,
url: ogurl,
dataType: 'json',
success: function(res) {
if (res.link != "" )
{ //game_url,return_url
var gameurl = res.link;
var popup = window.open(gameurl, "GamePopWin", "width=100%,height=100%,scrollbars=yes");
if (popup == null)
alert('!팝업설정을 확인하세요.\n!Please change your popup settings.');
else {
popup.moveTo(0, 0);
popup.resizeTo(screen.width, screen.height);
}
}else{
alert("게임실행 정보요청 중 오류가 발생했습니다.\n관리자에게 문의 하세요.sc\n" + res.message);
}
},
error: function(res, xhr, aa) {
alert("게임 호출 중 오류가 발생했습니다.");
}
});
}
function openSlotGame(cid, cname) {
$.get('/game/notice.asp', {'cid': cid}, function (response) {
if(response.status=='200') { // 슬롯게임시작전 알림공지있음
$('#game_notice .gameStart.button').unbind( "click" ).click(function() {
SLB('/game/list?cid=' + cid +'&cname=' + cname, {'width': 'fifteen wide column ','height' : $(window).height()*0.9,'caption': (cname) ? '' + cname : ' '});
UIkit.modal('#game_notice').hide();
});
$('#game_notice #game_notice_title').html(response.title);
$('#game_notice #game_notice_message').html(response.message);
UIkit.modal('#game_notice').show();
} else {
SLB('/game/list.asp?cid=' + cid +'&cname=' + cname, {'width': 'fifteen wide column ','height' : $(window).height()*0.9,'caption': (cname) ? '' + cname : ' '});
}
}, 'json')
}
function openGolfGame(cid, gameid, platform) {
var win = window.open("/game/golf/start?cid=" + cid + "&gameid=" + gameid + "&platform=" + platform, "gameWindow", "width=1200, height=800, left=100, top=50");
}
var iLoadUserHasInfo = null;
$(document).ready(function() {
iLoadUserHasInfo = setInterval(LoadUserHasInfo, 1000*3);
});
var answered_count_win = false;
function LoadUserHasInfo() {
$.get('/ajax/getcash.asp', {'user':''}, function (response) {
if(response.status=='401') {
clearInterval(iLoadUserHasInfo);
alert("세션이 만료되었습니다. 다시 로그인해주세요");
top.location.href = '/user/logout.asp';
} else {
$("._has_cash").html(response.cash);
$("._has_point").html(response.point);
g5_memoCnt = parseInt(response.memo_count);
if (g5_memoCnt > 0) {
var alarmSound = new Audio('/sound/memo.mp3');
alarmSound.loop = false;
alarmSound.play();
$("#_btn_memo").css('background', 'red');
$("#_txt_memo").css('color', 'yellow');
$("#memo_count").text(g5_memoCnt).addClass('memo_count_exist');
} else {
$("#memo_count").text('').removeClass('memo_count_exist');
}
var answered_count = parseInt(response.answered_count);
if (answered_count > 0) {
if (answered_count_win == false) {
newAnswer();
answered_count_win = true;
}
$("#answered_count").text(answered_count);
$("#_btn_qna").css('background', 'red');
$("#_txt_qna").css('color', 'yellow');
} else {
$("#answered_count").text('');
$("#_btn_qna").css('background', '');
$("#_txt_qna").css('color', '');
}
var coupon_count = parseInt(response.coupon_count);
if (coupon_count > 0) {
var alarmSound = new Audio('/sound/coupon.mp3');
alarmSound.loop = false;
alarmSound.play();
//$("#_btn_coupon").css('background', 'red');
$("#_txt_coupon").css('color', 'yellow');
$("#coupon_count").text(coupon_count).css('color', 'red');
} else {
$("#coupon_count").text('');
}
}
}, 'json')
}
// jacpot
function setOdometer() {
var e = document.querySelector("#odometer1"), t = (t = (new Date).getTime() + "").substring(2, 13) / 100 + "";
t = Number(t) + 107204400;
var a = new Odometer({el: e, value: t, format: "(,ddd).dd", theme: "minimal"});
setInterval(function () {
var e = (e = (new Date).getTime() + "").substring(2, 13) / 100 + "";
e = Number(e) + 107204400;
Math.floor(100 * e);
e = $.number(e, 2), 0 === parseInt(e.substr(e.length - 1, 1)) && (e = $.number(Number(e.toString().replace(/,/gi, "")) + .01, 2)), a.update(e)
}, 2133)
}
function PointToMoney() {
if (confirm('모든 포인트를 머니로 변환하시겠습니까?')) {
$.ajax({
url: '/ajax/PointOneClickProc.asp',
type: 'POST',
dataType: "json",
success: function(result) {
if (result.result == "success")
{
alert(result.message);
//objDashBoard.getMyInfo();
//log(result.message);
window.location.href = "/";
}else{
alert(result.message);
//log(result.message);
}
}
})
}
}
function log(message){
console.log(message);
}