var isIe = false;
if (navigator.userAgent.toLowerCase().indexOf("trident") !== -1 || navigator.userAgent.toLowerCase().indexOf("msie") !== -1) {
isIe = true;
}
var ggbCss = document.createElement('link');
ggbCss.rel = 'stylesheet';
ggbCss.href = 'https://t1.kakaocdn.net/gamepub/daumgame/res/b9bc3d6494580d3e8411e0bce6f0037bb01e1e99/css/renewal-2018/ggb.css';
var fssJs = document.createElement('script');
fssJs.type = 'text/javascript';
fssJs.async = true;
fssJs.src = '//game.daum.net/kg/fss.js';
var tiaraTrakingJs = document.createElement('script');
tiaraTrakingJs.type = 'text/javascript';
tiaraTrakingJs.arync = true;
tiaraTrakingJs.src = 'https://t1.daumcdn.net/gamepub/js/traking/tiara.js';
if (isIe) {
location.href = 'https://wcdn.game.daum.net/static/notice/browser/guide.html';
document.head.appendChild(ggbCss);
document.head.appendChild(fssJs);
document.head.appendChild(tiaraTrakingJs);
} else {
document.getElementsByTagName('head')[0].append(ggbCss);
document.getElementsByTagName('head')[0].append(fssJs);
document.getElementsByTagName('head')[0].append(tiaraTrakingJs);
}
if (!window['gtag']) {
var gtagScript = document.createElement('script')
gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-P6QK8WGS8D'
gtagScript.onload = function() {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-P6QK8WGS8D');
window['gtag'] = gtag;
}
document.head.appendChild(gtagScript)
}
if (typeof Object.assign != 'function') {
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
(function () {
"use strict";
var util = {
removeEmptyElement: function (array) {
var removedArray = [],
i, element;
for (i = 0; i < array.length; i++) {
element = array[i];
if (element) removedArray.push(element);
}
return removedArray;
},
cssAdd: function (sel, cls) {
return sel += ' ' + cls;
},
cssRemove: function (sel, cls) {
var idx = sel.indexOf(cls);
if (idx < 0) {
return sel;
}
return sel.substr(0, idx -1);
},
cssToggle: function (sel, cls) {
var idx = sel.indexOf(cls);
if (idx >= 0) {
return util.cssRemove(sel, cls);
}
return util.cssAdd(sel, cls);
}
};
var gaEvent = {
getEventLabel: function (param) {
var prefixTrackLabel = [param.eventCategory, param.eventName],
suffixTrackLabel = [param.eventOrder, param.eventDescription];
prefixTrackLabel = util.removeEmptyElement(prefixTrackLabel).join('_');
suffixTrackLabel = util.removeEmptyElement(suffixTrackLabel).join('_');
if (suffixTrackLabel) prefixTrackLabel += ':' + suffixTrackLabel;
if (param.eventLocation) prefixTrackLabel += '_' + param.eventLocation;
return prefixTrackLabel;
},
addEvent: function (selector, param) {
param.eventAction = param.eventAction || 'click';
var selAll = document.querySelectorAll(selector);
for (var i in selAll) {
var sel = selAll[i];
if (!sel) {
continue;
}
if (!sel.addEventListener) {
continue;
}
sel.addEventListener(param.eventAction, function () {
var appendParam = {
eventCategory: this.getAttribute('event-category'),
eventName: this.getAttribute('event-name') || this.innerText.split(' ').join('').split('\n').join(''),
eventOrder: this.getAttribute('event-order'),
eventDescription: this.getAttribute('event-description'),
eventLocation: this.getAttribute('event-location')
};
var eventParam = Object.assign(appendParam, param);
eventParam.eventLabel = gaEvent.getEventLabel(eventParam);
var convertParam = {
'send_to': 'G-P6QK8WGS8D',
'event_category': eventParam.eventCategory ? eventParam.eventCategory : '',
'event_name': eventParam.eventName ? eventParam.eventName : '',
'event_order': eventParam.eventOrder ? eventParam.eventOrder : '',
'event_description': eventParam.eventDescription ? eventParam.eventDescription : '',
'event_location': eventParam.eventLocation ? eventParam.eventLocation : '',
'event_label': eventParam.eventLabel ? eventParam.eventLabel : ''
};
var sendParam = Object.assign(convertParam, param);
gtag('event', param.eventAction, sendParam);
});
}
}
};
var daumGameGGB = {
gaInit: function () {
if (window.gtag) {
if (location.host !== 'game.daum.net') {
return;
}
gtag('event', 'page_view', {'send_to': 'G-P6QK8WGS8D'});
}
},
init: function () {
var slevelflag = true;
// 1. GA init.
daumGameGGB.gaInit();
// 2. UI init.
var _CLS = {
on: 'on',
pc_on: 'pc_on'
};
var _DOM = {
ggbLogin: document.querySelector('#a_kg_ggb_login'),
ggbLogout: document.querySelector('#a_kg_ggb_logout'),
btnBnr: document.querySelector('#a_kg_ggb_banner_btn'),
ggbBnr: document.querySelector('#div_kg_ggb_ggb_bnr'),
ggbUser: document.querySelector('#div_kg_ggb_ggb_user'),
linkPc: document.querySelector('#a_kg_ggb_pcgame'),
linkUser: document.querySelector('#a_kg_ggb_nickname'),
registration: document.querySelector('#a_kg_ggb_registration'),
ggb: document.querySelector('#pubGameGGB'),
infoLayer: document.querySelector('#div_kg_ggb_info_layer'),
myInfo: document.querySelector('#a_kg_ggb_myinfo, #a_kg_ggb_confirm_id'),
security: document.querySelector('#a_kg_ggb_security'),
help: document.querySelector('#a_kg_ggb_help'),
qna: document.querySelector('#a_kg_ggb_qna')
};
if (_DOM.myInfo) {
_DOM.myInfo.addEventListener('click', function () {
var gameTopHost = getGameTopHost();
location.href = gameTopHost + '/my/info/index.daum';
});
_DOM.security.addEventListener('click', function () {
var securityHost = getSecurityCenterHost();
location.href = securityHost;
});
_DOM.help.addEventListener('click', function () {
var gameTopHost = getGameTopHost();
location.href = gameTopHost + '/gamehelp/';
});
_DOM.qna.addEventListener('click', function () {
var gameTopHost = getGameTopHost();
location.href = gameTopHost + '/gamehelp/my/qna/list.daum';
});
}
if (_DOM.ggbLogin) {
_DOM.ggbLogin.addEventListener('click', function () {
daumGameGGB.login();
});
}
if (_DOM.ggbLogout) {
_DOM.ggbLogout.addEventListener('click', function () {
daumGameGGB.logout();
});
if (_DOM.linkUser) {
_DOM.linkUser.addEventListener('mouseover', function () {
var url = getAuthHost() + '/api/securityLevel.json';
var $ = ($ != jQuery) ? jQuery : $;
if(slevelflag) {
$.ajax({
url: url,
dataType: 'jsonp',
cache: true,
success: function(data) {
var level = data.level;
var levelDetail = data.levelDetail;
var text = '';
var link = '';
var linkTxt = '';
var grade = '';
if (level == 5) {
if(levelDetail == '5-2') {
text = '이용이 제한된 계정입니다.
1:1문의를 이용해 주세요.';
} else {
text = '충전이 제한된 계정입니다.
1:1문의를 이용해 주세요.';
}
link = getGameHelpHost();
linkTxt = '고객센터';
grade = 'grade1';
$('#grade').removeClass('img-ggb');
$('#gradeTxt').text('');
} else if (level == 3) {
if(levelDetail == "3-2") {
text = '비밀번호 변경 90일이 경과되어
비밀번호 변경을 권장 드립니다.';
link = 'https://accounts.kakao.com/weblogin/account/security/change_password';
linkTxt = '비밀번호변경';
} else {
text = '카카오톡 인증을 설정하여
소중한 게임 정보를 보호해 주세요.';
link = getSecurityCenterHost() + '/kakao'
linkTxt = '카카오톡 인증';
}
grade = 'grade2';
} else if (level == 2) {
if(levelDetail == "2-3") {
text = '비밀번호 변경 90일이 경과되어
비밀번호 변경을 권장 드립니다.';
link = 'https://accounts.kakao.com/weblogin/account/security/change_password';
linkTxt = '비밀번호변경';
} else if (levelDetail == "2-2"){
text = '카카오톡 인증 설정 추가 시
미지정 PC에서 카카오톡 인증으로
접속해 주세요.';
link = getSecurityCenterHost() + '/kakao'
linkTxt = '카카오톡 인증';
} else {
text = '게임 시작 보안을 추가 설정하여
소중한 게임 정보를 보호해 주세요.';
link = getSecurityCenterHost();
linkTxt = '보안센터홈';
}
grade = 'grade3';
} else if (level == 1) {
if(levelDetail == "1-1") {
text = '지속적인 비밀번호 변경으로
현재 보안 등급을 잘 유지해 주세요.';
link = getSecurityCenterHost();
linkTxt = '보안센터홈';
} else if(levelDetail == "1-2") {
text = '비밀번호 변경 90일이 경과되어
비밀번호 변경을 권장 드립니다.';
link = 'https://accounts.kakao.com/weblogin/account/security/change_password';
linkTxt = '비밀번호변경';
}
grade = 'grade4';
}
$('#grade').addClass(grade);
$('#gradeLink').attr('href', link);
$('#gradeLinkText').text(linkTxt);
$('#alertText').html(text);
slevelflag = false;
}
});
}
_DOM.infoLayer.className = util.cssAdd(_DOM.infoLayer.className, _CLS.on);
});
}
_DOM.ggbUser.addEventListener('mouseleave', function () {
_DOM.infoLayer.className = util.cssRemove(_DOM.infoLayer.className, _CLS.on);
});
}
_DOM.btnBnr.addEventListener('click', function () {
_DOM.ggbBnr.className = util.cssToggle(_DOM.ggbBnr.className, _CLS.on);
});
_DOM.ggbBnr.addEventListener('mouseleave', function () {
_DOM.ggbBnr.className = util.cssRemove(_DOM.ggbBnr.className, _CLS.on);
});
_DOM.ggb.addEventListener('mouseleave', function () {
_DOM.ggb.className = util.cssRemove(_DOM.ggb.className, _CLS.pc_on);
});
_DOM.linkPc.addEventListener('click', function () {
_DOM.ggb.className = util.cssToggle(_DOM.ggb.className, _CLS.pc_on);
});
if (_DOM.registration) {
_DOM.registration.addEventListener('click', function () {
var gameTopHost = getGameTopHost();
location.href = gameTopHost + '/member/checker.daum?returnUrl=' + encodeURIComponent(location.href);
});
}
gaEvent.addEvent('#a_kg_ggb_logo', {eventAction: 'click', eventCategory: 'GGB', eventName:'Logo_Daum'});
gaEvent.addEvent('#a_kg_ggb_game', {eventAction: 'click', eventCategory: 'GGB', eventName:'Logo_Game'});
gaEvent.addEvent('#a_kg_ggb_pcgame', {eventAction: 'click', eventCategory: 'GGB', eventName:'Menu_PC'});
gaEvent.addEvent('#a_kg_ggb_mogame', {eventAction: 'click', eventCategory: 'GGB', eventName:'Menu_MB'});
gaEvent.addEvent('#a_kg_ggb_banner_btn', {eventAction: 'click', eventCategory: 'GGB', eventName:'미니GGB배너', eventDescription: '기본'});
gaEvent.addEvent('#a_kg_ggb_banner_layer', {eventAction: 'click', eventCategory: 'GGB', eventName:'미니GGB배너', eventDescription: '레이어'});
gaEvent.addEvent('#a_kg_ggb_login', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_로그인'});
gaEvent.addEvent('#a_kg_ggb_logout', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_로그아웃'});
gaEvent.addEvent('#a_kg_ggb_nickname', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_닉네임'});
gaEvent.addEvent('#a_kg_ggb_myinfo', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_내정보관리'});
gaEvent.addEvent('#a_kg_ggb_daum_cash', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_다음캐쉬충전'});
gaEvent.addEvent('#a_kg_ggb_password', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_2차비밀번호 설정'});
gaEvent.addEvent('#a_kg_ggb_help', {eventAction: 'click', eventCategory: 'GGB', eventName:'다음게임_고객센터'});
//통합계정
gaEvent.addEvent('#a_itg_layer_link_itg', {eventAction: 'click', eventCategory: '통합계정_안내레이어A', eventName:'버튼_계정통합'});
gaEvent.addEvent('#a_itg_layer_link_itg_check', {eventAction: 'click', eventCategory: '통합계정_안내레이어A', eventName:'버튼_통합계정확인'});
gaEvent.addEvent('#a_itg_layer_link_itg_guide', {eventAction: 'click', eventCategory: '통합계정_안내레이어A', eventName:'버튼_계정통합가이드'});
gaEvent.addEvent('#a_itg_layer_link_itg_faq', {eventAction: 'click', eventCategory: '통합계정_안내레이어A', eventName:'버튼_FAQ'});
gaEvent.addEvent('#a_itg_layer_a_close', {eventAction: 'click', eventCategory: '통합계정_안내레이어A', eventName:'버튼_닫기'});
gaEvent.addEvent('#a_itg_layer_link_kakaopay', {eventAction: 'click', eventCategory: '통합계정_안내레이어B', eventName:'버튼_카카오페이'});
gaEvent.addEvent('#a_itg_layer_b_close', {eventAction: 'click', eventCategory: '통합계정_안내레이어B', eventName:'버튼_닫기'});
gaEvent.addEvent('#a_itg_layer_link_connect', {eventAction: 'click', eventCategory: '통합계정_안내레이어C', eventName:'버튼_개인정보제공동의'});
gaEvent.addEvent('#a_itg_layer_c_close', {eventAction: 'click', eventCategory: '통합계정_안내레이어C', eventName:'버튼_닫기'});
gaEvent.addEvent('#a_itg_message_link_itg', {eventAction: 'click', eventCategory: '통합계정_GGB_회원레이어', eventName:'버튼_계정통합'});
gaEvent.addEvent('#a_itg_message_connect', {eventAction: 'click', eventCategory: '통합계정_GGB_회원레이어', eventName:'버튼_개인정보제공동의'});
},
chargeCash: function() {
var subUrl = location.host;
if (subUrl.indexOf("dev") != -1) {
return window.open('https://billing-dev.game.daum.net:12111/popup?serviceId=kgpc&popupType=charge&location=GGB',
'nspBuy', 'location=0,status=0,width=570,height=835,scrollbars=1');
}
window.open('https://billing.game.daum.net/popup?serviceId=kgpc&popupType=charge&location=GGB',
'nspBuy', 'location=0,status=0,width=570,height=835,scrollbars=1');
},
login: function () {
window.location.href = 'https://' + daumDomainSelector.getLoginsDomain() + '/accounts/loginform.do?url=' + encodeURIComponent(window.location.href);
},
logout: function () {
window.location.href = 'https://' + daumDomainSelector.getLoginsDomain() + '/accounts/logout.do?url=' + encodeURIComponent(window.location.href);
}
};
var gamebar = {
select: function (flag) {
if (typeof jQuery != 'undefined') {
switch(flag){
case "gamehome" :
var d = document.getElementById("_ggb_home");
d.className = d.className + " on";
break;
case "webgame" :
var d = document.getElementById("_ggb_webgame");
d.className = d.className + " on";
break;
case "flashgame" :
var d = document.getElementById("_ggb_flashgame");
d.className = d.className + " on";
break;
}
}
}
};
var daumDomainSelector = new function () {
var daumLoginsDomain = 'logins.daum.net',
environment = new function () {
this.isLocal = location.host.toLowerCase().indexOf("localhost.") !== -1;
this.isDev = location.host.toLowerCase().indexOf("dev.") !== -1 || this.isLocal;
this.isStage = location.host.toLowerCase().indexOf("stage.") !== -1;
this.isLive = !this.isDev && !this.isStage;
}();
this.isRequireDaumSandboxEnvironment = function () {
if (!environment.isLive && document.cookie) {
return decodeURIComponent(document.cookie).split(';').some(function (cookie) {
var cookieNameValue = getCookieNameValue(cookie);
return cookieNameValue.name === 'doSendSandbox' && cookieNameValue.value;
});
}
return false;
};
this.getLoginsDomain = function () {
if (this.isRequireDaumSandboxEnvironment()) {
return 'sandbox-' + daumLoginsDomain;
}
return daumLoginsDomain;
};
function getCookieNameValue(cookie) {
while (cookie.charAt(0) === ' ') {
cookie = cookie.substring(1);
}
return {
name : cookie.substring(0, cookie.indexOf('=')),
value : cookie.substring(cookie.indexOf('=') + 1)
}
}
}();
window.daumGameGGB = daumGameGGB;
window.gamebar = gamebar;
})();
if (!window.kg) {
if (!window.Kakao) {
let kakaoScript = document.createElement('script');
kakaoScript.setAttribute('src', 'https://client-sdk.kakaogames.com/js/kakao/kakao.min.js');
document.head.appendChild(kakaoScript);
}
setTimeout(function() {
let kakaopcScript = document.createElement('script');
kakaopcScript.setAttribute('src', 'https://t1.kakaocdn.net/gamepub/js/account/kakao/pc/kg.account.kakaopc.js');
document.head.appendChild(kakaopcScript);
}, 100)
}
function closeLayer(layer) {
if (layer === 'B') {
let date = new Date();
date.setDate(date.getDate() + 1);
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
ggbSetCookie('ggbLayerOpen' + layer, 1, date, '.game.daum.net');
}
var element = document.getElementById('layer' + layer)
element.parentNode.removeChild(element);
if (layer == 'B') {
let date = new Date();
ggbSetCookie('kgIsItgMember', 1, date, '.game.daum.net');
}
}
function linkItg() {
let date = new Date();
date.setDate(date.getDate() + 1);
ggbSetCookie('kgIsItgMember', 1, date, '.game.daum.net');
document.location.href = 'https://accounts.daum.net/integration/start?rtnUrl=' + document.location.href
}
function kakaoPcConnect() {
window.kg.account.kakaopc.collect({});
}
daumGameGGB.isLogin = false;
var kgGgbLoad = function () {
var pubGame = document.createElement('div');
pubGame.id = 'pubGameGGB';
pubGame.className = 'head-ggb';
pubGame.innerHTML = "
\uC548\uB155\uD558\uC138\uC694! \uB2E4\uC74C\uAC8C\uC784\uC785\uB2C8\uB2E4.
\n \uB2E4\uC74C\uAC8C\uC784 \uB85C\uADF8\uC778\n