'),
$close = $('
'),
$close2 = $('
' + $.lang[LANG]['config.ok'] + ' ');
$header = $(''),
$body = $('
'),
$contentbox = $('
'),
$tutorialVideo = $('
'),
$videoWrap = $('
'),
$watchAgainNote = $('
' + $.lang[LANG]['tutorial-video.watch-again-note'] + ' '),
$bottom = $('
');
$close.on('click',function() { $.guideVideoOFF(); });
$close2.on('click',function() { $.guideVideoOFF(); });
$videoWrap.on('click', function() {
$(this).toggleClass('guideVideo-stopPlay');
if(!$(this).hasClass('guideVideo-stopPlay')) {
if ( LANG == 'en' )
var link = "https://www.youtube.com/embed/p6fyIMl2BcI";
var html = '
';
$(this).html(html);
}
});
$tutorialVideo.append( $videoWrap );
$contentbox.append( $tutorialVideo );
$bottom.append($close2).append($watchAgainNote);
$body.append($contentbox).append($bottom);
$guideVideo.append($header).append($close).append($body);
$content.append($guideVideo);
$content.fadeIn();
}
var $thisContent = $('.guideVideoModal .contentbox');
}
jQuery.guideVideoOFF = function() {
$('.guideVideoModal').fadeOut(function() {
$(this).remove();
});
}
$.fn.siteDelete = function(sid, code) {
// isDelLangSite : 특정 다국어 삭제시 ( 사이트 삭제에서의 다국어 삭제는 false 임 )
var isDelLangSite = (code) ? true : false;
var sdOrgSid = sid,
sdSid = (isDelLangSite) ? sid + '__' + code : sid,
sdMore = [''],
sdResource = [],
sdResourceIdx = -1,
sdResourceTotal = 0,
sdIdx = -1,
p_w = 0, p_max = 100, p_unit = 1,
p_step_max = 100, p_step_unit = 1, p_step_plus = 1,
block_view = { 'gallery':1, 'forum':2, 'form':2 };
$.sd = {
initVal: function() {
p_step_max = 100;
p_step_unit = 1;
p_step_plus = 1;
sdIdx++;
if(!isDelLangSite) {
code = sdMore[sdIdx];
sdSid = (code) ? sid + '__' + code : sid;
}
},
strProcess: function(step) {
// console.log('step: ' + step + '');
// console.log('p_w: '+ p_w + ', p_unit: ' + p_unit);
var str = '', cnt = '';
switch(step) {
case 'init':
p_max = (isDelLangSite) ? 100 : 100/sdMore.length;
p_unit = p_max / 100;
str = $.lang[LANG]['site.delete.process.init'];
break;
case '1':
p_w += p_unit * 5;
str = $.lang[LANG]['site.delete.process.step1'];
break;
case 'end':
p_w = p_max * (sdIdx+1);
var checkEnd = (sdMore.length > sdIdx+1) ? false : true;
str = $.lang[LANG]['site.delete.process.step14'];
cnt = (checkEnd) ? '' : '
' + $.lang[LANG]['site.delete.process.more'];
if(checkEnd) {
if(isDelLangSite) {
var slog_lang = $('.language-contents .settings-language .selected-languages li[data-code="' + code + '"] .language-name').text();
setSiteLogs('settings.language','delete',{'lang':slog_lang,'code':code},'settings.language');
}
setTimeout(function() {
$.progressOFF();
}, 500);
}
break;
default:
if(step == '2') {
p_step_max = p_unit * 90;
p_step_unit = p_step_max / 13;
}
if($.inArray(step,['3','4'])>-1) str = $.lang[LANG]['site.delete.process.step3'];
else if($.inArray(step,['5','6','7','8','8-more','9'])>-1) str = $.lang[LANG]['site.delete.process.step5'];
else str = $.lang[LANG]['site.delete.process.step'+step];
if(step == '13-more') {
if(sdResource.length == 0) return false;
str += '( ' + (sdResourceIdx+1) + ' / ' + sdResource.length + ' )';
}
if(p_step_plus > 0) p_w += p_step_unit;
break;
}
if(step == 'init' && sdIdx == 0) {
$.progressON(str,'','',true);
} else {
$('.progressModal .progress-header h1').html(str);
$('.progressModal .progress-bar').css('width',p_w+'%');
}
// console.log('p_w: '+ p_w + ', p_unit: ' + p_unit);
},
step0: function() {
if(sdIdx == 0) $('#loading').addClass('hide');
var sdStep1 = $.sd.step1();
sdStep1.done(function() {
$.sd.stepMultiCall('2');
}).fail(function(sdStep1_msg){
console.log(sdStep1_msg);
$.sd.stepEnd();
if(sdStep1_msg) $(this).showModalFlat('ERROR', sdStep1_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
},
step1: function() { // [del] ln_select
var step1_deferred = $.Deferred();
$.post('/template/siteDelete', { step:'1', sid:sdOrgSid, code:code, isDelLangSite:isDelLangSite }, function(r1) {
if(typeof r1.error != 'undefiend' && r1.error) {
console.log('step1 reject');
step1_deferred.reject(r1.error);
}
$.sd.strProcess('1');
setTimeout(function() {
step1_deferred.resolve();
}, 200);
}, 'json');
return step1_deferred.promise();
},
stepMultiCall: function(call_step) {
if(call_step == '2') $.sd.strProcess('2');
if(call_step == '13-more') {
var sdStep3 = $.sd.step3();
sdStep3.done(function(next_step) {
if(next_step) $.sd.stepMultiCall(next_step);
else $.sd.stepEnd();
}).fail(function(sdStep3_msg) {
console.log(sdStep3_msg);
$.sd.stepMultiCall('14');
if(sdStep3_msg) $(this).showModalFlat('ERROR', sdStep3_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
} else {
var sdStepMulti = $.sd.stepMulti(call_step);
sdStepMulti.done(function(next_step) {
if(next_step) $.sd.stepMultiCall(next_step);
else $.sd.stepEnd();
}).fail(function(sdStepMulti_msg){
console.log(sdStepMulti_msg);
var jump_step = (call_step.indexOf('-more') > -1) ? Number(call_step.replace('-more', ''))+1 : Number(call_step)+1;
if(jump_step >= 15) $.sd.stepEnd();
else $.sd.stepMultiCall(jump_step.toString());
console.log(call_step);
console.log('->');
console.log(jump_step.toString());
if(sdStepMulti_msg) $(this).showModalFlat('ERROR', sdStepMulti_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
}
},
stepMulti: function(sd_step) {
var stepMulti_deferred = $.Deferred();
$.post('/template/siteDelete', { step:sd_step, sid:sdOrgSid, code:code }, function(r) {
if(typeof r.error != 'undefiend' && r.error) {
console.log('stepMulti reject');
stepMulti_deferred.reject(r.error);
}
if(sd_step == '13') {
sdResource = (typeof r.r_list != 'undefiend') ? r.r_list : [];
sdResourceTotal = (typeof r.r_total != 'undefiend') ? r.r_total : 0;
}
p_step_plus = (r.next_step=='' || r.next_step.indexOf('-more') > -1) ? 0 : 1;
if(r.next_step) $.sd.strProcess(r.next_step);
setTimeout(function() {
stepMulti_deferred.resolve(r.next_step);
}, 100);
}, 'json');
return stepMulti_deferred.promise();
},
step3: function() {
var step3_deferred = $.Deferred();
sdResourceIdx++;
var r_seq = sdResource[sdResourceIdx];
if(typeof r_seq != 'undefiend' && r_seq) {
$.post('/template/siteDelete', { step:'13-more', sid:sdOrgSid, code:code, r_seq:r_seq }, function(r3) {
if(typeof r3.error != 'undefiend' && r3.error) {
console.log('step3 reject');
step3_deferred.reject(r3.error);
}
p_step_plus = 0;
if(r3.next_step) $.sd.strProcess(r3.next_step);
setTimeout(function() {
step3_deferred.resolve(r3.next_step);
}, 50);
}, 'json');
} else {
step3_deferred.resolve('14');
}
return step3_deferred.promise();
},
stepEnd: function() {
$.sd.strProcess('end');
var checkEnd = (sdMore.length > sdIdx+1) ? false : true;
if(checkEnd) {
$('#loading').removeClass('hide');
var deleted_modal = $(this).showModalFlat($.lang[LANG]['site.delete.process.end.title'], $.lang[LANG]['site.delete.process.end.description'], true, false, function() {
$('.modal.modal-default.fade.in').css('zIndex','');
location.href='/';
}, 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0','','','',function() {
location.href='/';
});
} else {
$.sd.initVal();
setTimeout(function() {
$.sd.step0();
}, 300);
}
}
}
if(isDelLangSite) {
$.sd.initVal();
$.sd.strProcess('init');
setTimeout(function() {
$.sd.step0();
}, 300);
} else {
$.post('/template/siteDelete', { step:'check', sid:sdOrgSid, code:code }, function(r1) {
if(typeof r1.error != 'undefiend' && r1.error) {
alert(r1.error);
location.reload();
return false;
}
sdMore = r1.more_code;
$.sd.initVal();
$.sd.strProcess('init');
setTimeout(function() {
$.sd.step0();
}, 300);
}, 'json');
}
}
$.fn.siteClone = function(sid, dest_sid, isAddLangSite) {
var scIdx = -1,
scSid = [sid],
scDest = [dest_sid],
scCheck = { 'popup':false, 'music':false, 'gallery':false, 'forum':false },
scOrgData = [],
scDestData = [],
scTempData = [];
var p_w = 0, p_max = 100, p_unit = 1,
p_step_max = 100, p_step_unit = 1, p_step_plus = 1,
block_view = { 'gallery':1, 'forum':2, 'form':2 };
$.sc = {
initVal: function() {
p_step_max = 100;
p_step_unit = 1;
p_step_plus = 1;
scIdx++;
if(scIdx == 0) {
if(isAddLangSite) scCheck = { 'popup':true, 'music':true, 'gallery':true, 'forum':true };
else scCheck = { 'popup':false, 'music':false, 'gallery':false, 'forum':false };
} else if(scIdx > 0) {
scDest.push(scSid[scIdx].replace(scSid[0],scDest[0]));
}
scOrgData.push({ 'total':0, 'normal_total':0, 'gallery' : { 'total':0 }, 'forum' : { 'total':0 }, 'form' : { 'total':0 } });
scDestData.push({ 'total':0, 'normal_total':0, 'gallery' : { 'total':0 }, 'forum' : { 'total':0 }, 'form' : { 'total':0 } });
scTempData.push({ 'gallery':false, 'forum':false, 'form':false });
},
strCheck: function() {
var checkbox = clSVG('checkbox','16','16',false,'');
return '\
\
\
\
\
\
' + checkbox + '\
\
' + $.lang[LANG]['site.clone.check.popup'] + ' \
\
\
\
\
' + checkbox + '\
\
' + $.lang[LANG]['site.clone.check.music'] + ' \
\
\
\
\
' + checkbox + '\
\
' + $.lang[LANG]['site.clone.check.gallery'] + ' \
\
\
\
\
' + checkbox + '\
\
' + $.lang[LANG]['site.clone.check.forum'] + ' \
\
\
' + $.lang[LANG]['site.clone.check.info.1'] + '\
\
\
' + $.lang[LANG]['site.clone.check.info.2'] + '
\
\
';
},
strProcess: function(step) {
// console.log('step: ' + step + '');
// console.log('p_w: '+ p_w + ', p_unit: ' + p_unit);
var str = '',
cnt = '';
switch(step) {
case 'init': // 0%
str = $.lang[LANG]['site.clone.process.init'];
break;
case '1': // 5%
if(scIdx == 0) {
p_max = 100 / scSid.length;
p_unit = p_max / 100;
}
p_w += p_unit * 5;
str = $.lang[LANG]['site.clone.process.step1'];
if(!isAddLangSite) {
if(!scCheck['popup'] && !scCheck['music']) str = $.lang[LANG]['site.clone.process.step1.1'];
else if (scCheck['popup'] && !scCheck['music']) str = $.lang[LANG]['site.clone.process.step1.2'];
else if (!scCheck['popup'] && scCheck['music']) str = $.lang[LANG]['site.clone.process.step1.3'];
}
break;
case '2': // 0%
str = $.lang[LANG]['site.clone.process.step2'];
break;
case '2-ok':
str = $.lang[LANG]['site.clone.process.step2'];
cnt = '(0/' + scOrgData[scIdx]['total'] + ')';
// step3,4 init
p_step_max = p_unit * 60;
p_step_unit = p_step_max / scOrgData[scIdx]['total'];
break;
case '3': // 30%
str = $.lang[LANG]['site.clone.process.step3'];
cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')';
break;
case '3-ok':
p_w += p_step_unit * p_step_plus;
str = $.lang[LANG]['site.clone.process.step3'];
cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')';
break;
case '4': // 5%
p_w += p_unit * 5;
str = $.lang[LANG]['site.clone.process.step4'];
cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')';
break;
case '5': // 30%
p_w += p_step_unit * p_step_plus;
str = $.lang[LANG]['site.clone.process.step5'];
cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')';
break;
case '6': // 5%
p_w += p_unit * 5;
str = $.lang[LANG]['site.clone.process.step6'];
cnt = '(' + scDestData[scIdx]['resource']['total'] + '/' + scOrgData[scIdx]['resource']['total'] + ')';
// step7 init
p_step_max = p_unit * 20;
p_step_unit = p_step_max / scOrgData[scIdx]['resource']['total'];
break;
case '7': // 20%
p_w += p_step_unit;
str = $.lang[LANG]['site.clone.process.step7'];
cnt = '(' + scDestData[scIdx]['resource']['total'] + '/' + scOrgData[scIdx]['resource']['total'] + ')';
break;
case '8': // 5%
p_w = p_max * (scIdx+1);
var checkEnd = (scSid.length > 1 && scSid.length > scIdx+1) ? false : true;
str = $.lang[LANG]['site.clone.process.step8'];
cnt = (checkEnd) ? '' : '
' + $.lang[LANG]['site.clone.process.step8.more'];
if(checkEnd) {
setTimeout(function() {
$.progressOFF();
}, 500);
}
break;
default:
break;
}
if(step == 'init' && scIdx == 0) {
$.progressON(str,'','',true);
} else {
$('.progressModal .progress-header h1').html(str + cnt);
$('.progressModal .progress-bar').css('width',p_w+'%');
}
// console.log('p_w: '+ p_w + ', p_unit: ' + p_unit);
},
step0: function() {
var scStep1 = $.sc.step1();
scStep1.done(function() {
var scStep2 = $.sc.step2();
scStep2.done(function() {
$.sc.step3Call(1);
}).fail(function(scStep2_msg) {
console.log('scStep2 fail');
console.log(scStep2_msg);
$.sc.step8();
if(scStep2_msg) $(this).showModalFlat('=$this->lang->line("lang.delete.modal.title")?>', scStep2_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
}).fail(function(scStep1_msg){
console.log(scStep1_msg);
$.sc.step8();
if(scStep1_msg) $(this).showModalFlat('=$this->lang->line("lang.delete.modal.title")?>', scStep1_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
},
step1: function() { // [clone] pf_site | [get] org pf_site
var step1_deferred = $.Deferred();
$.post('/template/siteClone', { step:'1', sid:scSid[scIdx], dest_sid:scDest[scIdx], check:scCheck, isAddLangSite:isAddLangSite }, function(r1) {
if(typeof r1.error != 'undefiend' && r1.error) {
console.log('step1 error: ' + r1.error);
var error_msg = (r1.error == 'already_dest') ? '복제가 정상적으로 안되었으니 삭제 후 다시 시도해주세요.' : 'Site Clone Step1 Error';
step1_deferred.reject(error_msg);
}
scOrgData[scIdx]['pfsite'] = r1.org_site;
if(scIdx == 0 && r1.site_langs !== null) scSid = r1.site_langs;
$.sc.strProcess('1');
setTimeout(function() {
step1_deferred.resolve();
}, 300);
}, 'json');
return step1_deferred.promise();
},
step2: function() { // [get] block total
var step2_deferred = $.Deferred();
$.sc.strProcess('2');
$.post('/template/siteClone', { step:'2', sid:scSid[scIdx], check:scCheck }, function(r2) {
if(typeof r2.error != 'undefiend' && r2.error) {
console.log('step2 reject');
step2_deferred.reject(r2.error);
}
scOrgData[scIdx]['total'] = r2.data.total;
scOrgData[scIdx]['normal_total'] = r2.data.normal_total;
$.sc.strProcess('2-ok');
setTimeout(function() {
step2_deferred.resolve();
}, 300);
}, 'json');
return step2_deferred.promise();
},
step3Call: function(page) {
var view = 100,
checkNextStep = (Math.ceil(scOrgData[scIdx]['normal_total']/view) < page) ? true : false;
if(checkNextStep) {
var scStep4 = $.sc.step4();
scStep4.done(function(data4) {
$('.progress-content').append('\
\
');
$.each(data4, function(key,total) {
// if(key == 'gallery_items') return true;
if(key == 'total') return true;
if(total > 0) {
var view = block_view[key],
total_page = (total > view) ? Math.ceil(total/view) : 1,
view_start = 1,
view_end = (total > view) ? view : total;
for(var idx=1; idx<=total_page; idx++) {
if(idx > 1) {
view_start = view_end + 1;
view_end = (total > (view*idx)) ? view*idx : total;
}
var btn_target = (view === 1 || view_end == 1) ? '' : '(' + view_start + '~' + view_end + ')',
btn_str = key + ' ' + idx + btn_target,
btn_html = '
'+btn_str+' ';
$('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list').append('
' + btn_html + ' ');
}
}
});
$.sc.step5Call(0);
}).fail(function(scStep4_msg){
console.log(scStep4_msg);
$.sc.step8();
if(scStep4_msg) $(this).showModalFlat('=$this->lang->line("lang.delete.modal.title")?>', scStep4_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
return false;
}
var scStep3 = $.sc.step3(page);
scStep3.done(function() {
$.sc.step3Call(page+1);
}).fail(function(scStep3_msg){
console.log(scStep3_msg);
$.sc.step8();
if(scStep3_msg) $(this).showModalFlat('=$this->lang->line("lang.delete.modal.title")?>', scStep3_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0');
});
},
step3: function(page) { // [clone] pf_page > normal block
var step3_deferred = $.Deferred();
$.sc.strProcess('3');
$.post('/template/siteClone', { step:'3', sid:scSid[scIdx], dest_sid:scDest[scIdx], check:scCheck, page:page, isAddLangSite:isAddLangSite }, function(r3) {
if(typeof r3.error != 'undefiend' && r3.error) {
console.log('step3 reject');
step3_deferred.reject(r3.error);
}
p_step_plus = r3.data.insert_total;
scDestData[scIdx]['total'] += r3.data.insert_total;
$.sc.strProcess('3-ok');
setTimeout(function() {
step3_deferred.resolve();
}, 200);
}, 'json');
return step3_deferred.promise();
},
step4: function() { // [get] (gallery / form / forum) block total
var step4_deferred = $.Deferred();
$.post('/template/siteClone', { step:'4', sid:scSid[scIdx], check:scCheck }, function(r4) {
if(typeof r4.error != 'undefiend' && r4.error) {
console.log('step4 reject');
step4_deferred.reject(r4.error);
}
scOrgData[scIdx]['gallery']['total'] = r4.data.gallery;
scOrgData[scIdx]['forum']['total'] = r4.data.forum;
scOrgData[scIdx]['form']['total'] = r4.data.form;
$.sc.strProcess('4');
setTimeout(function() {
step4_deferred.resolve(r4.data);
}, 300);
}, 'json');
return step4_deferred.promise();
},
step5Call: function(cnt) {
var cloneBlock = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list li').eq(cnt);
if(cloneBlock.length == 0) {
$.sc.step6();
return false;
}
var cloneBlockBtn = cloneBlock.find('button'),
key = cloneBlock.attr('class'),
start = cloneBlockBtn.attr('data-start'),
end = cloneBlockBtn.attr('data-end'),
more = (typeof cloneBlockBtn.attr('data-more') != 'undefined' && cloneBlockBtn.attr('data-more')) ? cloneBlockBtn.attr('data-more') : '';
var scStep5 = $.sc.step5(key,cnt,start,end,more);
scStep5.done(function(checkMore) {
if(checkMore) $.sc.step5Call(cnt);
else $.sc.step5Call(cnt+1);
}).fail(function() {
console.log('scStep5 fail');
});
},
step5: function(key,cnt,start,end,more) { // [clone] pf_page > (gallery / form / forum) block
var step5_deferred = $.Deferred();
var cloneBlock = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list li').eq(cnt),
cloneBlockBtn = cloneBlock.find('button'),
block_insert_data = scTempData[scIdx][key];
$.post('/template/siteClone', { step:'5', sid:scSid[scIdx], dest_sid:scDest[scIdx], check:scCheck, insert_data:block_insert_data, btype:key, bstart:start, bend:end, more:more }, function(r5) {
if(typeof r5.error != 'undefined' && r5.error) {
console.log('step5 reject');
console.log('Gallery / form / forum Clone error::' + scSid[scIdx] + ', ' + r5.error);
$('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list li').eq(cnt).append('
'+r5.error+' ');
step5_deferred.reject();
} else $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list .error').remove();
scDestData[scIdx]['total'] = scDestData[scIdx]['total'] + r5.data.total;
scTempData[scIdx][key] = Object.assign(block_insert_data, r5.data.insert_data);
var check_more = false;
if(typeof r5.data.more != 'undefiend' && r5.data.more) {
check_more = true;
var more_str = r5.data.more,
more_arr = more_str.split(','),
more_btn_str = more_arr[2]+'/'+more_arr[3];
cloneBlockBtn.attr('data-more',r5.data.more);
if(cloneBlockBtn.find('.next').length > 0) cloneBlockBtn.find('.next').text(more_btn_str);
else cloneBlockBtn.append('
('+more_btn_str+') ');
} else {
p_step_plus = r5.data.total;
$.sc.strProcess('5');
cloneBlockBtn.attr('disabled',true);
}
setTimeout(function() {
step5_deferred.resolve(check_more);
}, 200);
}, 'json');
return step5_deferred.promise();
},
step6: function() { // [get] pf_resource seq & total
console.log(scSid[scIdx]);
$.post('/template/siteClone', { step:'6', sid:scSid[scIdx], dest_sid:scDest[scIdx] }, function(r6) {
var cloneSection = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list');
if(typeof r6.error != 'undefined' && r6.error) {
console.log('step6 reject');
console.log('Resorce Clone error::' + scSid[scIdx] + ', ' + r6.error);
cloneSection.before('
'+r6.error+' ');
return false;
} else $('.error').remove();
var r_view = 30,
r_total = r6.count,
r_add = 0;
scOrgData[scIdx]['resource'] = {
'total' : r_total,
'list' : r6.list
};
scDestData[scIdx]['resource'] = {
'total' : 0,
'list' : new Array()
};
$.sc.strProcess('6');
if(r_total == 0) {
$.sc.step8();
return false;
}
$.each(r6.list, function(rs_i,rs_v) {
r_add++;
var mod = r_add%r_view;
if(mod === 1) cloneSection.append('
');
cloneSection.find('li:last-child').append('
' + rs_v.seq + ' ');
if(r_add == r_total) {
$.sc.step7Call(0,0);
}
});
}, 'json');
},
step7Call: function(rs_eq1,rs_eq2) {
var cloneResource = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list');
rs_li_total = cloneResource.find('li').length;
if(rs_eq1 >= rs_li_total) {
$.sc.step8();
return false;
}
var cloneResourceli = cloneResource.find('li').eq(rs_eq1),
rs_span_total = cloneResourceli.find('span').length;
if(rs_eq2 >= rs_span_total) {
$.sc.step7Call(rs_eq1+1,0);
return false;
}
var cloneResourceSpan = cloneResourceli.find('span').eq(rs_eq2),
rs_seq = cloneResourceSpan.text();
if(rs_seq == '') {
$.sc.step8();
return false;
}
var scStep7 = $.sc.step7(rs_seq);
scStep7.done(function() {
if(rs_eq2+1 < rs_span_total) $.sc.step7Call(rs_eq1,rs_eq2+1);
else $.sc.step7Call(rs_eq1+1,0);
}).fail(function() {
console.log('scStep7 fail');
});
},
step7: function(rs_seq) { // [clone] pf_resource
var step7_deferred = $.Deferred();
$.post('/template/siteClone', { step:'7', sid:scSid[scIdx], dest_sid:scDest[scIdx], r_seq:rs_seq }, function(r7) {
if(typeof r7.error != 'undefined' && r7.error) {
console.log('step7 reject');
console.log('Resorce Clone error::' + rs_seq + ', ' + r7.error);
$('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list li span[data-seq="' + rs_seq + '"]').addClass('error');
step7_deferred.reject();
} else $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list li .error').remove();
scDestData[scIdx]['resource']['total'] = scDestData[scIdx]['resource']['total'] + 1;
scDestData[scIdx]['resource']['list'].push(rs_seq);
$.sc.strProcess('7');
setTimeout(function() {
step7_deferred.resolve();
}, 100);
}, 'json');
return step7_deferred.promise();
},
step8: function() { // check other site(language site)
$.sc.strProcess('8');
if(isAddLangSite || scIdx+1 == scSid.length) {
location.reload();
} else {
$.sc.initVal();
setTimeout(function() {
$.sc.step0();
}, 500);
}
}
}
$.sc.initVal();
if(isAddLangSite) {
$.sc.strProcess('init');
setTimeout(function() {
$.sc.step0();
}, 600);
} else {
var scCheckModal = $(this).showModalFlat($.lang[LANG]['site.clone.check.title'], $.sc.strCheck(), true, true, function() {
$.sc.strProcess('init');
scCheck.popup = $('.check-popup').prop('checked');
scCheck.music = $('.check-music').prop('checked');
scCheck.gallery = $('.check-gallery').prop('checked');
scCheck.forum = $('.check-forum').prop('checked');
setTimeout(function() {
$.sc.step0();
scCheckModal.modal('hide');
}, 600);
},'cancel','','cl-siteclone cl-cmmodal cl-s-btn w560 cl-p70 cl-p0','','',function() { $('[data-toggle="popover"]').popover(); });
}
}
$.fn.sitePublishVer01 = function(sid,onoff,endCallback) {
var strTitle = (onoff==1) ? $.lang[LANG]['loading.publishing'] : $.lang[LANG]['loading.publishing.off'];
$.progressON(strTitle,'',0,true);
var pbSiteCall = function(slist,sidx) {
if(typeof slist == 'undefined' || typeof slist[sidx] == 'undefined') {
pbEndCall(false);
return false;
}
var s_obj = slist[sidx],
s_orgsid = s_obj['sid'],
s_code = (typeof s_obj['code'] != 'undefined' && s_obj['code']) ? s_obj['code'] : '',
s_sid = (s_code) ? s_orgsid+'__'+s_code : s_orgsid;
$.progressON('', s_orgsid + ((s_code) ? $.lang[LANG]['editor.publish.step2.1'] + ' (' + s_code + ')' : '') + $.lang[LANG]['editor.publish.step2.2'],0,true);
var pbSite_r = pbSite(s_sid,onoff);
pbSite_r.done(function(r2) {
$.progressON('', s_orgsid + ((s_code) ? $.lang[LANG]['editor.publish.step3.1'] + ' (' + s_code + ')' : '') + $.lang[LANG]['editor.publish.step3.2'],0,true);
var w = getProgressWidth() + (20/slist.length) * (sidx+1);
$('.progress-bar').css('width',w+'%');
pbGalleryCall(slist,sidx,s_orgsid,s_code,r2.count,0);
}).fail(function(r2_error) {
console.log(r2_error);
pbEndCall(false);
});
}
var pbGalleryCall = function(sitelist,siteidx,sidorg,sidcode,gcount,gpidx) {
var sitesid = (sidcode) ? sidorg+'__'+sidcode : sidorg;
var pbGallery_r = pbGallery(sitesid,onoff,gcount,gpidx,sitelist.length,siteidx);
pbGallery_r.done(function(r3) {
$.progressON('',sidorg + ((sidcode) ? $.lang[LANG]['editor.publish.step4.1'] + ' (' + sidcode + ')' : '') + $.lang[LANG]['editor.publish.step4.2'],0,true);
$('.progress-bar').css('width',r3.w+'%');
if(r3.done == true) pbPagesCall(sitelist,siteidx,sidorg,sidcode,r3.count,0);
else pbGalleryCall(sitelist,siteidx,sidorg,sidcode,gcount,gpidx+1);
}).fail(function(r3_error) {
console.log(r3_error);
pbEndCall(false);
});
}
var pbPagesCall = function(sitelist,siteidx,sidorg,sidcode,bcount,bpidx) {
var sitesid = (sidcode) ? sidorg+'__'+sidcode : sidorg;
var pbPages_r = pbPages(sitesid,onoff,bcount,bpidx,sitelist.length,siteidx);
pbPages_r.done(function(r4) {
$('.progress-bar').css('width',r4.w+'%');
if(r4.done == true) {
if(sitelist.length == (siteidx+1)) pbEndCall(true);
else pbSiteCall(sitelist,siteidx+1);
} else {
pbPagesCall(sitelist,siteidx,sidorg,sidcode,bcount,bpidx+1);
}
}).fail(function(r4_error) {
console.log(r4_error);
pbEndCall(false);
});
}
var pbEndCall = function(isCompleted) {
$('.progress-bar').css('width','100%');
if(!isCompleted) {
$.progressOFF();
return false;
}
if(typeof endCallback == 'function') {
endCallback(sid,onoff);
}
}
var sites_r = sites(sid);
sites_r.done(function(r1) {
$.progressON('',$.lang[LANG]['editor.publish.step1'],0,true);
pbSiteCall(r1.lists,0);
}).fail(function(r1_error) {
console.log(r1_error);
pbEndCall(false);
});
}
$.fn.sitePublishVer02 = function(sid) {
$.progressON($.lang[LANG]['editor.publish.step.start'],'',0,true);
$.sp = {
step: 0,
site_list: {},
site_total: 0,
site_idx: 0,
site_per: 100,
sid: sid,
sid_code: '',
org_sid: sid,
step_k: {'d':3, 'i':2, 'u':1},
step_total: [0,0,0,0],
step_success: [0,0,0,0],
change_total: 0,
change_success: 0,
change_list: {},
per: 0,
error_msg: $.lang[LANG]['editor.publish.step.error'],
end: function(isError) {
if(typeof isError == 'undefined') isError = false;
if(isError) {
$.progressOFF();
$(this).showModalFlat('ERROR',$.sp.error_msg, true, false, '', 'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70');
} else {
var isNext = (typeof $.sp.site_list[$.sp.site_idx+1] != 'undefined' && $.sp.site_idx+1 <= $.sp.site_total) ? true : false;
if(isNext) {
setTimeout(function() {
$.progressON('',$.lang[LANG]['editor.publish.step.restart']);
$('.progress-bar').css('width','0%');
$.sp.site_idx++;
setTimeout(function() {
$.sp.step1();
},1500);
},1500);
} else {
$('.progress-bar').css('width','70%');
setTimeout(function() {
$('.progress-bar').css('width','100%');
if(typeof SLANG != 'undefined' && typeof SLANG.select_code != 'undefined' && SLANG.select_code) {
changeLanguage(SLANG.select_code,'sync_publish');
}
$.progressOFF();
$.processON();
var time = $.now();
$('.processModal p').text('');
$('.processModal p').css({
'width' : '385px',
'height' : '215px',
'top' : '0',
'margin' : 'auto',
'background' : 'none',
});
if($('.processModal').length ==1) {
$.processOFF();
var modal = $(this).showModalFlat($.lang[LANG]['editor.publish.priview.title'],$.lang[LANG]['editor.publish.priview'], true, false ,function(){
window.open(DOMAIN, '_blank');
modal.modal('hide');
},'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70 cl-publish-complete','','',function(){
$('.cl-publish-complete .ok-button-dialog, .cl-publish-complete .close').on('click',function(){
$.processOFF();
});
});
}
}, 500);
}
}
},
step0: function(sid) {
$.sp.step = 0;
var sp0_deferred = $.Deferred();
if(typeof sid == 'undefined') sp0_deferred.reject('sid Undefined :(');
else {
$.ajax({
url : '/template/publishSites',
data : { sid : sid },
type : 'POST',
dataType : 'json',
async : true,
cashe : false,
success : function(data) {
if(typeof data.error != 'undefined' && data.error) {
sp0_deferred.reject(data.error);
return false;
}
$.sp.site_list = data.lists;
$.sp.site_total = data.lists.length;
$.sp.site_idx = 0;
$.sp.site_per = Math.ceil(100 / $.sp.site_total);
$.progressON('',$.lang[LANG]['editor.publish.step.0'],0,true);
$('.progress-bar').css('width','5%');
sp0_deferred.resolve();
}
});
}
return sp0_deferred.promise();
},
step1: function() {
$.sp.step = 1;
$.sp.org_sid = $.sp.site_list[$.sp.site_idx]['sid'];
$.sp.sid_code = $.sp.site_list[$.sp.site_idx]['code'];
$.sp.sid = ($.sp.sid_code) ? $.sp.org_sid+'__'+$.sp.sid_code : $.sp.org_sid;
if($.sp.site_idx > 0) {
$.progressON('', $.sp.org_sid + (($.sp.site_code) ? $.lang[LANG]['editor.publish.step.0.p'] + ' (' + $.sp.site_code + ')' : '') + $.lang[LANG]['editor.publish.step.0.n'],0,true);
$('.progress-bar').css('width','5%');
}
var sp1_1 = $.sp.step1_1();
sp1_1.done(function(r1_1) {
if(r1_1 > 0) $.sp.step2('d',0);
else $.sp.end();
}).fail(function(r1_1_error) {
console.log('r1_1_error: '+r1_1_error);
$.sp.end(true);
});
},
step1_1: function() {
// sites[idx] - pf_site → pb_site (UPDATE or INSERT)
// sites[idx] - pf_site.activate, pb_site.activate = 1 or 9 (UPDATE)
// return pf_publish total list
var sp1_1_deferred = $.Deferred();
$.progressON('', $.sp.org_sid + (($.sp.site_code) ? $.lang[LANG]['editor.publish.step.1.p'] + ' (' + $.sp.site_code + ')' : '') + $.lang[LANG]['editor.publish.step.1.n'],0,true);
$.ajax({
url : '/template/sitepublish1',
data : { sid : $.sp.sid, onoff : 1 },
type : 'POST',
dataType : 'json',
async : true,
cashe : false,
success : function(data1) {
$('.progress-bar').css('width','20%');
$.sp.step_total = [0,0,0,0];
$.sp.step_success = [0,0,0,0];
$.sp.change_total = data1.total;
$.sp.change_success = 0;
$.sp.change_list = {};
$.sp.per = Math.ceil(70 / data1.total);
sp1_1_deferred.resolve(data1.total);
}
});
return sp1_1_deferred.promise();
},
step2: function(step,start) {
// d->i->u
var sp2_1 = $.sp.step2_1(step,start);
sp2_1.done(function(r2_1) {
if(r2_1 > 0) $.sp.step2(step,r2_1);
else {
if(step == 'd') $.sp.step2('i',0);
else if(step == 'i') $.sp.step2('u',0);
else if(step == 'u') $.sp.step3();
else $.sp.end();
}
}).fail(function(r2_1_error) {
console.log('r2_1_error: '+r2_1_error);
$.sp.end(true);
});
},
step2_1: function(this_step,this_start) {
// sites[idx] - pf_publish.pbs_val == pb_page.seq (DELETE | INSERT | UPDATE)
// sites[idx] - pf_publish.pbs_val == pb_gallery.seq (DELETE | INSERT | UPDATE)
// return pb_page.seq, pb_gallery.seq list + (200개씩 처리) more?
// $list = array('b'=>array(), 'g'=>array(), 'next_start'=>$start+$limit);
// json_result(array('result' => 'done pf_publish delete', 'list' => $list, 'total' => $total));
var sp2_1_deferred = $.Deferred();
$.progressON('', $.sp.org_sid + (($.sp.site_code) ? $.lang[LANG]['editor.publish.step.2.p'] + ' (' + $.sp.site_code + ')' : '') + $.lang[LANG]['editor.publish.step.2.n'],0,true);
$.ajax({
url : '/template/sitepublish2/'+this_step,
data : { sid : $.sp.sid, start: this_start },
type : 'POST',
dataType : 'json',
async : true,
cashe : false,
success : function(data2) {
var this_step_k = $.sp.step_k[this_step];
if(this_start > 0) {
$.sp.change_list[this_step].b = $.sp.change_list[this_step].b.concat(data2.list.b);
$.sp.change_list[this_step].g = $.sp.change_list[this_step].g.concat(data2.list.g);
} else {
$.sp.step_total[this_step_k] = data2.total;
$.sp.change_list[this_step] = data2.list;
}
var this_success = data2.list.b.length + data2.list.g.length;
$.sp.step_success[this_step_k] = $.sp.step_success[this_step_k] + this_success;
$.sp.change_success = $.sp.change_success + this_success;
var next_start = ($.sp.step_success[this_step_k] < data2.total) ? data2.list.next_start : 0,
bar_w = 20 + ($.sp.per * $.sp.change_success);
$('.progress-bar').css('width',bar_w+'%');
sp2_1_deferred.resolve(next_start);
}
});
return sp2_1_deferred.promise();
},
step3: function() {
$('.progress-bar').css('width','95%');
var sp3_1 = $.sp.step3_1();
sp3_1.done(function() {
$.sp.end();
}).fail(function(r3_1_error) {
console.log('r3_1_error: '+r3_1_error);
$.sp.end(true);
});
},
step3_1: function() {
// sites[idx] - pf_publish.sid == SID (DELETE)
var sp3_1_deferred = $.Deferred();
$.progressON('', $.sp.org_sid + (($.sp.site_code) ? $.lang[LANG]['editor.publish.step.3.p'] + ' (' + $.sp.site_code + ')' : '') + $.lang[LANG]['editor.publish.step.3.n'],0,true);
$.ajax({
url : '/template/sitepublish3/',
data : { sid : $.sp.sid },
type : 'POST',
dataType : 'json',
async : true,
cashe : false,
success : function(data3) {
$('.progress-bar').css('width','100%');
sp3_1_deferred.resolve();
}
});
return sp3_1_deferred.promise();
}
}
var sp0 = $.sp.step0(sid);
sp0.done(function() {
$.sp.step1();
}).fail(function(r0_error) {
console.log('r0_error: '+r0_error);
$.sp.end();
});
}
$.musicON = function(play) {
play = (typeof play == 'undefined') ? true : play;
var tpl = '\
\
\
\
\
\
\
\
\
\
\
\
\
\
LIST \
\
\
\
\
\
\
Update Required \
To play the media you will need to either update your browser to a recent version or update your
Flash plugin .\
\
\
\
',
equalizer_img = ($('body').width() < 769) ? 'https://storage.googleapis.com/i.addblock.net/equal_stop.gif' : 'https://storage.googleapis.com/i.addblock.net/equal.gif',
checkFree = (!property.VALIDPLAN || property.VALIDTYPE == 'PK') ? true : false,
move_position = (checkFree) ? 'class="moved"' : '',
vpModeOnoff = (property.SETTINGS.vpMode_onoff === true) ? true : false,
vpOption = (property.SETTINGS.viewportMode) ? property.SETTINGS.viewportMode : '',
WebType = $.mpcWeb.mpcCheckWebType(),
checkFnav = ($('.fnav').length > 0 && vpOption=='mobile_web') ? true : false,
$music_icon = $('
');
$('#goto-top').after($music_icon);
$('#cl-music-player-icon').after(tpl);
if($('.fnav').length > 0) {
if(window.innerWidth <= 480) {
$('#goto-top').addClass('movedOne');
$music_icon.addClass('movedOne');
}
}
if(vpModeOnoff && WebType == 'MOBILE') $.mpcWeb.mpcMusicandGoTop(checkFnav,vpOption);
($('body').width() < 769) ? $('.jp-play i').removeClass('fa-pause').addClass('fa-play').parent().addClass('pause') : '';
var music = (typeof property == 'undefined') ? [] : property.MUSIC;
if(music.length==0) {
$music_icon.addClass('hide');
$music_icon.removeClass('movedOne');
$('#goto-top').removeClass('movedOne');
}
var myPlaylist = new jPlayerPlaylist({
jPlayer: '#cl-music-player',
cssSelectorAncestor: '#cl-music-container'
}, music, {
playlistOptions: {
loop: true,
autoPlay: play,
loopOnPrevious: true,
enableRemoveControls: false
},
ended: function() {
// var $item = $('.music-playlist li'),
// idx = $item.parent().find('.active').index(),
// active = (idx+1 > $item.length) ? 0 : idx+1;
// $item.removeClass('active');
// $item.eq(active).addClass('active');
},
swfPath: '/js',
solution: 'html, flash',
supplied: 'mp3',
preload: 'metadata',
volume: 1,
loop: true,
muted: false,
backgroundColor: '#000000',
smoothPlayBar: true,
keyEnabled: true,
audioFullScreen: false // Allows the audio poster to go full screen via keyboard
});
$music_icon.click(function() {
$(this).toggleClass('show');
if($(this).hasClass('show')) {
$('#cl-music-container').css('display','block');
} else {
$('#cl-music-container').css('display','none');
}
});
var $play = $('.jp-play'),
$next = $('.jp-forward'),
$prev = $('.jp-backward'),
$list = $('.music-lists'),
$playlist_wrap = $('.music-playlist-wrap'),
$playlist = $('.music-playlist'),
$item = $('.music-playlist li');
$playlist.empty();
if(myPlaylist.playlist.length) {
var index = myPlaylist.current;
$.each(myPlaylist.playlist, function(i,v) {
var active = (i == index) ? 'jp-playlist-current' : '',
item = '
' + v.title + ' ';
$playlist.append(item);
});
}
$list.click(function() {
$playlist_wrap.toggle();
if($playlist_wrap.css('display') == 'block') {
$list.text('CLOSE');
} else {
$list.text('LIST');
}
});
$('body').on( 'click', '.music-playlist li a', function(e) {
var $pause_icon = '
';
$equalizer = $("#cl-music-player-icon"),
src = 'https://storage.googleapis.com/i.addblock.net/equalizer.gif',
$equalizer.find('img').attr('src',src);
$('.jp-play').removeClass('pause');
$('.jp-play').html($pause_icon);
});
$('.music-playlist li span').click(function() {
var idx = $(this).parent().attr('data-music-index');
if(typeof idx == 'undefined') return;
myPlaylist.play(idx);
myPlaylist.current = idx;
$('.music-playlist li').removeClass('jp-playlist-current');
$('.music-playlist li').eq(idx).addClass('jp-playlist-current');
// $.musicPlay();
});
$play.click(function() {
if($(this).hasClass('pause')) {
$.musicPlay();
} else {
$.musicPause();
}
});
$next.click(function() {
$.musicNext(myPlaylist);
});
$prev.click(function() {
$.musicPrev(myPlaylist);
})
document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 27) {
$.musicPause();
}
};
// myPlaylist.play();
// $('#cl-music-player').jPlayer('play');
}
$.musicPause = function() {
var $play_icon = '
',
$equalizer = $('#cl-music-player-icon'),
src = 'https://storage.googleapis.com/i.addblock.net/equal_stop.gif';
$equalizer.find('img').attr('src',src);
$('.jp-play').addClass('pause');
$('.jp-play').html($play_icon);
$('#cl-music-player').jPlayer('pause');
}
$.musicPlay = function() {
var $pause_icon = "
";
$equalizer = $('#cl-music-player-icon'),
src = 'https://storage.googleapis.com/i.addblock.net/equalizer.gif',
$equalizer.find('img').attr('src',src);
$('.jp-play').removeClass('pause');
$('.jp-play').html($pause_icon);
$('#cl-music-player').jPlayer('play');
}
$.musicStop = function() {
$('#cl-music-player').jPlayer('stop');
}
$.musicRepeat = function() {
}
$.musicOFF = function() {
}
$.musicNext = function(player) {
player.next();
var index = player.current;
$.musicPlay();
}
$.musicPrev = function(player) {
player.previous();
var index = player.current;
$.musicPlay();
}
$.slang = {
init: function(data) {
console.log('modal plugin slang init');
if(typeof data != 'undefined' && data) {
if(PAGE_MODE == 'c') SLANG = data;
else property.SLANG = data;
}
var slang = (PAGE_MODE == 'c') ? SLANG : property.SLANG;
if(!$.isEmptyObject(slang) && slang.use_language=='on') $.slang.set('on');
else $.slang.set('off');
},
set: function(onoff) {
if(onoff.match(/on/gi)) $.slang.make();
else $('#tpl-menu').find('.siteLANG').remove();
},
make: function() {
var slang_data = (PAGE_MODE == 'c') ? SLANG['lists'] : property.SLANG['lists'],
slang_str = (PAGE_MODE == 'c') ? SLANG['select'] : property.SLANG['select'],
slang_list = '';
$.each(slang_data, function(i,o) {
var active = (o['name'] == slang_str) ? 'active' : '';
slang_list += '\
' + o['name'] + ' \
';
});
var content = '\
\
' + slang_str + ' \
\
\
';
if($('#tpl-menu').find('.siteLANG').length > 0) $('#tpl-menu').find('.siteLANG').replaceWith(content);
else $('#tpl-menu').append(content);
}
}
$.fnav = {
getFnav: function() {
var data = (PAGE_MODE == 'c') ? SETTINGS.fnav : property.SETTINGS.fnav;
if(typeof data == 'undefined' || $.isEmptyObject(data)) data = new Array();
return data;
},
getFnavBg: function() {
var bg = (PAGE_MODE == 'c') ? SETTINGS.fnavBg : property.SETTINGS.fnavBg;
if(typeof bg == 'undefined' || !bg) bg = '000000';
else {
if(bg.indexOf('rgb') > -1) bg = style.getHex(bg).substring(1);
}
return bg;
},
checkFnavON: function(data) {
var result = false,
fnav_data = (typeof data != 'undefined') ? data : $.fnav.getFnav();
$.each(fnav_data, function(i,obj) {
if(obj['display'] == 'on') result = true;
});
return result;
},
draw: function(data) {
var fnav_data = (typeof data != 'undefined') ? data : $.fnav.getFnav(),
hasON = $.fnav.checkFnavON(fnav_data);
if (window.location.href.indexOf('_checkout') != -1) hasON = false;
if(!hasON) {
$('.fnav.fnav-mobile-fnav').remove();
} else {
var fnav_html = $.fnav.listHTML(fnav_data,hasON);
if(fnav_html.length > 0) {
if($('.dsgn-body').find('.fnav.fnav-mobile-fnav').length > 0) $('.dsgn-body .fnav.fnav-mobile-fnav').replaceWith(fnav_html);
else $('.dsgn-body').find('.el-footer').before(fnav_html);
} else {
$('.dsgn-body').find('.fnav.fnav-mobile-fnav').remove();
}
}
},
listHTML: function(fnav_data,hasON) {
if(typeof fnav_data == 'undefined') fnav_data = $.fnav.getFnav();
if(typeof hasON == 'undefined') hasON = $.fnav.checkFnavON(fnav_data);
var fnav_bg = $.fnav.getFnavBg(),
str = '';
if(hasON) {
$.each(fnav_data, function(i,v) {
str += $.fnav.itemHTML(v.idx, v.name, v.type, v.value, v.target, v.icon, v.display);
});
}
return '\
\
' + str + '\
\
';
},
itemHTML: function(idx,name,type,value,target,icon,display) {
var href = '#',
attr_target = (type == "tel") ? ' target=""' : ' target="' + target + '"',
attr_link = '';
if(icon == 'empty') icon = '';
if(value) {
if(type == "tel") {
href = (value.match(/^tel:/)) ? value : 'tel:' + value;
} else { //link
if(checkBase64Encode(decodeURIComponent(value))) value = Base64.decode(decodeURIComponent(value));
else value = (checkBase64Encode(value)) ? Base64.decode(value) : value;
var menulist = (PAGE_MODE == 'c') ? MENULIST : property.MENULIST,
one = (PAGE_MODE == 'c') ? ONE : property.ONE,
view = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
href = makeLinkUrl(value,one,view);
if(menulist.indexOf(value.replace(/ /g,'-'))>-1) {
attr_link = 'data-user-link="' + href + '"';
} else if(value.match(/^\@/g)) {
attr_link = 'attr-bookmark="' + value.replace(/^\@/g,'') + '"';
} else {
var link = encodeURIComponent(Base64.encode(value));
attr_link = 'attr-link="' + link + '"';
}
}
}
if(display != 'on') return '';
else return '\
\
';
},
}
$.mpcWeb = {
init: function(vpOption,contents,WebType,zoom,pagemove) {
var device_w = (vpOption=='mobile_pc') ? 1440 : 'device-width',
scale = (vpOption=='mobile_pc') ? (window.screen.width / 1440) : 1.0,
zoom = (zoom) ? '' : ', maximum-scale=1, user-scalable=no',
mpc_icon = (vpOption == 'mobile_pc') ? '
' : '
',
checkFnav = ($('.fnav').length > 0 && vpOption=="mobile_web") ? true : false;
//$.mpcWeb.mpcWebShowcase(vpOption,contents,pagemove);
$('.dsgn-body .mobilepc_ch .mpc_icon').remove();
$('.dsgn-body .mobilepc_ch').prepend(mpc_icon);
var viewport = document.querySelector('meta[name="viewport"]');
if(viewport) viewport.setAttribute('content','width='+device_w+', initial-scale='+scale+''+zoom+'');
/*if($('.dsgn-body').hasClass('sidebar')) {
$('.dsgn-body').removeClass('sidebar').addClass('removed-sidebar');
} else if ($('.dsgn-body').hasClass('removed-sidebar')) {
$('.dsgn-body').removeClass('removed-sidebar').addClass('sidebar');
}*/
$.mpcWeb.mpcMusicandGoTop(checkFnav,vpOption);
if(checkFnav && WebType == 'MOBILE') {
$('.fnav.fnav-mobile-fnav').css('margin-bottom','53px');
$('.element.el-footer').css('margin-bottom','100px');
} else {
$('.mobilepc_ch').css('margin-bottom','0px');
$('.element.el-footer').css('margin-bottom','0px');
}
},
mpcWebhtml: function(vpOption,contents,zoom,pagemove,sid) {
//if (window.location.href.indexOf('_checkout') != -1) return false;
sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID);
pagemove = ((typeof pagemove == 'undefined') || !pagemove) ? '' : pagemove;
$.mpcWeb.mpcCookie(vpOption,sid);
if($.cookie('vpmode')) {
vpOption = $.cookie('vpmode');
}
var vpChangeText = (vpOption=="mobile_pc") ? $.lang[LANG]['editor.mobile.changePc.mobileWeb'] : $.lang[LANG]['editor.mobile.changePc.mobilePc'],
mpc_html = "\
\
\
" + vpChangeText + " \
\
\
",
WebType = $.mpcWeb.mpcCheckWebType();
if(WebType == 'MOBILE') {
if(window.location.href.indexOf('_checkout') == -1) {
$('.dsgn-body').find('.mobilepc_ch').remove();
$('.dsgn-body').append(mpc_html);
}
$.mpcWeb.init(vpOption,contents,WebType,zoom,pagemove);
$.mpcWeb.mpcChangeVal(vpOption,contents,WebType,zoom,pagemove,sid);
}
},
mpcWebShowcase : function(vpOption,contents,pagemove) {
$.each(contents,function(i,v) {
var v_el = (pagemove=='pagemove') ? v : v.element;
if((vpOption == "mobile_pc") && (v_el.type == 'showcase')) $("."+v_el.elname).addClass('mobilePc_height');
else $("."+v_el.elname).removeClass('mobilePc_height');
});
},
mpcChangeVal : function(vpOption,contents,WebType,zoom,pagemove,sid) {
//if (window.location.href.indexOf('_checkout') != -1) return false;
sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID);
$('.mobilepc_ch').on('click', function() {
vpOption = (vpOption=="mobile_pc") ? 'mobile_web' : 'mobile_pc';
var vpChangeText = (vpOption=="mobile_pc") ? $.lang[LANG]['editor.mobile.changePc.mobileWeb'] : $.lang[LANG]['editor.mobile.changePc.mobilePc'];
$.mpcWeb.init(vpOption,contents,WebType,zoom,pagemove);
$(this).find('.mpc-name').text(vpChangeText);
$(this).attr('data-desktop-option',vpOption);
if(typeof property != 'undefined') {
if(property.ONE && !property.VIEW || property.PAGE == property.MENULINK[0] && !property.VIEW) setSitePopup();
}
if($('.element[data-type="gallery"][data-msny="true"]').length > 0) {
$('.element[data-type="gallery"][data-msny="true"]').each(function() {
RENDER.refreshMasonry($(this).attr('data-name'));
});
}
$('.element[data-type="gallery"]').each(function() {
var elname = 'userEL'+$(this).attr('data-id');
if($(this).find('.goption[data-gh]').length>0) {
refreshGalleryHeight(elname);
}
});
if($('.element[data-type="forum"]').length > 0) {
var icon_notice = '
';
$('.element[data-type="forum"] .tpl-forum-list-title .tpl-forum-list-notice-icon').remove();
$('.element[data-type="forum"]').each(function(idx, v) {
var $forum = $(v);
var type = $(v).attr('data-type2');
if($forum.find('.tpl-forum-list-title[data-option="N"]').length > 0) { //forum notice
if(vpOption == 'mobile_web' && type == 'thumb') {
$forum.find('.tpl-forum-list-num.n').each(function(idx, n){
var num = $(n).attr('data-fm-num');
$(n).html(num);
});
} else {
$forum.find('.tpl-forum-list-num.n').html(icon_notice);
}
if($forum.find('.tpl-forum-list-num').hasClass('hidden')) { // field_disabled = num
$forum.find('.tpl-forum-list-title[data-option="N"]').prepend(icon_notice);
} else {
if(vpOption == 'mobile_web') {
$forum.find('.tpl-forum-list-title[data-option="N"]').prepend(icon_notice);
if(type == 'normal' && $forum.find('.tpl-forum-list-num').css('display') != 'none') {
$forum.find('.tpl-forum-list-title .tpl-forum-list-notice-icon').addClass('hide');
}
} else {
$forum.find('.tpl-forum-list-num.n').html(icon_notice);
}
}
}
});
}
$.mpcWeb.mpcCookie(vpOption,sid);
if (window.location.href.indexOf('_checkout') != -1) {
$('.dsgn-body').find('.mobilepc_ch').remove();
}
if($('body').hasClass('openBandBanner')) $.siteBanner.call('band',false,false,true,true)
if($('body').hasClass('openPopupBanner')) $.siteBanner.call('popup',false,false,true,true)
setTimeout(function(){
$.fheader.position();
setFixedMenuCss(false);
},50);
});
},
mpcCheckWebType : function(){
var filter = "win16|win32|win64|mac|macintel",
WebType = "";
if (navigator.platform) {
if (filter.indexOf(navigator.platform.toLowerCase()) < 0) WebType = "MOBILE";
else WebType = "PC";
}
return WebType;
},
mpcMusicandGoTop : function(checkFnav,vpOption) {
var checkmpc = ($('.mobilepc_ch').length > 0) ? true : false;
if(checkmpc && vpOption == 'mobile_pc') {
if($('#cl-music-player-icon').length > 0) $('#goto-top,#cl-music-player-icon').removeClass('moveMpc movepc movedOne').addClass('moved');
else $('#goto-top,#cl-music-player-icon').removeClass('movedOne moveMpc movepc').addClass('moved');
} else {
if(checkFnav) {
if($('#cl-music-player-icon').length > 0) {
$('#goto-top').css('bottom','');
$('#goto-top,#cl-music-player-icon').removeClass('movedOne movepc moved').addClass('moveMpc');
} else $('#goto-top').removeClass('movedOne movepc moved moveMpc').css('bottom','120px');
} else {
if($('#cl-music-player-icon').length > 0) $('#goto-top,#cl-music-player-icon').removeClass('moveMpc movepc moved').addClass('movedOne');
else $('#goto-top,#cl-music-player-icon').removeClass('movedOne movepc moveMpc moved');
}
}
},
mpcCookie : function(vpOption,sid) {
sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID);
var date = new Date();
date.setTime(date.getTime() + 6*60*60*1000); // 6h
$.cookie('vpmode-'+sid, vpOption, { expires: date, path : '/' });
},
mpcGetVpmode : function(vpmode,settings,sid) {
sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID);
if($.cookie('vpmode-'+sid)) vpmode = $.cookie('vpmode-'+sid);
else vpmode = (typeof $('.mobilepc_ch').attr('data-desktop-option') != 'undefined') ? $('.mobilepc_ch').attr('data-desktop-option') : settings.viewportMode;
return vpmode;
}
}
/* menu 추가 버튼 설정 **************************************************************/
$.menuFixBtn = {
topSet : function(num,checkmodal,validArray,slang){
var str = '',
searchOn = '',
cartOn = '',
umOn = '',
ssid = (PAGE_MODE == 'c') ? SID : property.SID,
is_templates = checkTemplateSite(ssid),
s_service = (PAGE_MODE == 'c') ? SERVICE : property.SERVICE,
checkGabia = (s_service.indexOf('gabia') > -1) ? true : false,
checkBS = (validArray['validplan'] && (validArray['validtype'] == 'BS' || (checkGabia && (validArray['validtype'] == 'FR')))) ? true : false,
checkBN = (validArray['validplan'] && validArray['validtype'] == 'BN') ? true : false,
checkSM = (validArray['validplan'] && validArray['validtype'] == 'SM') ? true : false,
checkFREE = (!validArray['validplan'] || validArray['validplan'] == 'FR' || validArray['validplan'] == 'PK') ? true : false,
checkElView = ($('.elviewhtml').length>0) ? true : false,
fixBtnSITEUM = (checkElView) ? '' : ((PAGE_MODE=='c') ? SITEUM : property.SITEUM),
checkSITEUM = (!checkElView && ((checkBN && typeof fixBtnSITEUM!='undefined' && Number(fixBtnSITEUM) > 0) || checkSM)) ? true : (checkElView ? true : false),
checkmodal = (typeof checkmodal != 'undefined' && checkmodal) ? true : false,
fixon = (typeof $('.el-menu header.navbar').attr('data-fixon') != 'undefined' && $('.el-menu header.navbar').attr('data-fixon')) ? $('.el-menu header.navbar').attr('data-fixon') : '',
dropdownClass = (PAGE_MODE=='c') ? '' : 'dropdown ',
slang = (typeof langObj != 'undefined' && langObj) ? langObj : ((PAGE_MODE == 'c') ? SLANG : property.SLANG);
// lang_str = LANG;
if(!checkElView) {
if(checkBN && !checkSITEUM) return '';
searchOn = (!checkSM) ? 'style="display:none;"' : '';
umOn = (checkBS || checkFREE || (checkBN && !checkSITEUM)) ? 'style="display:none;"' : '';
cartOn = (checkFREE) ? 'style="display:none;"' : ((checkSM) ? '' : 'style="display:none;"');
if(fixon && (checkBN || checkSM) && checkSITEUM) {
searchOn = ((checkSM) && fixon.indexOf('search')>-1) ? '' : 'style="display:none;"';
cartOn = ((checkSM) && fixon.indexOf('cart')>-1) ? '' : 'style="display:none;"';
}
}
if(checkElView || checkmodal || is_templates) {
umOn = (checkBS || checkFREE) ? 'style="display:none;"' : '';
searchOn = cartOn = (checkSM) ? '' : 'style="display:none;"';
}
/* 다국어 / 사이트 언어별 lang 체크 ***/
// if((typeof slang != 'undefined' && typeof slang.select_code != 'undefined' && slang.select_code)
// || (!$.isEmptyObject(slang) && slang.select_code)) {
// //searchOn = (slang['select_code']=='ko' && checkSM) ? '' : 'style="display:none;"';
// lang_str = (slang['select_code'].toLowerCase()=='ko') ? 'ko' : lang_str;
// }
switch(num) {
case "01" :
str = '\
SEARCH \
\
LOGIN \
MY PAGE \
\
CART 5
\
';
break;
case "02" :
str = '\
Search \
\
Login \
My page \
\
\
Basket 5
\
\
';
break;
case "03" :
str = '\
검색 \
\
로그인 \
마이페이지 \
\
\
장바구니 \
5
\
\
\
';
break;
case "04" :
str = '\
'+clSVG('fixbtn_search04',28,28,true)+' \
\
'+clSVG('fixbtn_um_login_04',28,28,true)+' \
'+clSVG('fixbtn_um_mypage_04',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart04',28,28,true)+'\
5
\
\
\
';
break;
case "05" :
str = '\
'+clSVG('fixbtn_search05',28,28,true)+' \
\
'+clSVG('fixbtn_um_login05',28,28,true)+' \
'+clSVG('fixbtn_um_mypage05',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart05',28,28,true)+'\
5
\
\
\
';
break;
case "06" :
str = '\
'+clSVG('fixbtn_search06',28,28,true)+' \
\
'+clSVG('fixbtn_um_login06',28,28,true)+' \
'+clSVG('fixbtn_um_mypage06',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart06',28,28,true)+'\
5
\
\
\
';
break;
case "07" :
str = '\
'+clSVG('fixbtn_search07',28,28,true)+' \
\
'+clSVG('fixbtn_um_login07',28,28,true)+' \
'+clSVG('fixbtn_um_mypage07',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart07',28,28,true)+'\
5
\
\
\
';
break;
case "08" :
str = '\
'+clSVG('fixbtn_search08',28,28,true)+'SEARCH \
\
'+clSVG('fixbtn_um_login08',28,28,true)+'LOGIN \
'+clSVG('fixbtn_um_mypage08',28,28,true)+'MY PAGE \
\
\
'+clSVG('fixbtn_cart08',28,28,true)+'\
CART 5
\
\
\
';
break;
case "09" :
str = '\
검색 \
\
로그인 \
마이페이지 \
\
\
'+clSVG('fixbtn_cart09',28,28,true)+'\
5
\
\
\
';
break;
case "10" :
str = '\
\
LOGIN \
MY PAGE \
\
'+clSVG('fixbtn_search10',28,28,true)+' \
\
'+clSVG('fixbtn_cart09',28,28,true)+'\
5
\
\
\
';
break;
default :
break;
}
return str;
},
sidebarSet : function(num,checkmodal,validArray,slang) {
var str = '',
searchOn = '',
cartOn = '',
umOn = '',
ssid = (PAGE_MODE == 'c') ? SID : property.SID,
is_templates = checkTemplateSite(ssid),
s_service = (PAGE_MODE == 'c') ? SERVICE : property.SERVICE,
checkGabia = (s_service.indexOf('gabia') > -1) ? true : false,
checkBS = (validArray['validplan'] && (validArray['validtype'] == 'BS' || (checkGabia && (validArray['validtype'] == 'FR')))) ? true : false,
checkBN = (validArray['validplan'] && validArray['validtype'] == 'BN') ? true : false,
checkSM = (validArray['validplan'] && validArray['validtype'] == 'SM') ? true : false,
checkFREE = (!validArray['validplan'] || validArray['validplan'] == 'FR' || validArray['validplan'] == 'PK') ? true : false,
checkElView = ($('.elviewhtml').length>0) ? true : false,
fixBtnSITEUM = (checkElView) ? '' : ((PAGE_MODE=='c') ? SITEUM : property.SITEUM),
checkSITEUM = (!checkElView && ((checkBN && typeof fixBtnSITEUM!='undefined' && Number(fixBtnSITEUM) > 0) || checkSM)) ? true : (checkElView ? true : false),
checkmodal = (typeof checkmodal != 'undefined' && checkmodal) ? true : false,
fixon = (typeof $('.el-menu header.navbar').attr('data-fixon') != 'undefined' && $('.el-menu header.navbar').attr('data-fixon')) ? $('.el-menu header.navbar').attr('data-fixon') : '',
dropdownClass = (PAGE_MODE=='c') ? '' : 'dropdown ',
slang = (typeof langObj != 'undefined' && langObj) ? langObj : ((PAGE_MODE == 'c') ? SLANG : property.SLANG);
// lang_str = LANG;
if(!checkElView) {
searchOn = (!checkSM) ? 'style="display:none;"' : '';
umOn = (checkBS || checkFREE || (checkBN && !checkSITEUM)) ? 'style="display:none;"' : '';
cartOn = (checkFREE) ? 'style="display:none;"' : ((checkSM) ? '' : 'style="display:none;"');
if(fixon && (checkBN || checkSM) && checkSITEUM) {
searchOn = ((checkSM) && fixon.indexOf('search')>-1) ? '' : 'style="display:none;"';
cartOn = ((checkSM) && fixon.indexOf('cart')>-1) ? '' : 'style="display:none;"';
}
}
if(checkElView || checkmodal || is_templates) {
umOn = (checkBS || checkFREE) ? 'style="display:none;"' : '';
searchOn = cartOn = (checkSM) ? '' : 'style="display:none;"';
}
/* 다국어 / 사이트 언어별 lang 체크 ***/
// if((typeof slang != 'undefined' && typeof slang.select_code != 'undefined' && slang.select_code)
// || (!$.isEmptyObject(slang) && slang.select_code)) {
// //searchOn = (slang['select_code']=='ko' && checkSM) ? '' : 'style="display:none;"';
// lang_str = (slang['select_code'].toLowerCase()!='ko') ? 'en' : 'ko';
// }
switch(num) {
case "01" :
str = '\
SEARCH \
\
LOGIN \
MY PAGE \
\
CART 5
\
';
break;
case "02" :
str = '\
Search \
\
Login \
My page \
\
\
Basket 5
\
\
';
break;
case "03" :
str = '\
검색 \
\
로그인 \
마이페이지 \
\
\
장바구니 \
5
\
\
\
';
break;
case "04" :
str = '\
'+clSVG('fixbtn_search04',28,28,true)+' \
\
'+clSVG('fixbtn_um_login_04',28,28,true)+' \
'+clSVG('fixbtn_um_mypage_04',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart04',28,28,true)+'\
5
\
\
\
';
break;
case "05" :
str = '\
'+clSVG('fixbtn_search05',28,28,true)+' \
\
'+clSVG('fixbtn_um_login05',28,28,true)+' \
'+clSVG('fixbtn_um_mypage05',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart05',28,28,true)+'\
5
\
\
\
';
break;
case "06" :
str = '\
'+clSVG('fixbtn_search06',28,28,true)+' \
\
'+clSVG('fixbtn_um_login06',28,28,true)+' \
'+clSVG('fixbtn_um_mypage06',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart06',28,28,true)+'\
5
\
\
\
';
break;
case "07" :
str = '\
'+clSVG('fixbtn_search07',28,28,true)+' \
\
'+clSVG('fixbtn_um_login07',28,28,true)+' \
'+clSVG('fixbtn_um_mypage07',28,28,true)+' \
\
\
'+clSVG('fixbtn_cart07',28,28,true)+'\
5
\
\
\
';
break;
case "08" :
str = '\
'+clSVG('fixbtn_search08',28,28,true)+'SEARCH \
\
'+clSVG('fixbtn_um_login08',28,28,true)+'LOGIN \
'+clSVG('fixbtn_um_mypage08',28,28,true)+'MY PAGE \
\
\
'+clSVG('fixbtn_cart08',28,28,true)+'\
CART 5
\
\
\
';
break;
case "09" :
str = '\
검색 \
\
로그인 \
마이페이지 \
\
\
'+clSVG('fixbtn_cart09',28,28,true)+'\
5
\
\
\
';
break;
case "10" :
str = '\
\
LOGIN \
My page \
\
'+clSVG('fixbtn_search10',28,28,true)+' \
\
'+clSVG('fixbtn_cart09',28,28,true)+'\
5
\
\
\
';
break;
default :
break;
}
return str;
},
fixFhTypeSet : function(pos) {
var str = '';
switch(pos) {
case "right" :
str += '\
\
\
';
break;
case "top" :
str += '\
\
\
';
break;
default :
break;
}
return str;
},
fixLangSet : function(num,def,langObj,checkMobile,validArray){
var checkElView = ($('.elviewhtml').length>0) ? true : false,
s_service = (PAGE_MODE == 'c') ? SERVICE : property.SERVICE,
checkGabia = (s_service.indexOf('gabia') > -1) ? true : false,
checkVALIDPLAN = (PAGE_MODE=='c') ? VALIDPLAN : property.VALIDPLAN,
checkVALIDTYPE = (PAGE_MODE=='c') ? VALIDTYPE : property.VALIDTYPE,
checkBS = (checkVALIDPLAN && (checkVALIDTYPE == 'BS' || (checkGabia && (checkVALIDTYPE == 'FR')))) ? true : false,
slang = (typeof langObj != 'undefined' && langObj) ? langObj : ((PAGE_MODE == 'c') ? SLANG : property.SLANG),
def = (typeof def!='undefined') ? def : true,
checkMobile = (typeof checkMobile!='undefined') ? checkMobile : false;
if(typeof validArray != 'undefined') var checkFREE = (!validArray['validplan'] || validArray['validplan'] == 'FR' || validArray['validplan'] == 'PK') ? true : false;
if(!checkElView && ((typeof slang == 'undefined' && typeof slang.select_code == 'undefined' && !slang.select_code)
|| ($.isEmptyObject(slang) && checkBS) || slang.select_code=='') || (checkElView && checkFREE)
|| (typeof slang=='undefined' || !slang.select)) {
return false;
}
var str = '',
lang_txt = (typeof slang.select != 'undefined' && slang.select) ? slang.select.trim() : '',
lang_code = (typeof slang.select_code != 'undefined' && slang.select_code) ? slang.select_code.toUpperCase() : '',
checkDropTopClass = ($('.el-menu > header.navbar').hasClass('sidebar') || checkMobile) ? 'dropup' : 'dropdown',
dropdownClass = (PAGE_MODE=='c') ? '' : 'dropdown',
dropdownStr = '';
if(checkMobile) {
dropdownStr += '\
\
';
}
var attrMobile = (checkMobile) ? 'data-toggle="dropdown" data-target="#m-dropdown-wrap-lang"' : '';
switch(num) {
case "01" :
str = (!def) ? '\
' : '\
\
\
'+lang_code+' \
' + clSVG('fixbtn_arrow01',16,16,true) + '\
' + dropdownStr + '\
\
';
break;
case "02" :
str = (!def) ? '\
' : '\
\
\
'+lang_txt+' \
' + clSVG('fixbtn_arrow01',16,16,true) + '\
' + dropdownStr + '\
\
';
break;
case "03" :
str = (!def) ? '\
' : '\
\
\
'+lang_code+' \
' + clSVG('fixbtn_arrow01',16,16,true) + '\
' + dropdownStr + '\
\
';
break;
case "04" :
str = (!def) ? '\
\
' : '\
\
\
'+lang_code+' \
' + clSVG('fixbtn_arrow01',16,16,true) + '\
' + dropdownStr + '\
\
';
break;
case "05" :
str = (!def) ? '\
\
' : '\
\
\
'+lang_code+' \
' + clSVG('fixbtn_lang05',18,18,true) + '\
' + dropdownStr + '\
\
';
break;
case "06" :
str = (!def) ? '\
\
' : '\
\
\
' + clSVG('fixbtn_lang05',18,18,true) + '\
'+lang_code+' \
' + dropdownStr + '\
\
';
break;
case "07" :
str = (!def) ? '\
\
' : '\
\
\
\
'+lang_txt+' \
' + clSVG('fixbtn_arrow01',16,16,true) + '\
' + dropdownStr + '\
\
';
break;
case "08" :
str = (!def) ? '\
\
' : '\
\
\
\
'+lang_txt+' \
' + clSVG('fixbtn_arrow01',16,16,true) + '\
' + dropdownStr + '\
\
';
break;
case "09" :
str = (!def) ? '\
\
\
\
' + dropdownStr + '\
\
' : '\
\
\
\
' + dropdownStr + '\
\
';
break;
case "10" :
str = (!def) ? '\
' : '\
\
\
'+lang_code+' \
' + dropdownStr + '\
\
';
break;
default :
break;
}
return str;
},
getData : function($h) {
var data = [],
dataFix = ['fixtype','fixlangtype','fh-type','fixsize','fixlangsize','fixtypeText','fixtypeNum','fixlangtypeNum'];
$.each(dataFix, function(i,v){
var dataV = 'data-'+v;
data[v] = (typeof $h.attr(dataV)!='undefined' && $h.attr(dataV)) ? $h.attr(dataV) : '';
if(data['fixtype']!='undefined' && data['fixtype']) {
if(v=='fixtypeText') data[v] = data['fixtype'].replace(/\_\d+/gi,'');
else if(v=='fixtypeNum') data[v] = data['fixtype'].replace(/(top|sidebar)\_/gi,'');
else if(v=='fixlangtypeNum') data[v] = data['fixlangtype'].replace(/lang\_/gi,'');
}
})
return data;
}
}
/*** shopping Guide Popup ***/
$.guidePopup = {
set: function() {
var str = '\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.title']+' \
\
\
\
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.title']+' \
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.1.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.2.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.3.contents']+'
\
\
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.title']+' \
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.1.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.2.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.3.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.4.contents']+'
\
\
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3.title']+' \
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3.1.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3.2.contents']+'
\
\
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4.title']+' \
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4.1.contents']+'
\
\
'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4.2.contents']+'
\
\
\
\
\
\
';
var shopguideModal = $(this).showModalFlat('',str,true,false,'','close','','guidePopup cl-cmmodal cl-s-btn cover w700', false ,'',function() {
$.guidePopup.scrollevent();
});
},
scrollevent : function() {
$('.guidePopup-wrap').on('shown.bs.modal', function(e) {
$('.guidePopup .guide-wrap').scroll(function() {
if($(this).hasClass('moving')) return false;
var scrollValue = $('.guidePopup .guide-wrap').scrollTop(),
issclogin = ($('.guidePopup').attr('class').indexOf('sclogin') > 0 || $('.guidePopup').attr('class').indexOf('naverpay-guide') > 0) ? true : false,
isCert = ($('.guidePopup').attr('class').indexOf('cert-guide-modal') > 0)? true : false;
if(issclogin || isCert) {
if( scrollValue >= $("#step2").position().top && scrollValue < $("#step3").position().top) {
$('.guidePopup ul li:visible').eq(1).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li:visible').eq(1).css('zIndex', '2').siblings().css('zIndex', '1');
} else if( scrollValue >= $("#step3").position().top) {
$('.guidePopup ul li:visible').eq(2).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li:visible').eq(2).css('zIndex', '2').siblings().css('zIndex', '1');
} else {
$('.guidePopup ul li:visible').eq(0).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li:visible').eq(0).css('zIndex', '2').siblings().css('zIndex', '1');
}
} else {
if( scrollValue >= $("#step2").position().top && scrollValue < $("#step3").position().top) {
$('.guidePopup ul li').eq(1).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li').eq(1).css('zIndex', '2').siblings().css('zIndex', '1');
} else if( scrollValue >= $("#step3").position().top && scrollValue < $("#step4").position().top) {
$('.guidePopup ul li').eq(2).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li').eq(2).css('zIndex', '2').siblings().css('zIndex', '1');
} else if($("#step4").length > 0 && scrollValue >= $("#step4").position().top) {
$('.guidePopup ul li').eq(3).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li').eq(3).css('zIndex', '2').siblings().css('zIndex', '1');
} else {
$('.guidePopup ul li').eq(0).addClass('active').siblings().removeClass('active');
$('.guidePopup ul li').eq(0).css('zIndex', '2').siblings().css('zIndex', '1');
}
}
});
$('.guidePopup .guide-menu li').click(function() {
if($('.guidePopup .guide-wrap').hasClass('moving')) return false;
$('.guidePopup .guide-wrap').addClass('moving');
var top = ($(this).index())+1,
top_position = (top==1) ? $('#step'+top).position().top : ($('#step'+top).position().top)+60;
$('.guidePopup .guide-wrap').animate({scrollTop : top_position}, 1000, 'easeInOutExpo');
setTimeout(function() {
$('.guidePopup .guide-wrap').removeClass('moving');
},1000);
$(this).addClass('active').siblings().removeClass('active');
$(this).css('zIndex', '2').siblings().css('zIndex', '1');
});
});
}
}
$.siteBanner = {
checkOffer: function(type) {
// console.log('checkOffer('+type+')');
var checkPlan = (typeof VALIDPLAN == 'undefined') ? property.VALIDPLAN : VALIDPLAN,
checkPlanType = (typeof VALIDTYPE == 'undefined') ? property.VALIDTYPE : VALIDTYPE;
if(!checkPlan || checkPlanType == 'PK') {
return false;
}
var site_settings = (typeof property != 'undefined') ? property.SETTINGS : SETTINGS
$.siteBanner.sid = (typeof property != 'undefined') ? property.SID : SID;
if(typeof $.siteBanner.sid == 'undefined' || !$.siteBanner.sid || typeof site_settings == 'undefined' || !site_settings) {
return false;
}
// var clpathname = /^\/\_register|^\/\_login|^\/\_forgot|^\/\_checkout|^\/\_cart|^\/\_mypayment|^\/\_payment|^\/psearch/gi;
// if(typeof location.pathname != 'undefined' && location.pathname.match(clpathname) !== null) {
// return false;
// }
if(type == 'popup') {
if(site_settings.SITELOCK) return false;
if(typeof property != 'undefined') {
var checkFirstPage = (property.ONE && !property.VIEW || property.PAGE == property.MENULINK[0] && !property.VIEW) ? true : false;
if(!checkFirstPage) return false;
} else {
var checkFirstPage = (ONE && !VIEW || PAGE == MENULINK[0] && !VIEW) ? true : false;
if(!checkFirstPage) return false;
}
}
return true;
},
clearCloseCookie: function(type) {
// console.log('clearCloseCookie('+type+')');
var isBoth = (typeof type == 'undefined') ? true : false,
isBand = (isBoth || !isBoth && type == 'band') ? true : false,
isPopup = (isBoth || !isBoth && type == 'popup') ? true : false;
if(isBand) {
var band_id = $.siteBanner.sid + 'BandBanner';
$.removeCookie(band_id, { path : '/' });
}
if(isPopup) {
if(typeof $.siteBanner.popup != 'undefined' && typeof $.siteBanner.popup.list != 'undefined') {
$.each($.siteBanner.popup.list, function(id,o) {
var popup_id = $.siteBanner.sid + 'PopupBanner' + id;
$.removeCookie(popup_id, { path : '/' });
});
}
}
},
doNotOffer: function(type,isSC) {
// console.log('doNotOffer(type:'+type+', isSC: '+isSC+')');
if(isSC) $.siteBanner.clearCloseCookie(type);
var isBoth = (typeof type == 'undefined') ? true : false,
isBand = (isBoth || !isBoth && type == 'band') ? true : false,
isPopup = (isBoth || !isBoth && type == 'popup') ? true : false;
if(isBand) {
$.siteBanner.stopBandRolling();
$('body, .cl-bandBanner').removeClass('openBandBanner');
$('.cl-bandBanner, .el-menu_ctrl, .header.el-menu > header').removeInlineCss('margin-top');
document.querySelector('.dsgn-body').style.setProperty('--bandBanner-height-pc', null, null);
document.querySelector('.dsgn-body').style.setProperty('--bandBanner-height-mobile', null, null);
if($('.dsgn-body').hasClass('sidebar')) $('.dsgn-body').removeInlineCss('padding-top');
$('.cl-bandBanner').remove();
$('.element[data-type="gallery"][data-type2="premium"]').refreshRootCss();
$.fheader.position();
}
if(isPopup) {
$('body, .cl-popupBanner').removeClass('openPopupBanner');
$('.cl-popupBanner').remove();
}
},
init: function(checkBand,checkPopup) {
// console.log('init('+checkBand+','+checkPopup+')');
if(checkBand) $.siteBanner.call('band',false,true,true,true);
if(checkPopup) $.siteBanner.call('popup',false,true,true,true);
if(typeof property == 'undefined') {
$(document).on('mouseenter', '.cl-bandBanner, .cl-popupBanner', function() {
if(isEDIT) return;
else outElementButtonDisplay();
});
}
$(document).on('mouseenter', '.cl-bandBanner', function() {
$.siteBanner.band.paused = true;
}).on('mouseleave', '.cl-bandBanner', function() {
$.siteBanner.band.paused = false;
});
$(document).on('click','.cl-bandBanner .banner-closetoday,\
.cl-bandBanner .banner-close,\
.cl-popupBanner .banner-closetoday,\
.cl-popupBanner .banner-close', function() {
var bannerEL = $(this).closest('.banner-box'),
banner_id = bannerEL.attr('id'),
banner_type = bannerEL.attr('data-type'),
banner_closetime = bannerEL.attr('data-closetime'),
clickBtn = $(this),
isCloseToday = $(this).is('.banner-closetoday'),
date = new Date();
if(banner_type == 'band' && !clickBtn.closest('.banner-header').find('.banner-closetoday').hasClass('hide')) isCloseToday = true;
var time_val = {
'always' : 0,
'onlyone' : 365 * 24 * 60 * 60 * 1000,
'week' : 7 * 24 * 60 * 60 * 1000,
'day' : 24 * 60 * 60 * 1000,
'12hours' : 12 * 60 * 60 * 1000,
'6hours' : 6 * 60 * 60 * 1000,
'2hours' : 2 * 60 * 60 * 1000,
'1hours' : 60 * 60 * 1000,
'30min' : 30 * 60 * 1000,
'10min' : 10 * 60 * 1000,
'3min' : 3 * 60 * 1000,
};
if(isCloseToday) date.setTime(date.getTime() + time_val['day']);
else date.setTime(date.getTime() + time_val[banner_closetime]);
if(banner_type == 'band') {
$.siteBanner.stopBandRolling();
banner_id = banner_id.replace(/BandBanner[0-9]+$/,'BandBanner');
}
$('#'+banner_id).addClass('hide');
if(isCloseToday || (typeof banner_closetime != 'undefined' && banner_closetime != 'always' && banner_closetime != '')) {
$.cookie(banner_id, true, { path: '/', expires: date});
}
$.siteBanner[banner_type].total--;
if(banner_type == 'band') {
$.siteBanner.band.used = false;
$.siteBanner.call('band',false,false,true,true);
}
});
},
call: function(type,isSC,isGet,isSet,isPosition) {
// console.log('call(type: '+type+',isSC: '+isSC+',isGet: '+isGet+',isSet: '+isSet+',isPosition: '+isPosition+')')
var isOffer = $.siteBanner.checkOffer(type);
if(!isSC && !isOffer) {
$.siteBanner.doNotOffer(type,isSC);
return false;
}
var isBand = (type == 'band') ? true : false,
isPopup = (type == 'popup') ? true : false,
banner_fn_obj = {'call':false, 'get':false, 'set':false, 'position':false};
if(isBand) {
if(typeof $.siteBanner.band == 'undefined') $.siteBanner.band = {'seqs':[], 'paused':false};
else $.siteBanner.stopBandRolling();
$.siteBanner.band.body = ($.inArray(PAGE_MODE, ['s','r']) > -1) ? window : '.dsgn-body';
if(isSC) {
var band_fn = banner_fn_obj;
if( typeof $.siteBanner.band != 'undefined' &&
typeof $.siteBanner.band.fn != 'undefined' &&
typeof $.siteBanner.band.fn_keep != 'undefined'
) {
band_fn = $.siteBanner.band.fn;
delete $.siteBanner.band.fn_keep;
}
$.siteBanner.band.fn = band_fn;
}
}
if(isPopup) {
if(typeof $.siteBanner.popup == 'undefined') $.siteBanner.popup = {};
if(isSC) {
var popup_fn = banner_fn_obj;
if( typeof $.siteBanner.popup != 'undefined' &&
typeof $.siteBanner.popup.fn != 'undefined' &&
typeof $.siteBanner.popup.fn_keep != 'undefined'
) {
popup_fn = $.siteBanner.popup.fn;
delete $.siteBanner.popup.fn_keep;
}
$.siteBanner.popup.fn = popup_fn;
}
}
var step1 = $.siteBanner.get(type,isSC,isGet);
step1.done(function() {
var step2 = $.siteBanner.set(type,isSC,isSet);
step2.done(function() {
if($.siteBanner[type].used) {
var step3 = $.siteBanner.position(type,isSC,isPosition);
step3.done(function(step3_r) {
}).fail(function(step3_error) {
});
}
}).fail(function(step2_error) {
});
}).fail(function(step1_error) {
});
},
get: function(type,isSC,isGet) {
// console.log('get(type: '+type+',isSC: '+isSC+',isGet: '+isGet+')');
var deferred01 = $.Deferred(),
isBand = (type == 'band') ? true : false,
isPopup = (type == 'popup') ? true : false,
publish = (typeof property != 'undefined') ? property.PUBLISH : false;
if(!isGet) deferred01.resolve();
else {
if(PAGE_MODE == 'c'){ // config(사이트편집)
$.post('/template/siteBanner/type/get',{ publish:publish, sid:$.siteBanner.sid, v:type }, function(data) {
checkError(data);
if(typeof data == 'object') {
$.siteBanner[type]['sort'] = data.sort;
$.siteBanner[type]['list'] = data.list;
$.siteBanner[type]['used'] = data.used;
$.siteBanner[type]['total'] = data.sort.length;
$.siteBanner[type]['close_time'] = data.close_time;
$.siteBanner[type]['close_today'] = data.close_today;
if(isBand) {
$.siteBanner[type]['close_onoff'] = data.close_onoff;
$.siteBanner[type]['interval'] = data.interval;
}
if(isPopup) {
$.siteBanner[type]['position'] = data.position;
}
deferred01.resolve();
} else {
deferred01.reject('get error');
}
}, 'json');
}else{ // render / site
// console.log(RENDER.b);
if(isBand) {
$.siteBanner['band']['close_onoff'] = RENDER.b.BAND.close_onoff;
$.siteBanner['band']['interval'] = RENDER.b.BAND.interval;
$.siteBanner['band']['sort'] = RENDER.b.BAND.sort;
$.siteBanner['band']['list'] = RENDER.b.BAND.list;
$.siteBanner['band']['used'] = RENDER.b.BAND.used;
$.siteBanner['band']['total'] = RENDER.b.BAND.sort.length;
$.siteBanner['band']['close_time'] = RENDER.b.BAND.close_time;
$.siteBanner['band']['close_today'] = RENDER.b.BAND.close_today;
}
if(isPopup) {
$.siteBanner['popup']['position'] = RENDER.b.POPUP.position;
$.siteBanner['popup']['sort'] = RENDER.b.POPUP.sort;
$.siteBanner['popup']['list'] = RENDER.b.POPUP.list;
$.siteBanner['popup']['used'] = RENDER.b.POPUP.used;
$.siteBanner['popup']['total'] = RENDER.b.POPUP.sort.length;
$.siteBanner['popup']['close_time'] = RENDER.b.POPUP.close_time;
$.siteBanner['popup']['close_today'] = RENDER.b.POPUP.close_today;
}
deferred01.resolve();
}
}
return deferred01.promise();
},
set: function(type,isSC,isSet) {
// console.log('set(type: '+type+',isSC: '+isSC+',isSet: '+isSet+')');
var deferred02 = $.Deferred(),
isBand = (type == 'band') ? true : false,
isPopup = (type == 'popup') ? true : false,
onoff = $.siteBanner[type].used;
if(isSet && onoff) {
var banner_name = $.siteBanner.sid + (type.charAt(0).toUpperCase() + type.slice(1)) + 'Banner',
b_list = '',
b_idx = 0, b_show = 0,
min = [120, 150],
max = [0, 0],
sum = [0, 0];
$.each($.siteBanner[type].sort, function(idx,id) {
var o = $.siteBanner[type].list[id],
isVisible = (o.visible == 'ON') ? true : false;
if(!isSC && o.period.set && o.period.visible === false) isVisible = false;
if(!isSC && isVisible || isSC) {
var banner_id = banner_name + id,
banner_cookie = (type == 'band') ? banner_name : banner_id,
isCookie = (typeof $.cookie(banner_cookie) != 'undefined' && $.cookie(banner_cookie)) ? true : false;
b_idx++;
if(!isCookie || isSC) {
b_show++;
if(isVisible) {
if(min[0] > Number(o.img.pc.height)) min[0] = Number(o.img.pc.height);
if(max[0] < Number(o.img.pc.height)) max[0] = Number(o.img.pc.height);
if(max[1] < Number(o.img.mobile.height)) max[1] = Number(o.img.mobile.height);
sum[0] += Number(o.img.pc.width);
sum[1] += Number(o.img.mobile.width);
}
}
var banner_label = (isSC) ? '\
\
' + $.lang[LANG]['sc.banner.period.label.start'] + ' \
' + $.lang[LANG]['sc.banner.period.label.end'] + ' \
\
' : '',
banner_str = '';
if(type == 'band') {
var band_img_arr = [o.img.pc.path, o.img.mobile.path],
band_img_root = (isSC) ? ['--scbandBanner-img-pc','--scbandBanner-img-mobile'] : ['--bandBanner-img-pc','--bandBanner-img-mobile'];
$.each(band_img_arr, function(img_i,img_v) {
// img_v+ '?' + new Date().getTime()
var check_img = $('
').attr('src',img_v);
check_img.error(function() {
var img_id = $(this).attr('data-id'),
img_root = $(this).attr('data-root'),
checkSC = $(this).attr('data-sc'),
img_s = (checkSC == 'true') ? 'sc-bandBanner' : 'cl-bandBanner';
document.querySelector('.'+img_s+' .banner-box[data-id="'+img_id+'"] .banner-img').style.setProperty(img_root, 'url(//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png)', null);
});
});
var banner_img_style = band_img_root[0]+': url(' + band_img_arr[0] + '); ' + band_img_root[1] + ': url(' + band_img_arr[1] + ');';
banner_str = '\
\
\
\
\
\
\
' + banner_label + '\
\
\
\
\
';
} else if(type == 'popup') {
banner_str = '\
\
\
\
\
\
\
\
\
\
\
' + banner_label + '\
\
\
\
\
';
}
var bannerItem = $(banner_str);
bannerItem.attr('data-id', id);
bannerItem.attr('data-type', type);
if(isSC) {
if(!isVisible) bannerItem.addClass('hide');
if(o.link.val) {
var blink_o = $.siteBanner.getLINK(o.link.val, o.link.target);
if(blink_o.link) {
bannerItem.find('a').addClass('active');
}
}
} else {
if(isCookie) bannerItem.addClass('hide');
bannerItem.attr('data-closetime', $.siteBanner[type].close_time);
if(o.link.val) {
var blink_o = $.siteBanner.getLINK(o.link.val, o.link.target);
if(blink_o.link) {
bannerItem.find('a').attr('href', blink_o.link);
if(blink_o.target) bannerItem.find('a').attr('target', blink_o.target);
$.each(blink_o.option, function(o_k, o_v) {
bannerItem.find('a').attr(o_k, o_v);
});
}
}
}
bannerItem.css('background-color',o.img.bgcolor);
bannerItem.find('.banner-header .banner-closetoday').css('color',o.close.color);
bannerItem.find('.banner-header .banner-close.cl-icon > svg').css('fill',o.close.color);
if($.siteBanner[type].close_today == 'OFF') bannerItem.find('.banner-closetoday').addClass('hide');
if(type == 'band' && $.siteBanner[type].close_onoff == 'OFF') bannerItem.find('.banner-header').addClass('hide');
b_list += bannerItem.outerHTML();
}
});
if(b_show > 0) {
$.siteBanner[type].total = b_show;
if(isBand) {
$.siteBanner[type].min_h = min;
} else if(isPopup) {
$.siteBanner[type].total_w = sum;
$.siteBanner[type].max_h = max;
}
if(isSC) {
var sc_device = $('#el-siteConfig .sc-device-wrap > li.active').attr('data-device');
$('#el-siteConfig .sc-siteBanner').replaceWith('\
\
\
\
' + clSVG('info',18,18,true,'') + $.lang[LANG]['sc.banner.band.close.today.m'] + '
\
' + clSVG('info',18,18,true,'') + $.lang[LANG]['sc.banner.popup.position.overflow'] + '
\
\
\
');
} else {
var bannerEL = $('\
\
');
if($('.cl-'+type+'Banner').length > 0) $('.cl-'+type+'Banner').remove();
$('.dsgn-body').prepend(bannerEL);
}
} else {
delete $.siteBanner[type].min_h;
delete $.siteBanner[type].total_w;
$.siteBanner[type].total = 0;
$.siteBanner[type].used = false;
$.siteBanner.doNotOffer(type,isSC);
}
deferred02.resolve();
} else {
if(isSet && !onoff) $.siteBanner.doNotOffer(type,isSC);
deferred02.resolve();
}
return deferred02.promise();
},
position: function(type,isSC,isPosition) {
// console.log('position(type: '+type+',isSC: '+isSC+',isPosition: '+isPosition+')');
var deferred03 = $.Deferred(),
isBand = (type == 'band') ? true : false,
isPopup = (type == 'popup') ? true : false;
if(!isPosition) {
deferred03.resolve();
} else {
if(isBand) {
$.siteBanner.stopBandRolling();
var m_h = $.siteBanner[type].min_h[0],
m_h2 = $.siteBanner[type].min_h[1];
if(m_h > 120) m_h = 120;
if(m_h2 != 50) m_h2 = 50;
if(isSC) {
$('#el-siteConfig .sc-siteBanner').attr('data-min-p',m_h).attr('data-min-m',m_h2);
document.querySelector('#el-siteConfig .sc-siteBanner').style.setProperty('--scbandBanner-height-pc', m_h+'px', null);
document.querySelector('#el-siteConfig .sc-siteBanner').style.setProperty('--scbandBanner-height-mobile', m_h2+'px', null);
var sc_device = $('#el-siteConfig .sc-device-wrap > li.active').attr('data-device');
if(sc_device == 'm') $('#el-siteConfig .sc-siteBanner .banner-description[data-closetoday="m"]').addClass('active');
else $('#el-siteConfig .sc-siteBanner .banner-description[data-closetoday="m"]').removeClass('active');
} else {
document.querySelector('.dsgn-body').style.setProperty('--bandBanner-height-pc', m_h+'px', null);
document.querySelector('.dsgn-body').style.setProperty('--bandBanner-height-mobile', m_h2+'px', null);
$('body, .cl-bandBanner').addClass('openBandBanner');
$('.element[data-type="gallery"][data-type2="premium"]').refreshRootCss();
var isPB = (typeof property != 'undefined') ? true : false,
isHeader = ($('.el-menu header.navbar').hasClass('transparent')) ? true : false,
isSidebar = ($('.el-menu header.navbar').hasClass('sidebar')) ? true : false,
header_h = (isHeader || (isSidebar && $('body').width() > 767)) ? 0 : $('.el-menu header.navbar').outerHeight(),
band_h = ($('body').width() > 767) ? m_h : m_h2;
$('.dsgn-body').css('padding-top', (band_h+header_h)+'px');
if($.siteBanner.band.total > 1) {
var rolling_id = setInterval($.siteBanner.setBandRolling, $.siteBanner.band.interval);
$.siteBanner.band.seqs.push(rolling_id);
$('.cl-bandBanner').attr('data-seq',rolling_id);
}
$($.siteBanner.band.body).scroll(function(event) {
if($('.cl-bandBanner').hasClass('openBandBanner') && $('.element[data-type="gallery"][data-type2="premium"][data-feature*="fixedscroll"]').length == 0) {
if($(this).scrollTop() < $('.cl-bandBanner').outerHeight()) {
if($('.header.el-menu > header').hasClass('transparent')) $('.dsgn-body').css('padding-top',$.siteBanner.getBandHeight()+'px');
$('.cl-bandBanner, .el-menu_ctrl, .header.el-menu > header').css('margin-top',-$(this).scrollTop()+'px');
} else {
if($('.header.el-menu > header').hasClass('transparent')) $('.dsgn-body').css('padding-top',$.siteBanner.getBandHeight()+'px');
$('.cl-bandBanner, .el-menu_ctrl, .header.el-menu > header').css('margin-top',-$('.cl-bandBanner').outerHeight()+'px');
}
}
});
}
deferred03.resolve();
} else if(isPopup) {
var body_w = (isSC) ? $('#el-siteConfig .sc-popupBanner').width() : $('.dsgn-body').width(),
device_idx = (body_w <= 767) ? 1 : 0,
device_offset = 30 + (($.siteBanner.popup.total - 1) * 30),
p_overflow = ((body_w - device_offset) <= $.siteBanner.popup.total_w[device_idx]) ? true : false,
p_arr = $.siteBanner.popup.position.split(' '),
p_justify = (typeof p_arr != 'undefined') ? p_arr[0] : 'center',
p_align = (typeof p_arr != 'undefined') ? p_arr[1] : 'center',
p_selector = (isSC) ? '.sc-popupBanner' : '.cl-popupBanner';
$(p_selector+' > .banner-modal').attr('data-justify', p_justify)
.attr('data-align', p_align)
.attr('data-overflow', p_overflow);
if(p_overflow) {
// 계단식
var pi_i = $(p_selector+' .banner-box:not(.hide)').length;
$(p_selector+' .banner-box:not(.hide)').each(function(i) {
var pi_top = (i+1) * 30,
pi_margin_right = pi_i * 30;
$(this).css({'top':pi_top+'px', 'left':pi_top+'px', 'margin-right':pi_margin_right+'px'});
pi_i--;
});
} else {
// 나열
$(p_selector+' .banner-box:not(.hide)').each(function(i) {
$(this).removeInlineCss('top left margin-right');
});
}
if(!isSC) {
$(window).resize(function() {
if(this.resizeTO) {
clearTimeout(this.resizeTO);
}
this.resizeTO = setTimeout(function() {
$(this).trigger('resizeEnd');
}, 500);
});
$(window).on('resizeEnd', function() {
if($('.cl-popupBanner').hasClass('openPopupBanner')) {
var reposition = $.siteBanner.position('popup',isSC,true);
reposition.done(function(rp_r) {
}).fail(function(rp_error) {
});
}
});
setTimeout(function() {
var isPB = (typeof property != 'undefined') ? true : false,
band_h = $.siteBanner.getBandHeight(),
header_h = ($('.el-menu header.navbar').hasClass('transparent')) ? 0 : $('.el-menu header.navbar').outerHeight(),
popup_t = band_h + header_h,
popup_l = 0;
if($('.el-menu header.navbar').hasClass('sidebar')) {
if($('body').width() > 767) {
popup_t = band_h;
if(isPB) popup_l = 260;
if($('.dsgn-body').hasClass('mode-render')) document.querySelector('.cl-popupBanner').style.setProperty('width', 'calc(100% - 260px)', null);
}
}
$('.cl-popupBanner').css({'top':parseInt(popup_t)+'px','left':popup_l+'px'});
if(!p_overflow) $(p_selector).css('bottom',0);
$('body, .cl-popupBanner').addClass('openPopupBanner');
}, 300);
}
deferred03.resolve();
}
}
return deferred03.promise();
},
getLINK: function(org_link,org_ltarget) {
var link = (typeof org_link == 'string' && org_link != 'javascript:;' && org_link.length > 0) ? org_link : 'javascript:;',
link_target = (typeof org_ltarget != 'undefined' && (org_ltarget == '1' || org_ltarget == 'ON')) ? '_blank' : '',
link_option = {};
if(link != '' && link != 'javascript:;') {
var _menuList = (PAGE_MODE == 'c') ? MENULIST : property.MENULIST;
if(link.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark]
var _settings = (PAGE_MODE == 'c') ? SETTINGS : property.SETTINGS,
bookmark_seq = link.replace(/^\@/g,'');
if(typeof _settings == 'undefined' || typeof _settings.blockBookmarkList == 'undefined' || _settings.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') {
link = '';
link_option = {};
} else {
link_option['attr-bookmark'] = bookmark_seq;
}
} else if(link.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink]
link_option['attr-flink'] = link.replace(/^flink\@/gi,'');
link_target = '';
} else if(_menuList.indexOf(link.replace(/^\//g,"").replace(/ /g,"-")) > -1) { // link-type: link-menu ==> a[data-user-link]
link_option['data-user-link'] = link;
} else { // link-type: link-out ==> a[attr-link]
link_option['attr-link'] = link;
}
link = (PAGE_MODE == 'c') ? makeLinkUrl(link, ONE, VIEW) : makeLinkUrl(link, property.ONE, property.VIEW);
}
return {'link':link, 'target':link_target, 'option':link_option};
},
getBandHeight: function() {
if($('body').hasClass('openBandBanner')) {
var bandbanner_p = getComputedStyle(document.querySelector('.dsgn-body')).getPropertyValue('--bandBanner-height-pc'),
bandbanner_m = getComputedStyle(document.querySelector('.dsgn-body')).getPropertyValue('--bandBanner-height-mobile');
if($('body').width()>767) return parseInt(bandbanner_p);
else return parseInt(bandbanner_m);
} else {
return 0;
}
},
setBandRolling: function() {
if($.siteBanner.band.paused) return false;
var bannerEL = $('.cl-bandBanner[data-seq="'+$.siteBanner.band.seqs[$.siteBanner.band.seqs.length - 1]+'"]');
if(bannerEL.length == 0) return false;
var bannerUL = bannerEL.find('.banner-modal > ul'),
banner_h = $.siteBanner.getBandHeight(),
banner_l = bannerUL.children('.banner-box:not(.hide)').length;
bannerUL.animate({ top: -banner_h+'px' }, 1000, 'easeInOutQuart', function() {
$(this).append($(this).find('li.banner-box:not(.hide)').eq(0).clone().wrapAll('
').parent().html());
$(this).find('li.banner-box:not(.hide)').eq(0).remove();
$(this).css('top', 0);
});
},
stopBandRolling: function() {
var seq = ($('.cl-bandBanner').length > 0) ? $('.cl-bandBanner').attr('data-seq') : 0,
seq_arr = (typeof $.siteBanner.band != 'undefined' && typeof $.siteBanner.band.seqs != 'undefined') ? $.siteBanner.band.seqs : [];
if(seq) clearInterval(seq);
$.each(seq_arr, function(i,v) {
clearInterval(v);
});
if(seq_arr.length > 0) {
$.siteBanner.band.seqs = [];
$.siteBanner.band.paused = false;
}
},
}
// $(".element").removeInlineCss("color font-size font-weight");
jQuery.fn.removeInlineCss = function (properties) {
if (properties == null) return this.removeAttr('style');
properties = properties.split(/\s+/);
return this.each(function () {
for (var i = 0; i < properties.length; i++)
this.style.removeProperty(properties[i])
});
}
jQuery.fn.refreshRootCss = function(property_key) {
var isAll = (typeof property_key == 'undefined' || property_key == '') ? true : false;
// property_key == '--menu-height'
var mh = getMenuHeight(),
bh = $.siteBanner.getBandHeight();
this.each(function() {
if(!$(this).is('[data-el^="el_"]') || !$(this).is('[data-type="gallery"][data-type2="premium"]')) return true;
if(isAll || property_key == '--menu-height') {
var __target = $(this).attr('data-el'),
__menu_height = getComputedStyle(document.querySelector('.'+__target)).getPropertyValue('--menu-height');
if(typeof __menu_height != 'undefined' && __menu_height) document.querySelector('.'+__target).style.setProperty('--menu-height', (mh+bh)+'px', null);
}
});
}
//mobile정보 가져오기
var mrequest_uri = location.pathname + location.search;
function getMobileInfo(data) {
var page = location.pathname.split('/')[1],
mb = data.mb,
paidUser = data.paidUser,
settings_url = data.settings_url,
sid = data.sid,
valid_plan = data.valid_plan,
site_nickname = (typeof $('.site-username').text() != 'undefined' && $('.site-username').text()) ? $('.site-username').text() : data.site_nickname,
site_profile = (typeof $('#dashboard-image-top image').attr('xlink:href') != 'undefined' && $('#dashboard-image-top image').attr('xlink:href')) ? $('#dashboard-image-top image').attr('xlink:href') : data.site_profile,
umprofile = data.umprofile,
newCount = data.newCount,
checkGabia = (data.service.indexOf('gabia') > -1) ? true : false;
mb.mb_id = (mb.mb_id) ? mb.mb_id : mb.um_id;
if(mb.mb_id){
var empty = (mb.mb_id) ? '' : 'empty',
newMessage = (newCount == 0) ? false : true,
badge = newMessage ? "
" : "";
var adminhtml = (mb.mb_level >= 10) ? '
Admin ' : '',
mypage = (checkGabia) ? '/dashboard' : '/mypage',
uadminmypage = (data.is_uadmin == false) ? mypage : 'javascript:;',
siteum = (data.is_uadmin == false) ? '' : 'siteUM',
mypage = (data.is_uadmin == false) ? '' : 'mypage',
dashboarduadmin = (data.is_uadmin == false) ? '/' : '/_admin/dashboard',
marketinguadmin = (data.is_uadmin == false) ? '/marketing' : '/_admin/marketing';
var str = '
\
\
';
$('.m-header_user').empty().prepend(str);
}
return data;
}
$.mobileToggleMenu = {
set : function() {
var request_uri = location.pathname + location.search;
var returnData = '';
$.ajax({
type: 'POST',
data: { type:'get', sid:SID },
dataType: 'json',
url: '/template/getMobileMenu',
async:false,
success : function(data) {
returnData = getMobileInfo(data);
}
});
$.mobileToggleMenu.clickEvnt();
return returnData;
},
setSignIn : function() {
var langkor = (LANG=='ko') ? '':'hide',
langen = (LANG=='en') ? '' : 'hide',
str = '
\
';
$('.m-header_user').prepend(str);
$.mobileToggleMenu.clickEvnt();
},
mobileResize : function(data) {
getMobileInfo(data);
$.mobileToggleMenu.clickEvnt();
},
clickEvnt : function() {
$('.navbar-toggle').click(function() {
$.mobileToggleMenu.open();
$('.m-header_user').css('left','0');
$('html').css({'overflow': 'hidden'});
});
$('.m-langselect,.lang-ch').on('click',function(){
$.mobileToggleMenu.langSelect(mrequest_uri);
});
/*$('.applySm').click(function(){
$(this).showModalFlat('INFORMATION', '쇼핑 기능은 심플쇼핑 요금제로 이용이 가능합니다.