var isAosBlock = false;
var isgalleryView = false;
var pageLoad = true;
var RENDER = {
init: function (property) {
var History = window.History;
var b = property,
URI = (b.PUBLISH) ? '/' : '/render',
param = (b.PUBLISH) ? '/publish/true' : '',
selectEL = '',
galleryEL = new Object();
var CERT_USERID = '';
this.b = b;
this.b.pageContent = {};
this.b.pageContent[b.PAGE] = b.INITPAGE;
this.b.URL = URI;
this.b.param = param;
this.history = window.History;
this.b.MENULIST = [];
this.galleryEL = galleryEL;
_this = this;
$(window).ready(function() {
if(b.VALIDPLAN && $.inArray(b.VALIDTYPE, ['BN','SM']) > -1 && (b.CERT_USE == 'Y' || b.CERT_USE == 'A')) {
if(b.CERT_USE == 'Y') {
if(b.UMEMBER.check_login == true) isUserCertified(history);
} else {
isUserCertified(history);
}
}
var checkIOS = ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) ? true : false;
if(checkIOS) $('.dsgn-body').addClass('ios-bg-attachment-scroll');
(function(window){
var History = window.History;
if ( !History.enabled ) {
return false;
}
History.Adapter.bind(window,'statechange',function(){
$('.error_404.new_design').remove();
var State = History.getState(),
cUrl = new getLocation(State.url),
loc = cUrl.pathname,
uri = (b.PUBLISH) ? loc.replace(/^\//,'').replace(/\/$/,'') : loc.replace(/\/*(render)\/*/,''),
uri = uri.replace('/view/',','),
s = uri.split(','),
bookmark = '';
if(uri.match(/^(psearch|\_checkout|\_forgot|\_mypayment|\_lang)\//gi) !== null) {
location.href = '/'+uri;
return false;
}
if(uri.match(/^_product\//gi) !== null) {
uri = (b.PUBLISH) ? uri : 'render/' + uri;
location.href = '/'+uri;
return false;
}
// naverLogCallback(function() {
// if("naver_log" in b.SETTINGS) {
// if (!wcs_add) var wcs_add={};
// wcs_add["wa"] = b.SETTINGS.naver_log;
// if (!_nasa) var _nasa={};
// wcs_do(_nasa);
// }
// });
if($('.cl-flat-modal').length > 0) $('.cl-flat-modal .modal').modal('hide');
if(uri == b.URL || uri == '') {
uri = (b.ONE) ? 'index' : b.MENULINK[0];
}
(typeof s[1] != 'undefined') ? b.VIEW = s[1] : b.VIEW = '';
b.PAGE = decodeURI(uri);
if(b.PAGE.indexOf('@')>-1) {
var tmp = b.PAGE.split('@');
b.PAGE = tmp[0];
bookmark = tmp[1];
}
if((b.PAGE).indexOf(',')>-1) {
var tmp = b.PAGE.split(',');
b.VIEW = tmp[1];
}
$('.el-footer').css('visibility', 'hidden');
$.processON();
getParent(s[0],b.VIEW, b.PAGE);
var pageMove = true;
if(b.VIEW && s[0] != 'forum' && s[0] != 'psearch' && b.COUNT == 0 && !b.PUBLISH) {
$(this).showModalFlat('INFORMATION','Page not found',true,false,'','ok');
History.back();
pageMove = false;
}
if(pageMove) {
clearDsgnbody();
pageLoad = true;
var is_templates = checkTemplateSite(b.SID);
var menu_name = (b.VIEW) ? b.PAGE.split(',') : [b.PAGE],
tmp_url = (is_templates) ? '/render' : '',
pagemenu_link = '#tpl-menu.nav li a[href="'+tmp_url+'/' + menu_name[0] + '"]';
if(!$(pagemenu_link).parent().hasClass('active')) {
$('#tpl-menu li').removeClass('active').removeClass('open');
$(pagemenu_link).parent().addClass('active');
if($(pagemenu_link).closest('.dropdown-menu').length>0) {
if($('body').width() > 768) {
$(pagemenu_link).closest('.dropdown').addClass('active');
} else {
$(pagemenu_link).closest('.dropdown').addClass('open');
}
} else {
if($('.el-menu > header').hasClass('navbar-fheader')) $('#mobile-nav li.menu-has-children ul.dropdown-menu').hide();
else {
if($('body').width() < 768) $('#tpl-menu li.dropdown ul.dropdown-menu').hide();
}
}
}
if($('.shopping-more-wrap').length > 0) $('.shopping-more-wrap').remove();
// console.log('pageMove', $.cookie('prev-forum-view'));
if(s[0] != 'forum' && $.cookie('prev-forum-view') === undefined) {
// console.log('forum cookie');
$.each(document.cookie.split(';'), function(index, cookie) {
var name = cookie.split('=')[0].trim();
if (name.indexOf('forum_') === 0) {
$.removeCookie(name, {path:'/'})
// document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
});
}
$.removeCookie('prev-forum-view', {path:'/'});
var page_draw_stop = false;
$.ajax({
url: '/template/conf',
data: { sid : b.SID, page : b.PAGE, publish : b.PUBLISH, siteum : b.SITEUM },
dataType: 'json',
type: 'POST',
async: true,
cache: false,
success: function (data) {
if(typeof data.url != 'undefined' && data.url) {
page_draw_stop = true;
location.href = data.url;
return false;
}
b.ISLOCK = data.islock;
b.HEADER = (data.overlay) ? 1 : 0;
var isSidebar = ($('header').hasClass('sidebar')) ? true : false;
if(b.HEADER && !isSidebar) {
$('.header-empty').css('height',0);
$('.header.el-menu').removeClass('fixed');
$('header.navbar').addClass('transparent');
} else {
$('header.navbar').removeClass('transparent');
}
$('#pageScript').remove();
if(data.pageScript) $('body').append(data.pageScript);
if(data.meta != null) {
$.each(data.meta, function(k,v) {
$('meta[name="' + k + '"]').attr('content',v);
if(k == 'title') {
$(document).prop('title', htmlspecialchars_decode(v));
}
});
}
if(data.og_others != null) {
$.each(data.og_others, function(ok,ov) {
var og_property = ok.replace(/\_\_/gi,':');
if(ov != '') {
if($('meta[property="' + og_property + '"]').length > 0) $('meta[property="' + og_property + '"]').attr('content',ov);
else $('meta[property^="og:"]').eq($('meta[property^="og:"]').length - 1).after('');
} else {
if($('meta[property="' + og_property + '"]').length > 0) $('meta[property="' + og_property + '"]').remove();
}
});
}
if(page_draw_stop) return false;
$('body').find('.galProjectCss').remove();
if($('.popup').length) $('.popup').remove(); //clear Popup;
showPageCallback(showPage, function() {
var pgmove_vMode = (typeof $('.mobilepc_ch').attr('data-desktop-option')!='undefined') ? $('.mobilepc_ch').attr('data-desktop-option') : '';
pgmove_vMode = $.mpcWeb.mpcGetVpmode(pgmove_vMode,b.SETTINGS);
if(b.VALIDPLAN && b.VALIDTYPE != 'PK') {
if(typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) $.mpcWeb.mpcWebhtml(pgmove_vMode,b.pageContent[b.PAGE],b.SETTINGS.zoom,'pagemove');
}
setTimeout(function() {
if(b.VALIDPLAN && b.VALIDTYPE != 'PK') {
if(b.ONE && !b.VIEW || (b.PAGE == b.MENULINK[0]) && !b.VIEW) setSitePopup();
$.siteBanner.init(true,true);
}
if(b.VALIDPLAN && (b.VALIDTYPE == 'BN' || b.VALIDTYPE == 'SM')) {
if(typeof b.SETTINGS.fnav != 'undefined' && !$.isEmptyObject(b.SETTINGS.fnav)) $.fnav.draw(b.SETTINGS.fnav);
}
if(b.VALIDPLAN && b.VALIDTYPE != 'PK') {
if(typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) mobileWebfnavCheck(pgmove_vMode);
}
}, 500);
});
if(typeof $.cookie('gallery-item') != 'undefined' && b.VIEW == '') {
setTimeout(function() {
moveGallery($.cookie('gallery-item'));
},500);
} else if(typeof $.cookie('gallery') != 'undefined' && b.VIEW == '') {
setTimeout(function() {
moveGallery($.cookie('gallery'));
},500);
} else if(typeof $.cookie('forum-item') != 'undefined' && b.VIEW == '') {
// console.log('fm_view', $.cookie('forum_content_view'));
setTimeout(function() {
if(typeof $.cookie('forum_content_view') != 'undefined'){
var fm_view = $.cookie('forum_content_view');
var fv = (fm_view !== undefined && fm_view)? fm_view.split('&'):array();
var pid = (fv)? fv[0]:'';
var row_id = (fv)? fv[1]:'';
scrollToBlock('.element[data-id="' + $.cookie('forum-item') + '"] .tpl-forum-list-title[data-id="'+row_id+'"]', 1000);
$.removeCookie('forum-item', { path: '/' });
$('.element[data-id="' + pid + '"] .tpl-forum-list-title[data-id="'+row_id+'"]').click();
// $.removeCookie('forum_content_view', { path: '/', expires: 12 * 60 * 60 * 1000 });
} else {
scrollToBlock('.element[data-id="' + $.cookie('forum-item') + '"]', 1000);
$.removeCookie('forum-item', { path: '/' });
}
}, 500);
} else {
var url = window.location;
setTimeout(function() {
moveScroll(0,url.href);
},100);
}
if(typeof b.SETTINGS.google != 'undefined' && b.SETTINGS.google.length > 0) {
var https_check = (location.protocol=='https:') ? 'https:' : 'http:',
host_url = b.URL + b.PAGE;
host_url = (b.PARENT && b.PARENT.mode=='project') ? (host_url.replace(/,/g,"/view/")) : host_url;
if(b.SETTINGS.google.indexOf('UA-') > -1) ga('send', 'pageview', location.pathname);
else if(b.SETTINGS.google.indexOf('G-') > -1) {
gtag('config', b.SETTINGS.google, {
page_title: b.TITLE,
page_location: https_check + '//'+ b.HOST + host_url,
page_path: host_url
});
}
//else gtag('config', b.SETTINGS.google , {page_path : location.pathname});
//console.log(https_check + '//'+ b.HOST + host_url);
// console.log('google analytics send, pageview');
}
if(typeof b.SETTINGS.npay_setting != 'undefined' && b.SETTINGS.npay_setting.onoff == true && b.SETTINGS.npay_setting.naver_log.length > 0) {
wcs_do();
// console.log('naverpay log');
} else {
if(typeof b.SETTINGS.naver_log != 'undefined' && b.SETTINGS.naver_log.length > 0) {
wcs.inflow();
wcs_do(_nasa);
// console.log('naver analytics send, pageview');
}
}
if(typeof b.SETTINGS.gtag_event != 'undefined' && typeof b.SETTINGS.gtag_event.page != 'undefined' && b.SETTINGS.gtag_event.page.length > 0) {
if(typeof b.SETTINGS.gtag_event.type != 'undefined' && b.SETTINGS.gtag_event.type == 'event' && b.SETTINGS.gtag_event.page == b.PAGE) {
// console.log(b.SETTINGS.gtag_event);
var v0 = b.SETTINGS.gtag_event.val[0],
v1 = b.SETTINGS.gtag_event.val[1],
v2 = b.SETTINGS.gtag_event.val[2];
gtag(b.SETTINGS.gtag_event.type,v0,{v1:v2});
// gtag(b.SETTINGS.gtag_event.type, b.SETTINGS.gtag_event.val[0], { b.SETTINGS.gtag_event.val[1] : b.SETTINGS.gtag_event.val[2] });
}
}
// menu ver3 : fheader
setTimeout(function() {
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.position();
},400);
// favicon refresh
var favicon = b.RESOURCE + '/' + b.SID + '/' + b.SID + '-favicon.ico?_' + new Date().getTime();
changeFavicon(favicon);
if(typeof pageMoveCallback == 'function') pageMoveCallback();
formTranslate(LANG);
}
});
}
});
History.Adapter.bind(window, 'popstate', function() { // history.js suggests statechange but it has a bug with urls with hashes not firing statechange
var State = History.getState(),
cUrl = new getLocation(State.url),
bUrl = new getLocation(window.location.href);
if(b.ONE) {
if(cUrl.href!=window.location.href) {
if(b.PAGE!='index') {
var link = (!b.PUBLISH) ? '/render/index' : bUrl.pathname;
var url = new getLocation(link);
golink(_this,url);
history.pushState('', '', link + bUrl.hash);
} else {
// if(bUrl.hash) {
// var go = (bUrl.hash).replace('#','');
// moveLinkPage(go);
// }
}
}
}
});
})(window);
$('.dsgn-body').addClass('mode-render');
//$.modalON();
if(typeof b.SETTINGS == 'undefined') return;
if(typeof b.SETTINGS.rightClick == 'undefined' || b.SETTINGS.rightClick === false) return;
$('body').on('contextmenu', function(event){ return false; });
$('body').on('selectstart', '.element, .forum-view, .comment-list', function(event){ return false; });
$('body').on('dragstart', '.element, .forum-view, .comment-list', function(event){ return false; });
});
Pace.on('done', function() {
/*shopping more create*/
if($('.shopping-wrap').length && $('.shopping-wrap').height() >= 800 && $('.shopping-more').length == 0) {
var more_txt = (LANG == 'ko') ? '상품정보 더보기' : 'MORE';
var review_chk = ($('.cl-s-product-review').length > 0) ? true : false,
qna_chk = ($('.cl-s-product-qna').length > 0) ? true : false;
var colorSet = shopping_more_color,
sm_font = (!colorSet) ? '' : colorSet.color,
sm_bgColor = (!colorSet) ? '' : colorSet.background_color,
sm_border = (!colorSet) ? '' : colorSet.border_color;
$('.shopping-wrap').css('max-height','800px')
.css('overflow','hidden')
.after('
');
$('.shopping-wrap').removeClass('open');
if(sm_font) $('.shopping-more').css('color',sm_font);
if(sm_bgColor) $('.shopping-more').css('background-color',sm_bgColor);
if(sm_border) $('.shopping-more').css('border-color',sm_border);
if(!review_chk && !qna_chk) $('.shopping-more-wrap').css('padding-bottom','100px');
}
setTimeout(function() {
$('body').removeClass('pace-disable');
},500);
if(typeof $.cookie('gallery-item') != 'undefined' && b.VIEW == '') {
moveGallery($.cookie('gallery-item'));
}
$.modalOFF();
moveScroll(0);
AOS.refresh();
});
// naverLogCallback(function() {
// if("naver_log" in b.SETTINGS) {
// if (!wcs_add) var wcs_add={};
// wcs_add["wa"] = b.SETTINGS.naver_log;
// if (!_nasa) var _nasa={};
// wcs_do(_nasa);
// }
// });
if(typeof pageMoveCallback == 'function') pageMoveCallback();
formTranslate(LANG);
$('.dsgn-body').addClass('mode-render');
var is_templates = (typeof property.SID != 'undefined') ? checkTemplateSite(property.SID) : false;
//갤러리 블럭에서 카테고리가 비었습니다 문구가 영문 템플릿에서 한글로 나오는 이슈로 아래 코드 추가, 문제 시 삭제 or 위치변경
if(is_templates && property.SID.indexOf('_en') > -1) LANG = 'en';
if(property.VALIDPLAN || is_templates) {
$('body,.dsgn-body').removeClass('with-creatorlink');
} else {
$('body,.dsgn-body').addClass('with-creatorlink');
}
// $('button.navbar-toggle').addClass('hide');
// (b.WRAP) ? $('.dsgn-body').addClass('tiny') : $('.dsgn-body').removeClass('tiny');
$('header').wrap('');
var $tag = $('header');
changeBrokenImages($tag);
$tag.removeClass('tpl-menu');
if(b.ONE){
if(b.VIEW) $tag.find('#site-home').attr('href',URI).removeClass('mini-home');
else $tag.find('#site-home').attr('href','javascript:;').addClass('mini-home');
} else $tag.find('#site-home').attr('href',URI).removeClass('mini-home');
var first_elname = (b.HEADER && Object.keys(b.CONTENTS).length > 0) ? Object.keys(b.CONTENTS)[0] : '';
if(first_elname && typeof b.CONTENTS[first_elname] != 'undefined' && b.CONTENTS[first_elname]['element']['overlap'] == 0) {
b.HEADER = 0;
}
var isSidebar = $tag.hasClass('sidebar');
if(isSidebar) {
$('.dsgn-body').addClass('sidebar');
$('.header.el-menu').addClass('sidebar');
} else if(b.HEADER) {
$('header.navbar').addClass('transparent');
}
header_fixed = $('header.navbar').height();
menu_color = $('header.navbar').css('background-color');
if(menu_color==('rgba(0, 0, 0, 0)')) {
$('header.navbar').css('background-color',$('dsgn-body').css('background-color'));
}
if(isSidebar) {
if($tag.hasClass('hide') && $('.dsgn-body').hasClass('sidebar'))
$('.dsgn-body').removeClass('sidebar');
}
// footer
$('.footer-' + b.SID).addClass('el-footer').addClass('element').attr('data-type','footer');
$(window).on('scroll',function() {
if($('.dsgn-body').hasClass('mobile-nav-active')) return false;
if($(this).scrollTop() > 200) {
$('#goto-top').addClass('show');
} else {
$('#goto-top').removeClass('show');
}
if($('.dsgn-body').hasClass('sidebar')==false) {
fixedMenu();
}
if($(this).scrollTop() == 0 && $('header').hasClass('navbar-fheader')) {
setTimeout(function() { $.fheader.position(); }, 200);
}
scrollspy();
//parallax();
});
$(window).on('orientationchange',function(){
if($('.blueimp-gallery-display').length) {
var $slide = $('.blueimp-gallery .slides .slide'),
play = $('.blueimp-gallery-playing').length,
idx = 0;
$.each($slide, function(i,v) {
var trans = $(this).attr('style');
if(trans.indexOf('translate(0px, 0px)') > 0) {
idx = $(this).attr('data-index');
}
});
var gallery = $('.blueimp-gallery-display').attr('id');
$('#' + gallery + ' .close').click();
$.processON();
setTimeout(function() {
$.processOFF() ;
$('.gallery-item[data-index="' + idx + '"] a[data-gallery="#' + gallery + '"]').click();
$('.layout-grid').eq(idx).find('a[data-gallery="#' + gallery + '"]').click();
if(play) $('#' + gallery + ' .play-pause').click();
}, 1000);
}
});
$(window).resize(function () {
$('.config-image-view').hide();
if($('body').width() <= 768 && $('.dsgn-body').hasClass('sidebar')) {
if($('header.navbar').hasClass('sidebar')) {
cssSidebar('off');
}
//$('.dsgn-body').removeClass('sidebar').addClass('removed-sidebar');
} else if ($('body').width() > 768 /*&& $('.dsgn-body').hasClass('removed-sidebar')*/) {
if($('header.navbar').hasClass('sidebar')) {
cssSidebar('on');
}
//$('.dsgn-body').removeClass('removed-sidebar').addClass('sidebar');
var top = ($('.creatorlink-header').length == 1) ? '55px' : '0px';
$('.el_0').css('margin-top',top);
if($('.header-empty').length > 0) $('.header-empty').remove();
}
if( $('.header-empty').length > 0 && $('.header-empty').height() != $('.el-menu').height() ) {
$('.header-empty').css('height',$('.el-menu').height()+'px');
}
// menu ver3 : fheader
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.position();
if($('body').width() <= 768) {
if($('#tpl-menu li.active.dropdown').length > 0) $('#tpl-menu li.active.dropdown').removeClass('active');
} else {
if($('#tpl-menu li.active').closest('ul').hasClass('dropdown-menu')) $('#tpl-menu li.active').closest('li.dropdown').addClass('active');
$('#tpl-menu ul.dropdown-menu').removeAttr('style');
}
// gallery option - gh
if($('.element[data-type="gallery"] .goption[data-gh]').length > 0) refreshGalleryHeight();
if($('.element[data-type="video"] .lyoption[data-lyh]').length > 0) setLayoutHeight();
var vpmode_opt = $('.mobilepc_ch').attr('data-desktop-option'),
vpmode = vpmode_opt ? vpmode_opt : b.SETTINGS.viewportMode,
vpModeOnoff = (property.SETTINGS.vpMode_onoff === true) ? true : false,
checkFnav = ($('.fnav').length > 0 && vpmode=='mobile_web') ? true : false,
WebType = $.mpcWeb.mpcCheckWebType();
if($('.fnav').length > 0) {
if($('body').width() <= 480) {
if($('#cl-music-player-icon').length > 0) $('#goto-top,#cl-music-player-icon').addClass('movedOne');
}
}
if(vpModeOnoff && WebType == 'MOBILE') $.mpcWeb.mpcMusicandGoTop(checkFnav,vpmode);
fixedMenu();
scrollspy();
//premium gallery setFixedscroll
if($('.element[data-feature*=fixedscroll]').length > 0) gjs01SetFixedscroll($('.element[data-feature*=fixedscroll]').eq(0));
if($('.fr-view').length) {
setForumWrap();
}
if($('.blueimp-gallery-display').length) {
var $slide = $('.blueimp-gallery .slides .slide'),
play = $('.blueimp-gallery-playing').length,
idx = 0;
$.each($slide, function(i,v) {
var trans = $(this).attr('style');
if(trans.indexOf('translate(0px, 0px)') > 0) {
idx = $(this).attr('data-index');
}
});
var gallery = $('.blueimp-gallery-display').attr('id');
$('#' + gallery + ' .close').click();
$.processON();
setTimeout(function() {
$.processOFF() ;
$('.gallery-item[data-index="' + idx + '"] a[data-gallery="#' + gallery + '"]').click();
$('.layout-grid').eq(idx).find('a[data-gallery="#' + gallery + '"]').click();
if(play) $('#' + gallery + ' .play-pause').click();
}, 1000);
}
sitePopupResize();
var checkFixTypeMenu = (typeof $('header.navbar-fheader').attr('data-fixtype') != 'undefined' && $('header.navbar-fheader').attr('data-fixtype')) ? true : false;
if(b.VALIDPLAN && checkFixTypeMenu) {
if(window.innerWidth < 769) {
$('header.navbar[data-fixtype]').find('.navbar-brand').css('line-height','');
return false;
}
setTimeout(function(){
setFixedMenuCss(false);
},80);
}
});
this.liveUpdate(b.SMENU);
var checkToggleShow = (!b.MENUCHECK.main && window.innerWidth > 768) ? false : true,
loc_pathname = window.location.pathname,
is_render = (loc_pathname.match(/^\/render/g)) ? true : false,
is_templates = (typeof b.SID != 'undefined') ? checkTemplateSite(b.SID) : false;
if(is_render && !is_templates) {
if(window.parent && window.parent != this && $('#previewmain', window.parent.document).length > 0) {
if($('#previewmain', window.parent.document).find('.preview-hand .active').is('#desktop, #tablet') && !b.MENUCHECK.main) checkToggleShow = false;
}
}
if(checkToggleShow) $('button.navbar-toggle').css('visibility','visible');
if(b.PAGE == 'psearch') $.psearch.view();
var displaySnsShare = function(pid) {
var checkUrl = b.PAGE.split(','),
type = (checkUrl[0] == 'forum') ? 'F' : 'P',
check_view_empty = (b.VIEW && b.COUNT == 1 && $('.error_404.element[data-name="error_404"]').length == 1) ? true : false,
checkGalleryProjectClass = (type=='P') ? 'galProjectBg' : '';
if(type == 'P' && (b.COUNT == 0 || check_view_empty)) return false;
var option = (b.PARENT.settings) ? jQuery.parseJSON(b.PARENT.settings) : {};
if(typeof option.sns_share_display == 'undefined' || !option.sns_share_display) {
return false;
} else if ( option.sns_share_display == 'ON') {
if(type == 'F') $('.tpl-forum-list-footer .tpl-page-toolbar .tpl-forum-toolbar-button.share').removeClass('hide');
else {
//var checkCss = ($('.galProjectCss').text().indexOf('.galProjectBg svg') > -1) ? true : false;
// var g_color = (typeof $('.dsgn-body').attr('data-gcolor')!='undefined') ? $('.dsgn-body').attr('data-gcolor') : '';
// if(g_color) {
// var pr_rgba = hexToRgba(g_color),
// galProjectCssStr = ($('.galProjectCss').length>0) ? $('.galProjectCss').text() : '';
// galProjectCssStr += '.dsgn-body[data-gcolor="'+g_color+'"] .galProjectBg svg {fill: rgba('+pr_rgba.r+','+pr_rgba.g+','+pr_rgba.b+',0.6);}\n';
// $('.galProjectCss').text(galProjectCssStr);
// }
$('.tpl-page-footer').removeClass( 'hide' ).removeClass(checkGalleryProjectClass).addClass(checkGalleryProjectClass);
$('.tpl-page-footer .tpl-forum-toolbar-button.share').removeClass( 'hide' );
if($('.tpl-page-footer').hasClass('galProjectBg')) $('.tpl-page-footer').removeAttr('style').css('padding','30px 0px');
}
}
}
var displayLike = function(pid) {
var checkUrl = b.PAGE.split(','),
type = (checkUrl[0] == 'forum') ? 'F' : 'P',
check_view_empty = (b.VIEW && b.COUNT == 1 && $('.error_404.element[data-name="error_404"]').length == 1) ? true : false,
checkGalleryProjectClass = (type=='P') ? 'galProjectBg' : '',
j = (b.PARENT.elcss)? CSSJSON.toJSON(htmlspecialchars_decode(b.PARENT.elcss)):{},
elname = '.' + b.PARENT.element;
if(!b.VALIDPLAN) return false;
if(type == 'P' && (b.COUNT == 0 || check_view_empty)) return false;
var option = (b.PARENT.settings) ? jQuery.parseJSON(b.PARENT.settings) : {};
if(typeof option.like_display == 'undefined' || !option.like_display) {
return false;
} else if ( option.like_display == 'ON') {
if(type == 'F') {
$('.tpl-forum-list-footer .tpl-page-toolbar .tpl-forum-toolbar-button.like').removeClass('hide');
} else {
var like_fill = (option.gl_like_color !== undefined)? option.gl_like_color : ((b.PARENT.mode=='project') ? '#505050':'#fff');
var likeActive_fill = (option.gl_likeActive_color !== undefined)? option.gl_likeActive_color:'#ee445f';
galProjectCssStr = ($('.galProjectCss').length>0) ? $('.galProjectCss').text() : '';
galProjectCssStr += '.tpl-page-footer-wrap .tpl-forum-toolbar-button.like .forum-like-cnt{color:'+like_fill+';}\n';
galProjectCssStr += '.tpl-page-footer-wrap .tpl-forum-toolbar-button.like > svg{fill:'+like_fill+';}\n';
galProjectCssStr += '.tpl-page-footer-wrap .tpl-forum-toolbar-button.like.active .forum-like-cnt{color:'+likeActive_fill+';}\n';
galProjectCssStr += '.tpl-page-footer-wrap .tpl-forum-toolbar-button.like.active > svg, .tpl-page-footer-wrap .tpl-forum-toolbar-button.like.active > svg > path:first-child {fill:'+likeActive_fill+';}\n';
$('.galProjectCss').text(galProjectCssStr);
$('.tpl-page-footer').removeClass( 'hide' ).removeClass(checkGalleryProjectClass).addClass(checkGalleryProjectClass);
$('.tpl-page-footer .tpl-forum-toolbar-button.like').removeClass( 'hide' );
if($('.tpl-page-footer').hasClass('galProjectBg')) $('.tpl-page-footer').removeAttr('style').css('padding','30px 0px');
}
}
}
var displayBottomNav = function(pid) {
var checkUrl = b.PAGE.split(','),
type = (checkUrl[0] == 'forum') ? 'F' : 'P',
check_view_empty = (b.VIEW && b.COUNT == 1 && $('.error_404.element[data-name="error_404"]').length == 1) ? true : false,
checkGalleryProjectClass = (type=='P') ? 'galProjectBg' : '';
if(type == 'P' && (b.COUNT == 0 || check_view_empty)) return false;
var option = (b.PARENT.settings) ? jQuery.parseJSON(b.PARENT.settings) : {};
if(typeof option.bottomNav_display == 'undefined' || !option.bottomNav_display) {
return false;
} else if ( option.bottomNav_display == 'ON') {
if(type == 'F') $('.tpl-forum-list-footer .tpl-page-toolbar .bottom-navigation').removeClass('hide');
else {
//var checkCss = ($('.galProjectCss').text().indexOf('.galProjectBg svg') > -1) ? true : false;
// var g_color = (typeof $('.dsgn-body').attr('data-gcolor')!='undefined') ? $('.dsgn-body').attr('data-gcolor') : '';
// if(g_color) {
// var pr_rgba = hexToRgba(g_color),
// galProjectCssStr = ($('.galProjectCss').length>0) ? $('.galProjectCss').text() : '';
// galProjectCssStr += '.dsgn-body[data-gcolor="'+g_color+'"] .galProjectBg svg {fill: rgba('+pr_rgba.r+','+pr_rgba.g+','+pr_rgba.b+',0.6);}\n';
// $('.galProjectCss').text(galProjectCssStr);
// }
$('.tpl-page-footer').removeClass( 'hide' ).removeClass(checkGalleryProjectClass).addClass(checkGalleryProjectClass);
$('.tpl-page-footer .bottom-navigation').removeClass( 'hide' );
if($('.tpl-page-footer').hasClass('galProjectBg')) $('.tpl-page-footer').removeAttr('style').css('padding','30px 0px');
}
}
}
$('[data-imglink="true"][attr-link]').live('click',function(){
if($(this).is('[attr-link=""]')) return false;
var imgtarget = $(this).attr('data-target'),
imgshlink = $(this).attr('data-shlink'),
imgblank = $(this).attr('data-blank');
if(imgblank == '_blank') {
var openNewWindow = window.open('about:blank');
openNewWindow.location.href=imgshlink;
} else {
location.href=imgshlink;
}
});
$('.menu-inner').on('scroll', function() {
$(this).next('.fh-line').show();
if($(this).scrollTop()==0) $(this).next('.fh-line').hide();
});
$("#mobile-nav #tpl-menu").on('scroll', function() {
$(this).next('.fh-line').show();
if($(this).scrollTop()==0) $(this).next('.fh-line').hide();
});
$('.siteLANG ul a, .siteLANG-dmenu-wrap ul li a').live({
click: function(e) {
if(LANGLINK) return;
e.preventDefault();
var sid = (typeof SID != 'undefined' && SID) ? SID : property.SID,
slang_code = $(this).attr('data-code'),
slang_str = $(this).text().trim();
changeLanguage(slang_code);
}
});
$('.sitePopupTodayHide, .sitePopupClose').live({
click: function() {
if($(this).hasClass('sitePopupTodayHide')) $(this).find('input').click();
var selectedPopup = $(this).closest('.modal-popup').attr('id');
$('#' + selectedPopup).find('.popup-close').click();
}
});
$('.popup-close').live({
click: function() {
var selectedPopup = $(this).closest('.modal-popup').attr('id'),
idx = $(this).closest('.modal-popup').attr('data-idx'),
ptime = $(this).closest('.modal-popup').attr('data-time'),
isTodayHide = $(this).closest('.modal-popup').find('.sitePopupTodayHide input').prop('checked'),
date = new Date();
var ptime_val = {
'always' : 0,
'onlyone' : 365 * 24 * 60 * 60 * 1000,
'week' : 7 * 24 * 60 * 60 * 1000,
'day' : 24 * 60 * 60 * 1000,
'12hour' : 12 * 60 * 60 * 1000,
'6hour' : 6 * 60 * 60 * 1000,
'2hour' : 2 * 60 * 60 * 1000,
'1hour' : 60 * 60 * 1000,
'30min' : 30 * 60 * 1000,
'10min' : 10 * 60 * 1000
};
if(isTodayHide) {
date.setTime(date.getTime() + ptime_val['day']);
} else {
date.setTime(date.getTime() + ptime_val[ptime]);
}
$('#' + selectedPopup).fadeOut();
if(isTodayHide || (typeof ptime !='undefined' && ptime != 'always' && ptime != '')) { $.cookie(selectedPopup, true, { path: '/', expires: date}); }
else { $.removeCookie(selectedPopup, { path: '/' }); }
}
});
var displayBottomList = function(pid) {
var checkUrl = b.PAGE.split(','),
type = (checkUrl[0] == 'forum') ? 'F' : 'P',
check_view_empty = (b.VIEW && b.COUNT == 1 && $('.error_404.element[data-name="error_404"]').length == 1) ? true : false;
if(type == 'P' && (b.COUNT == 0 || check_view_empty)) return false;
var option = (b.PARENT.settings) ? jQuery.parseJSON(b.PARENT.settings) : {};
if(typeof option.bottomlist_display == 'undefined' || !option.bottomlist_display) return false;
else if (option.bottomlist_display == 'ON') $.bottomlist.init();
}
var moveScroll = function(interval, loc) {
if(typeof $.cookie('forum_content_view') != 'undefined') {
if(window.location.href.indexOf('/forum/view/') == -1) $.removeCookie('forum_content_view', { path: '/', expires: 12 * 60 * 60 * 1000 });
return false;
}
var this_url = (typeof loc == 'undefined') ? document.URL : loc,
url = (typeof this_url != 'undefined' && this_url) ? decodeURIComponent(escape(this_url)) : '';
link = url.split('#').pop();
if($.inArray(link,b.MENULINK) > -1 && b.ONE && !b.VIEW) {
moveLinkPage(link,interval);
$.removeCookie('gallery', { path: '/' });
$.removeCookie('gallery-item', { path : '/' });
} else if (url.match(/\@/g)) {
link = url.split('\@').pop();
var bookmark_link = url.substr(url.lastIndexOf('/')+1);
if(link) moveLinkPage(bookmark_link,800,true);
} else {
$(window).scrollTop(0);
setTimeout(function() {
if(location.hash) {
var hashArr = location.hash.split('#');
var hash = hashArr[1];
var hashseq = hashArr[2];
if(hash && $('.element[data-name="' + hash + '"]').length) {
var header_check = $("header").attr("data-fh-type");
if (header_check != "sidebar") { var header_height = $("header").outerHeight(true); }
else {var header_height = 0;}
// $(window).scrollTop($('.element[data-name="' + hash + '"]').offset().top - header_height);
if($('.tpl-forum-list-cont[data-id="' + hashseq + '"]').length == 0) {
var offset_top = $('.element[data-name="' + hash + '"]').find('.list-item').offset().top;
var win = $(window);
var winHeight = win.height();
win.scrollTop(offset_top - (winHeight / 2) + (header_height / 2));
} else {
var offset_top = $('.tpl-forum-list-cont[data-id="' + hashseq + '"]').closest('.list-item').offset().top - header_height;
var screen_half = ($(window).height() - header_height) / 2;
// $(window).scrollTop(offset_top)
$(window).scrollTop(offset_top - screen_half)
}
// console.log($('.tpl-forum-list-cont[data-id="72334"]').length);
}
}
});
}
}
var moveBookmark = function(page,bookmark,interval,target) {
var page_arr = (typeof page == 'undefined') ? new Array() : page.split('\,'),
view = (page_arr.length > 1) ? page_arr[1] : '';
interval = (typeof interval == 'undefined') ? 1200 : interval;
target = (typeof target == 'undefined') ? '' : target;
if( (view!='' && view==b.VIEW && !target) || (view=='' && !b.VIEW && page_arr[0]==b.PAGE && !target) ) {
moveLinkPage(page_arr[0]+bookmark,interval,true);
} else {
var linkUrl = '';
if(b.ONE) {
linkUrl = (view.length>0) ? '/index/view/' + view : '/index';
linkUrl = (!b.PUBLISH) ? '/render' + linkUrl + bookmark : linkUrl + bookmark;
} else {
var url_str = (view.length>0) ? page_arr[0] + '/view/' + view : page;
linkUrl = (URI=='/') ? '/' + url_str + bookmark : URI + '/' + url_str + bookmark;
}
if(target) {
var openLinkPage = window.open('about:blank');
openLinkPage.location.href=linkUrl;
} else {
var url = new getLocation(linkUrl);
golink(_this,url);
// location.replace(linkUrl);
}
}
}
var moveLinkPage = function(link,interval,isblock) {
interval = (typeof interval == 'undefined') ? 1200 : interval;
if(typeof isblock == 'undefined') isblock = '';
var header_fixed = ($('.dsgn-body').width()<769) ? $('.el-menu .navbar-header').height()-1 : $('#tpl-menu').height();
if($('header').hasClass('navbar-fheader')) header_fixed = $('header.navbar').outerHeight() - 1;
var isBookmark = false, bookmark_arr = new Array();
link = decodeURIComponent(link);
if(link.match(/\@/g)) {
isBookmark = true;
bookmark_arr = link.split('\@');
var check_link = true,
is_visible_menu = false;
$.each(b.SMENU, function (idx, obj) {
if(is_o_page == obj.name.replace(/ /g,'-')) {
if(!obj.link) check_link = false;
if(obj.display == 'on') is_visible_menu = false;
}
if(obj.children) {
$.each(obj.children, function (i, v){
if(is_o_page == v.name.replace(/ /g,'-')) {
if(!v.link) check_link = false;
if(v.display == 'on') is_visible_menu = false;
}
});
}
});
var is_here = ($('.element[data-bookmark="' + bookmark_arr[1] + '"]').length > 0 ) ? true : false,
is_page = (b.PAGE.toLowerCase()==bookmark_arr[0].toLowerCase() || b.VIEW && b.VIEW == bookmark_arr[0]) ? true : false,
is_o_page = (bookmark_arr[0].indexOf(',') > -1 && !b.VIEW) ? bookmark_arr[0].substring(0,bookmark_arr[0].indexOf(',')) : (b.VIEW) ? 'index' : bookmark_arr[0],
// is_visible_menu = ($.inArray(is_o_page,b.MENULINK)>-1) ? true : false,
// check_link = ( $('#tpl-menu li a[href*="'+is_o_page+'"]').length > 0 && $('#tpl-menu li a[href*="'+is_o_page+'"]').text().trim().replace(/ /gi,'-') == is_o_page ) ? false : true,
is_link = (check_link && is_visible_menu && is_o_page != 'INTRO') ? true : false,
is_visible = (check_link && is_visible_menu && is_o_page != 'INTRO') ? true : false;
if( ( !is_visible_menu && is_o_page!='index' ) ||
( /*!is_page &&*/ ( is_link || is_visible ) ) ||
( is_page && !is_here ) ) {
if(is_visible_menu==false) ;
else return false;
}
link = 'element[data-bookmark="' + bookmark_arr[1] + '"]';
} else {
link = (isblock=='') ? 'link-to-' + link : link;
}
var offset = ($('.dsgn-body').hasClass('sidebar')) ? 0 : -header_fixed;
if($('header.navbar').hasClass('disableOffset') && !$('.'+link).hasClass('el_0')) offset = 0;
offset = (window.innerWidth > 768) ? offset : -header_fixed;
// $('body').scrollTo('.'+link,interval,{offset:offset,easing :'easeInOutQuart'});
if($('.'+link).length==0) return;
var sTop = $('.'+link).offset().top + offset,
duration = (typeof $('#tpl-menu').attr('data-duration') != 'undefined') ? parseInt($('#tpl-menu').attr('data-duration')) : 1000;
sTop = (isAosBlock && $('.'+link).hasClass('el_0')==false && $('.menu-logo-top').length>0 && $('.menu-logo-top').css('display')=='block') ? sTop + $('.menu-logo-top').outerHeight() : sTop;
$('html, body').animate({
scrollTop: sTop
},duration, 'easeInOutQuart',function(){
if(isAosBlock) {
// $('.element').addClass('aos-init');
// $('.element').addClass('aos-animate');
$.each($('.element'),function(){
var aos = $(this).attr('data-aos-ch');
$(this).attr('data-aos',aos);
$(this).removeAttr('data-aos-ch');
});
}
});
var menuStr = (!isBookmark) ? link.replace('link-to-','') : bookmark_arr[0];
setTimeout(function() {
$('header #tpl-menu li a[href=#' + menuStr + ']').closest('li').addClass('active').siblings().removeClass('active');
if($('#mobile-nav #tpl-menu li').length) $('#mobile-nav #tpl-menu li a[href=#' + menuStr + ']').closest('li').addClass('active').siblings().removeClass('active');
},1100);
}
var getParent = function(parent,id,page) {
if(id) {
parent = (parent == 'forum') ? parent : 'project';
$.ajax({
url:'/template/get/parent/' + parent + '/id/' + id + '/sid/' + _this.b.SID + '/page/' + encodeURIComponent(page) + _this.b.param,
type:'get',
async:false,
cache: false,
dataType:'json',
success:function(data) {
property.PRODINFO = (data.prod_onoff == "on") ? data.PRODINFO : '';
_this.b.PARENT = data.PARENT;
_this.b.COUNT = data.COUNT;
}
});
} else {
property.PRODINFO = "";
_this.b.PARENT = {};
_this.b.COUNT = 0;
}
}
var showPageCallback = function(func,callback) {
func(b.MCSS, b.MSTYLE, b.MTAG, true);
if(typeof callback=='function') {
callback();
}
}
var showPage = function (css, style, tag, prop) {
if($('.fmcss').length > 0) $('.fmcss').remove();
$.each(style.children,function(k,v) {
if(k!='.dsgn-body') {
delete style.children[k];
}
});
elFooter();
if(b.HEADER && b.PARENT.mode == 'shopping') b.HEADER = 0;
if(b.HEADER && !$('header').hasClass('sidebar')) $('header.navbar').addClass('transparent');
menu_color = $('header.navbar').css('background-color');
header_fixed = $('header.navbar').height();
if(menu_color==('rgba(0, 0, 0, 0)')) {
$('header.navbar').css('background-color',$('dsgn-body').css('background-color'));
}
if(b.SETTINGS.passwordUse === true) {
var checkSiteLock = isSitePasswordLock();
}
var is_lock_block = 'active';
isMenuLock(function() {
if(b.ISLOCK == 'true' && is_lock_block == '' || b.ISLOCK != 'true') elPush(prop);
else {
$('.el-footer').css('visibility', 'visible');
$.processOFF();
}
});
// menu active
/* 190710 - menu or sub-menu 일부 같을때 첫번째 메뉴에 active error 생겨서 주석 처리. */
// if(b.PARENT.page) {
// $('#tpl-menu li').find('a:contains("' + b.PARENT.page + '")').parent().addClass('active');
// } else {
// if(b.ONE) {
// if(b.SMENU[0].display == 'off') $('#tpl-menu li').first().addClass('active');
// } else if(b.PAGE) {
// $('#tpl-menu li').find('a:contains("' + b.PAGE + '")').parent().addClass('active');
// }
// };
RENDER.setLoginout(b.LOGINOUT, b.SID, b.PUBLISH, b.PROFILEIMG);
$('body,html').animate({scrollTop: 0}, 300,'easeInOutQuart');
}
var loadPush = function(data) {
// console.log(' page draw:: loadPush');
// premium block
$('body').removeClass('overflow-hidden');
$('body').removeAttr('data-gjs');
var deferred = $.Deferred();
var pageID = b.PAGE.split(','),
chgBG = false,
tmpTag = '',
currentPAGE = b.PAGE,
default_t_css = '', default_m_css = '';
var is_templates = checkTemplateSite(b.SID);
var checkGalleryView = (b.VIEW && b.PAGE.match(/^forum,/g) === null) ? true : false,
checkShoppingView = (b.VIEW && b.PARENT.mode == 'shopping') ? true : false,
page_pos = 0,
site_settings = (typeof b.SETTINGS != 'undefined' && b.SETTINGS) ? b.SETTINGS : {};
if($('body').hasClass('openPopupBanner') && b.MENULINK[0] != currentPAGE) {
$.siteBanner.init(false,true);
}
$('#el-empty').empty();
$('.gallery-popup, .psearch-block').remove();
b.COUNT = data.length;
function drawData(idx, val) {
// console.log('drawData('+idx+','+val+')');
page_pos += 1;
var tag = htmlspecialchars_decode(val.eltag,'ENT_QUOTES'),
settings = (typeof val.elsettings != 'undefined' && val.elsettings) ? $.parseJSON(val.elsettings) : {},
block_lang = (typeof settings.blocklang != 'undefined' && settings.blocklang) ? settings.blocklang : LANG,
checkGalleryListSample = false,
checkGalleryListEmpty = true,
fontload = [];
if(idx == 0 && b.HEADER) {
var checkMenuHideBlock = ($('.el-menu.header').find('.hideBlockWrap').length > 0) ? true : false,
checkHideBlock = (typeof settings.block_display != 'undefined' && settings.block_display == 'OFF') ? true : false;
if(checkMenuHideBlock || checkHideBlock || val.overlap == 0 || $('header').hasClass('sidebar')) {
b.HEADER = 0;
$('header').removeClass('transparent');
if($('header').hasClass('navbar-fheader')) $.fheader.position();
}
}
if(val.type == 'project' && val.eltag.charAt(0) == '\<') tag = val.eltag;
if(typeof val.fonts != 'undefined') {
$.each(val.fonts, function(i,v) {
if(b.ELFONTS.indexOf(i) < 0 && v) {
b.ELFONTS.push(i);
$('#loadfonts').append(v);
}
});
}
if(typeof val.webfonts != 'undefined' && val.webfonts) {
$.each(val.webfonts, function(i2,v2) {
if(b.ELFONTS.indexOf(i2) < 0 && v2) {
b.ELFONTS.push(i2);
WebFont.load({ google : { families : [ v2 ] }});
}
})
}
if(val.type == 'gallery' && val.type2 == 'premium' && (!is_templates && (!b.VALIDPLAN || b.VALIDTYPE == 'PK'))) {
tag = '';
} else if(val.type == 'gallery' || val.type == 'shopping') {
$('#el-empty').append($(tag));
$('#el-empty').find('[data-loop="true"]').html('');
var nodes = $(tag).find('[data-loop="true"]').children('.grid'),
p = $('#el-empty').children(),
g = p.clone().removeClass().addClass('galleryPL'+val.seq).addClass('gallery-popup'),
i = [],
view = $(tag).find('[data-loop="true"]').data('view'),
g_number = $(tag).find("[data-loop='true']").data('gallery-no'),
total = 0;
var checkLoadmoreInLoop = ($(tag).find('[data-loop="true"] .loadmore-wrap').length) ? true : false,
glm = $(tag).find('.loadmore-wrap');
$('#el-empty').after(g);
$(g).after('');
galleryEL[val.seq] = {
'seq' : val.seq,
'elname' : val.elname,
'eltag' : tag,
'folder' : val.folder,
'mode' : val.mode,
'elsettings' : val.elsettings,
'feature' : val.feature,
'type' : val.type,
'type2' : val.type2,
'searches' : val.searches
};
if(typeof view == 'undefined') view = 10;
var cookie_page = 1,
cookie_view = view,
cookie_gallery_category = '',
is_gc_cookie = (typeof $.cookie('gallery-category-'+val.seq) != 'undefined' && $.cookie('gallery-category-'+val.seq).length > 0) ? true : false;
var cookie_gallery_orderby = 'recent';
var category_onoff = (typeof settings.category_display != 'undefined' && settings.category_display) ? settings.category_display : 'OFF';
var product_orderby_onoff = (typeof settings.product_orderby != 'undefined' && settings.product_orderby) ? settings.product_orderby : 'OFF';
var align_rnd_onoff = (typeof settings.align_rnd != 'undefined' && settings.align_rnd) ? settings.align_rnd : 'OFF';
if(val.mode != 'shopping') product_orderby_onoff = 'OFF';
// var adultonly_onoff = (typeof settings.adult_only != 'undefined' && settings.adult_only) ? settings.adult_only : 'OFF';
if(typeof $.cookie('loadmore-' + val.seq) != 'undefined' && $.cookie('loadmore-' + val.seq).length > 0) {
cookie_page = $.cookie('loadmore-'+val.seq);
cookie_gallery_category = (typeof $.cookie('gallery-category-'+val.seq) != 'undefined') ? $.cookie('gallery-category-'+val.seq) : '';
cookie_gallery_orderby = (typeof $.cookie('gallery-orderby-' + val.seq) != 'undefined') ? $.cookie('gallery-orderby-' + val.seq) : '';
cookie_view = cookie_page * view;
} else {
var checkCateHomeHide = (category_onoff == 'ON' &&
typeof settings.category != 'undefined' && settings.category &&
typeof settings.category_home_hide != 'undefined' && settings.category_home_hide) ? true : false;
if(checkCateHomeHide) {
var gc = settings.category.replace(/\|/g,'').split(',');
cookie_gallery_category = gc[0];
is_gc_cookie = true;
$.cookie('gallery-catehome-' + val.seq, cookie_gallery_category, { path : '/', expires: 12 * 60 * 60 * 1000 });
}
}
if(val.seq == 'all_products') {
// cookie_page = (typeof $.cookie('gallery-page-all_products') !== 'undefined' && $.cookie('gallery-page-all_products') != '')? $.cookie('gallery-page-all_products') : 1;
cookie_gallery_category = setAllProductsCurrentCat(settings);
// cookie_view = cookie_page * view;
} else {
if(!property.VIEW) $.removeCookie('gallery-page-all_products', { path: '/' });
}
$.cookie('gallery-page-' + val.seq, cookie_page, { path : '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-category-' + val.seq, cookie_gallery_category, { path : '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-orderby-' + val.seq, cookie_gallery_orderby, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.removeCookie('loadmore-' + val.seq, { path : '/' });
var el_gh = $(tag).find('.goption').attr('data-gh'),
checkGalleryHeight = (typeof el_gh != 'undefined' && el_gh) ? true : false,
checkGallerySVG = ($(tag).find('.gimg-svg-wrap').length > 0) ? true : false,
checkGFrameTitleOFF = (val.mode == 'gallery' && (typeof settings.gframe_title_visible != 'undefined' && settings.gframe_title_visible == 'OFF')) ? true : false;
var checkUseComment = checkUseCommentFunc(val.mode, val.eltag);
var checkUseLike = checkUseLikeFunc(val.mode, val.eltag);
var uri = getSearchURL();
if (isObjectEmpty(uri) && _this.b.LUX && val.mode == 'shopping') {
uri = val.searches.uri;
}
// if(uri.category_no == '') {
// uri.category_no = (typeof settings.lux_category_no != 'undefined') ? settings.lux_category_no : '';
// }
var res;
$.ajax({
url: '/template/gallery/list/pid/' + val.seq + '/sid/' + b.SID + '/spage/' + currentPAGE + '/view/' + cookie_view + param,
data: { g_mode: val.mode, visible: true, sfl: 'category', stx: cookie_gallery_category, uri : uri, only : val.only_category, orderby: cookie_gallery_orderby},
dataType: 'json',
type: 'POST',
async: false,
cache: false,
success: function (data) {
if(data.only_category) {
localStorage.setItem('searches',JSON.stringify(new Array(val.searches.uri[0])));
}
res = data;
$.each(data.list, function (idx, v) {
i.push(v);
});
total = (typeof data.total.list_total == 'undefined') ? data.total : data.total.list_total;
cookie_view = ( cookie_view > total ) ? total : cookie_view;
// cookie_view = (cookie_view < total) ? cookie_view : total;
if( total > 0 ) checkGalleryListEmpty = false;
if( i.length>0 || (i.length==0 && is_gc_cookie) ) {
var loop_count = nodes.length, item_index = 0;
var elem = [];
$.each(data.list,function(index,v) {
loop_pos = index%loop_count;
c = nodes[loop_pos];
var isTitle = (v.title.length > 0) ? true:false;
v.title = (v.title.length>0) ? v.title : $.lang[block_lang]['editor.block.gallery.sample.title'];
v.caption = (v.caption.length>0) ? v.caption : $.lang[block_lang]['editor.block.gallery.sample.caption'];
$(c).addClass('gallery-item').attr('data-index',index).attr('data-seq',v.seq);
var vgsettings = (typeof v.gsettings != 'undefined' && v.gsettings) ? $.parseJSON(v.gsettings) : {},
img_path = (typeof vgsettings['storage'] != 'undefined') ? vgsettings['storage'] : _this.b.RESOURCE + '/' + _this.b.SID + '/',
img_original = (typeof vgsettings['storage'] != 'undefined') ? img_path + '1920/' : img_path;
var folder = (val.folder == 0) ? '' : val.folder + '/',
src = getServeImage(v.image,val.folder,img_path),
src_s0 = getServeImage(v.image,'0',img_path);
if($(c).find('img').length > 0) $(c).find('img').attr('src',src);
if(val.mode == 'shopping') {
if($(c).find('img').length > 0) $(c).find('img').attr('alt',v.title);
} else {
alt_replace = v.alt.replace(/\s+|\n+/g, '-');
alt_replace.replace(/-+/g, '-')
if($(c).find('img').length > 0) $(c).find('img').attr('alt',alt_replace);
}
if($(c).find('.g-img').length > 0) $(c).find('.g-img').css('background-image', 'url('+src+')');
if(checkGallerySVG) {
var gimgSVG = $(c).find('.gimg-svg-wrap svg');
gimgSVG.find('pattern').attr('id','gimgSvg_'+val.elname+'_'+index);
gimgSVG.find('image').attr('xlink:href', src);
gimgSVG.find('polygon').attr('fill', 'url(#gimgSvg_'+val.elname+'_'+index+')');
}
var glink = (typeof vgsettings['glink'] != 'undefined' && vgsettings['glink']) ? vgsettings['glink'] : '',
glink_target = (typeof vgsettings['glink_target'] != 'undefined' && vgsettings['glink_target']) ? vgsettings['glink_target'] : '';
if(glink) {
if(glink.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark]
var bookmark_seq = glink.replace(/^\@/g,'');
if(typeof _this.b.SETTINGS.blockBookmarkList == 'undefined' || typeof _this.b.SETTINGS.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') {
glink = '';
glink_target = '';
}
} else if(glink.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink]
glink_target = '';
} else if($.inArray(glink.replace(/^\//g,'').replace(/ /g,'-'),_this.b.MENULIST) > -1) { // link-type: link-menu ==> a[data-user-link]
} else { // link-type: link-out ==> a[attr-link]
if(checkBase64Encode(glink)) glink = Base64.decode(glink);
}
}
$(c).find('a').removeAttr('data-gallery').removeAttr('data-user-link').removeAttr('attr-bookmark').removeAttr('attr-link').removeAttr('attr-flink');
if (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON' && property['SITEUM'] >= 1) {
$(c).addClass('gallery-item').addClass('nonePrice');
$(c).find('a').attr('href', '#');
} else {
if(glink) {
var glink_val = makeLinkUrl(glink, b.ONE, b.VIEW);
$(c).find('a').attr('href',glink_val);
if(glink.match(/^\@/g)) {
$(c).find('a').attr('attr-bookmark',glink.replace(/^\@/g,''));
} else if(glink.match(/^flink\@[0-9]/g) !== null) {
$(c).find('a').attr('attr-flink',glink.replace(/^flink\@/g,''));
// IE ERROR_includes__H.20210603
// } else if(_this.b.MENULIST.includes(glink.replace(/ /g,'-'))) {
} else if($.inArray(glink.replace(/ /g,'-'),_this.b.MENULIST) > -1) {
$(c).find('a').attr('data-user-link',glink_val);
} else {
$(c).find('a').attr('attr-link',glink);
}
} else {
if (val.mode == 'gallery') {
src_s0 = src_s0 + '?gpos='+v.pos;
$(c).find('a').attr('href', src_s0);
$(c).find('a').attr('data-gallery', '#gframe-' + val.seq);
} else {
if(val.seq == 'all_products') {
$(c).find('a').attr('href', v.product_url);
} else {
if(_this.b.LUX) $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/_product/' + v.seq);
else $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/' + _this.b.PAGE + '/view/' + v.seq);
// $(c).find('a').attr('href', ((URI=='/') ? '' : URI) + '/' + b.PAGE + '/view/' + v.seq);
}
}
}
}
if(glink_target == '_blank') $(c).find('a').attr('target','_blank');
else $(c).find('a').removeAttr('target');
if(checkGFrameTitleOFF || !isTitle) $(c).find('a').attr('data-title', '');
else $(c).find('a').attr('data-title', v.title);
// if(adultonly_onoff == 'ON') $(c).addClass('adultonly');
if(val.mode == 'shopping') {
if($(c).find('.figure.basket').length == 0) {
$(c).find('.figure').last().after('장바구니 담기
');
}
}
// caption
var ftitle = $(c).find('h5.figure'),
fcaption = $(c).find('p.figure').not('.comment'),
fdatetime = $(c).find('.figure.datetime'),
fhashtag = $(c).find('.figure.hashtag'),
fbrand = $(c).find('.figure.brand'),
fprice = $(c).find('.figure.price'),
freview = $(c).find('.figure.review'),
fcomment = $(c).find('.figure.comment'),
flike = $(c).find('.figure.like'),
fbasket = $(c).find('.figure.basket');
if(fcomment.length < 1 && settings.comment_display == 'ON' && checkUseComment) {
$(c).find('figcaption p.figure.caption').after('');
fcomment = $(c).find('.figure.comment');
}
if(flike.length < 1 && settings.like_display == 'ON' && checkUseLike){
if (fcomment.length > 0) {
if(index == 0) fcomment.after('');
else fcomment.after('');
} else {
if(index == 0) $(c).find('figcaption:not(.top) .figure:last-child').after('');
else $(c).find('figcaption:not(.top) .figure:last-child').after('');
}
flike = $(c).find('.figure.like');
}
$(c).find('figcaption').removeClass('hide');
if (v.title || v.caption) {
var gallery_caption = v.caption;
gallery_caption = gallery_caption.replace(/\n/g,'
');
ftitle.html(v.title);
fcaption.html(gallery_caption);
if(fdatetime.length > 0) fdatetime.text(v.datetime);
if(fhashtag.length > 0) fhashtag.text(v.hashtag);
}
if(g_number) {
var g_index = String(index + 1),
g_num = g_index.padStart(g_number, '0');
$(c).find('.figure.number').text(g_num);
}
if(fbrand.length > 0) {
var fbrand_name = (typeof v.brand_name != 'undefined' && v.brand_name) ? v.brand_name : '';
fbrand.html(v.brand_name);
}
if(val.mode == 'shopping' || val.seq == 'all_products') {
fcomment.addClass('hide');
flike.addClass('hide');
v.price = typeof v.price != 'undefined' ? parseFloat(v.price) : 0;
v.sale = typeof v.sale != 'undefined' ? parseFloat(v.sale) : 0;
var checkPriceHidden = (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON') ? true : false,
gallery_price = (v.price && !checkPriceHidden) ? v.price : 0,
gallery_sale_price = (typeof v.sale != 'undefined' && v.sale > 0 && v.sale > v.price && !checkPriceHidden) ? v.sale : 0,
gallery_sale_per = (typeof v.sale_per != 'undefined' && v.sale_per && !checkPriceHidden) ? v.sale_per : '',
product_soldout = '품절',
product_no_sale = (typeof settings.sh_soldout == 'string') ? settings.sh_soldout : '구매불가',
product_status = '';
if(v.status == 'off' && !checkPriceHidden) {
product_status = '' + product_no_sale + '';
} else if(v.quantity_on == 'on' && v.quantity < 1 && !checkPriceHidden) {
product_status = '' + product_soldout + '';
}
$(c).find('.cl-sh-soldout').remove();
if(product_status != '') $(c).attr('data-soldout',true);
else $(c).removeAttr('data-soldout');
$(c).find('.product-badge').remove();
product_status += drawBadgeList(v.use_badge, data.badge_settings);
$(c).find('.cl-sh-limit').remove();
if(v.status == 'lim') {
if(v.sale_now == false) {
var product_limit = '상품 구매 가능 기간이 아닙니다.
';
if(freview.length > 0) {
freview.after(product_limit);
} else {
$(c).find('figcaption:not(.top) .figure:last-child').after(product_limit);
}
}
}
if($(c).find('ul.figure.price').length > 0) {
// var price_off = (v.sale_price > 0 && v.sale_price > v.price) ? 100 - Math.floor((v.price / v.sale_price) * 100) : 0,
// off_str = (price_off > 0) ? price_off + '% ' : ''
var off_str = (v.sale_rate > 0) ? v.sale_rate + '% ' : '';
if(!_this.b.LUX) off_str = gallery_sale_per;
//Ver2
if(!checkPriceHidden) {
$(c).find('ul.figure.price .price-val').html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-val').removeClass('hide');
if(gallery_sale_price > 0 && gallery_price < gallery_sale_price) {
$(c).find('ul.figure.price .price-sale').html('₩' + gallery_sale_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-sale-per').html(off_str);
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').removeClass('hide');
if(_this.b.LUX && (v.hashtag).indexOf('특가세일') > -1 && $(c).find('ul.figure.price .sp-price').length == 0) {
$(c).find('ul.figure.price .price-sale').after('특가세일');
}
} else {
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').addClass('hide').html('');
}
} else {
$(c).find('ul.figure.price .price-val').html('₩0');
$(c).find('ul.figure.price .price-val').removeClass('hide');
}
if(val.seq == 'all_products' && checkPriceHidden) $(c).find('ul.figure.price').html('');
if(product_status) $(c).find('ul.figure.price').append(''+product_status+'');
var badge_size = getBadgeSize(data.badge_settings);
$(c).find('.cl-sh-soldout').removeClass('badge-small badge-medium badge-large');
$(c).find('.cl-sh-limit').removeClass('badge-small badge-medium badge-large');
if(badge_size) {
$(c).find('.cl-sh-soldout').addClass(badge_size);
$(c).find('.cl-sh-limit').addClass(badge_size);
}
} else {
//Ver1
if(fprice.length == 0) fprice = fcaption;
if(checkPriceHidden) fprice.html('');
else fprice.html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,',') + product_status);
}
if($(c).find('ul.figure.review').length > 0) {
var gallery_review = (v.review_onoff && v.review_cnt) ? v.review_cnt : 0;
if(gallery_review > 0) {
$(c).find('ul.figure.review, ul.figure.review li').removeClass('hide');
$(c).find('ul.figure.review .figure-review-cnt').html(gallery_review);
$(c).find('ul.figure.review .figure-review-score').html(v.review_score);
} else {
$(c).find('ul.figure.review, ul.figure.review li').addClass('hide');
$(c).find('ul.figure.review .figure-review-cnt, ul.figure.review .figure-review-score').html('');
}
}
if(fbasket.length > 0) {
var checkOldBlock = ($(c).find('.figure.basket[data-oldver="true"]').length > 0) ? true : false,
checkOldverBasket = (typeof settings.field_oldver != 'undefined' && settings.field_oldver && settings.field_oldver.indexOf('basket') > -1) ? true : false,
checkDisabledBasket = (typeof settings.field_disable != 'undefined' && settings.field_disable && settings.field_disable.indexOf('basket') > -1) ? true : false;
if(v.basket_off) fbasket.addClass('cannotby hide');
else if(val.seq == 'all_products') fbasket.removeClass('hide');
else if(checkDisabledBasket || (!checkDisabledBasket && checkOldBlock && !checkOldverBasket)) fbasket.addClass('hide');
else if(property.VALIDTYPE != 'SM') fbasket.addClass('hide');
else fbasket.removeClass('hide');
}
} else {
fbrand.addClass('hide');
fprice.addClass('hide');
freview.addClass('hide');
fbasket.addClass('hide');
if(val.mode == 'project' && fcomment.length > 0 && typeof v.comment_cnt != 'undefined' && v.comment_cnt > 0 && settings.comment_display == 'ON') {
fcomment.find('.figure-comment-cnt').html(v.comment_cnt);
if(settings.field_disable !== undefined && settings.field_disable.indexOf('comment') > -1) {
fcomment.addClass('hide');
} else {
fcomment.removeClass('hide');
}
} else {
fcomment.addClass('hide');
}
if(flike.length > 0 && settings.like_display == 'ON' && checkUseLike) {
flike.removeAttr('data-like').removeClass('hide active');
if(v.like !== undefined) {
flike.find('.figure-like-cnt').html(v.like.cnt);
if(v.like.own) flike.attr('data-like', v.seq).addClass('active');
}
if(settings.field_disable !== undefined && settings.field_disable.indexOf('like') > -1) {
flike.addClass('hide');
} else {
flike.removeClass('hide');
}
} else {
flike.addClass('hide');
}
if(checkUseLike == false) flike.html('');
}
var on_figure_total = $(c).find('figcaption .figure:not(.hide, .review[data-review_cnt="false"][data-review_score="false"])').length;
if(on_figure_total > 0) $(c).find('figcaption').addClass('allhide');
else $(c).find('figcaption').removeClass('allhide');
if(val.mode == 'gallery') {
if(index < cookie_view) {
$(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
} else {
$(c).find('figure').remove();
$(g).find('[data-loop="true"]').append($(c)[0].outerHTML);
}
if (total == 2) {
$(c).find('figure').remove();
$('.gallery-empty').append($(c)[0].outerHTML);
}
} else {
$(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
}
});
} else {
checkGalleryListSample = true;
if(val.mode=='project' && b.TEMPLATE == false) {
nodes.addClass('gallery-item');
nodes.find('a').attr('href', ((URI=='/') ? '' : URI) + '/' + b.PAGE + '/view/template').removeAttr('data-gallery').find('img').attr('data-index',0);
}
if(b.TEMPLATE !== false) {
if(settings.comment_display != 'ON' || (settings.field_disable !== undefined && settings.field_disable.indexOf('comment') > -1)) nodes.find('.figure.comment').addClass('hide');
else nodes.find('.figure.comment').removeClass('hide');
if(settings.like_display != 'ON' || (settings.field_disable !== undefined && settings.field_disable.indexOf('like') > -1)) nodes.find('.figure.like').addClass('hide');
else nodes.find('.figure.like').removeClass('hide');
}
$(p).find('[data-loop="true"]').append(nodes);
}
if(checkLoadmoreInLoop) $(p).find('[data-loop="true"]').append(glm);
tag = $(p)[0].outerHTML;
if (val.mode == 'gallery' && total == 2) {
$.each($('.gallery-empty').find('.gallery-item'), function(i,v) {
$(g).find('[data-loop="true"]').append(v);
});
}
$('#el-empty').empty();
$('.gallery-empty').remove();
}
});
} else {
if(typeof pageID[1] != 'undefined' && idx==0 && pageID[1] != 'template' && b.COUNT==0) {
d = document.createElement('div');
$(d).addClass('temp-element').html(tag);
var pTitle = (b.PARENT.title) ? b.PARENT.title : $.lang[block_lang]['editor.block.gallery.sample.title'];
pCaption = (b.PARENT.caption) ? b.PARENT.caption : $.lang[block_lang]['editor.block.gallery.sample.caption'];
pCaption = pCaption.replace(/\n/g, '
');
$(d).find('.data-date').text(b.PARENT.datetime);
$(d).find('.data-category').text(b.PARENT.category);
$(d).find('h5.figure').text(pTitle);
$(d).find('p.figure').not('.comment').html(pCaption);
tag = $(d).html();
$(d).remove();
tmpTag = tag;
}
}
//add style
var $style_tag = $('');
$style_tag.attr('id','el_'+idx+'css');
if(typeof val.elcss != 'undefined') {
$style_tag.html(htmlspecialchars_decode(val.elcss));
$('.header').before($style_tag);
}
//change carousel id
var $tag = $(tag);
$.each($tag.find('[data-edit="true"]'), function(i,v) {
var source = $(this).outerHTML();
source = source.replace(/< /g,'<').replace(/ >/g,'>').replace(/data-attr-bookmark/g,'attr-bookmark');
$(this).replaceWith(source);
});
if(typeof total == 'undefined') total = 0;
msny = (val.feature=='masonry') ? true : false;
var blocklang = '';
if(val.type == 'video') {
if($tag.find('.video-gallery-url').length > 0) val.mode = 'zoom';
else val.mode = 'thumb';
}
//페이지 이동
$tag.addClass('el_' + idx)
.attr('data-id', val.seq)
.attr('data-el','el_' + idx)
.attr('data-pos', idx+1)
.attr('data-name', val.elname)
.attr('data-msny', msny)
.attr('data-type', val.type)
.attr('data-type2', val.type2)
.attr('data-feature', val.feature)
.attr('data-mode', val.mode)
.attr('data-width', val.folder)
.attr('data-overlap',val.overlap);
if(typeof settings.blocklang != 'undefined') {
blocklang = settings.blocklang;
$tag.attr('data-blocklang',blocklang);
}
if (val.type == 'sync') {
var sync_list_total = (typeof val.sync !='undefined' && typeof val.sync.list != 'undefined' && (val.sync.list).length > 0) ? (val.sync.list).length : 0;
if($tag.find('.slick-page-label').length > 0) {
var page_label = sync_list_total;
if(val.type2 == 'imgpitem' && sync_list_total == 0) page_label = $tag.find('.slick .item').length;
$tag.find('.slick-page-label .slick-page-now').text(1);
$tag.find('.slick-page-label .slick-page-total').text(page_label);
}
if($tag.find('.sync-option').length > 0) {
var sync_css = CSSJSON.toJSON(htmlspecialchars_decode(val.elcss));
syncStyle = style.get(sync_css,val.elname),
sync_view = (typeof syncStyle.__sync_view != 'undefined') ? syncStyle.__sync_view : 4,
sync_view_t = (typeof syncStyle.__sync_view_t != 'undefined') ? syncStyle.__sync_view_t : 2,
sync_view_m = (typeof syncStyle.__sync_view_m != 'undefined') ? syncStyle.__sync_view_m : 1,
sync_space = (typeof syncStyle.__sync_space != 'undefined') ? syncStyle.__sync_space : 10,
sync_space_top = (typeof syncStyle.__sync_space_top != 'undefined') ? syncStyle.__sync_space_top : 1,
sync_height = (typeof syncStyle.__sync_height != 'undefined') ? syncStyle.__sync_height : 1,
sync_page_unit = (typeof syncStyle.__sync_page_unit != 'undefined') ? syncStyle.__sync_page_unit : -1;
$tag.find('.sync-option').attr({
'data-sync-view': Number(sync_view),
'data-sync-view-t': Number(sync_view_t),
'data-sync-view-m': Number(sync_view_m),
'data-sync-space': Number(sync_space),
'data-sync-space-top': Number(sync_space_top),
'data-sync-height': Number(sync_height)
});
if(sync_page_unit > -1) {
$tag.find('.sync-option').attr('data-sync-hidden', (Number(sync_page_unit) + 1));
if($tag.find('.sync-page-label').length > 0) {
var sync_p_cnt = $tag.find('.sync-row .sync-item').length,
sync_p_total = Math.ceil(sync_p_cnt / Number(sync_page_unit));
$tag.find('.sync-page .sync-page-now').text(1);
$tag.find('.sync-page .sync-page-total').text(sync_p_total);
if(sync_p_total == 1) $tag.find('.sync-page-wrap').hide();
else $tag.find('.sync-page-wrap').show();
}
}
}
}
// lux shopping
if(b.LUX && typeof res != 'undefined') {
if(val.type == 'gallery' && val.mode == 'shopping') {
refreshGalleryHeight(val.name)
}
}
if(checkGalleryView) {
if(val.page == 'fixedblock_'+b.PARENT.pid) $tag.addClass('el-fixedblock');
else $tag.removeClass('el-fixedblock');
$tag.attr('data-pos', page_pos);
// if(b.LUX && (val.orgpos == '1' || $tag.is('.lux-product-block'))) $tag.attr('data-ppos', (val.pos*1) + 1);
// else $tag.attr('data-ppos', val.pos);
$tag.attr('data-ppos', val.pos);
$tag.attr('data-posby', val.elnew);
}
if(val.type=='forum' || val.type=='latest') $tag.addClass('preloading');
if(b.ONE && val.orgpos==1) {
$tag.attr('data-link', val.orgpage);
$tag.addClass('link-to-'+val.orgpage.replace(/ /g,'-'));
}
$tag.addClass('element');
$last_el = ($('.fnav').length) ? $('.fnav') : $('.el-footer');
if($tag.hasClass('error_404')==false) {
if($tag.hasClass('el-footer')==false) {
if($tag.hasClass('cl-s-product-detail')==false) {
aosAddblock(site_settings,settings,$tag);
}
}
}
var data_aos_attr = '';
if($tag.is('[data-aos]')) {
data_aos_attr = $tag.attr('data-aos');
$tag.removeAttr('data-aos');
$tag.addClass('aos-init')
}
$last_el.before($tag);
refreshGalleryHeight(val.elname);
if(data_aos_attr) {
$tag.removeClass('aos-animate');
$tag.addClass('render-aos');
$tag.attr('data-aos-dummy', data_aos_attr);
}
if(val.type == 'sns' && typeof val.type2 != 'undefined' && val.type2 == 'feed') {
$tag.find('.data-feed-load-more').attr('data-feed-el',val.elname);
$tag.find('.data-feed-load-more').removeAttr('style');
$tag.find('.show-posts').removeClass('show-posts');
if(val.mode == 'site') {
if(!$.isEmptyObject(b.SOCIAL)) {
var load_sns = {};
if(!$.isEmptyObject(b.SOCIAL.instagram) && typeof settings.sns_instagram != 'undefined' && settings.sns_instagram == 'ON') load_sns['instagram'] = b.SOCIAL.instagram;
if(!$.isEmptyObject(b.SOCIAL.twitter) && typeof settings.sns_twitter != 'undefined' && settings.sns_twitter == 'ON') load_sns['twitter'] = b.SOCIAL.twitter;
if(!$.isEmptyObject(load_sns)) {
loadingElement(val.elname,'loading posts...');
updateFeed(val.elname,load_sns,function() {
$('.'+val.elname+' .listprogress').remove();
});
}
}
} else {
// SNS FEED:: before version
if(typeof settings.sns != 'undefined' && settings.sns.twitter) {
loadingElement(val.elname,'loading posts...');
updateFeed(val.elname,settings.sns);
}
}
}
if(val.type == 'others' && typeof val.type2 != 'undefined' && val.type2 == 'countdown') {
var el_dday = $tag.find('[data-dday="true"]'),
cd_date = (el_dday.attr('data-countdown')) ? el_dday.attr('data-countdown') : new Date(),
dateformat = { days : '%D', hours: '%H', minutes: '%M', seconds: '%S' },
dateendformat = { days : '00', hours: '00', minutes: '00', seconds: '00' };
if( typeof settings.countdown != 'undefined' && settings.countdown ) { //set - block setting date
cd_date = settings.countdown;
}
if( !el_dday.attr('data-countdown') && typeof countdown == 'object' ) { //set - example date
cd_date.setTime(cd_date.getTime() + (35*24*60*60*1000));
}
cd_date = moment(cd_date).format('YYYY/MM/DD HH:mm:ss');
el_dday.countdown(cd_date, function(event) {
$(this).find('.date-item[data-datetype]').each(function(i) {
var dd_type = $(this).attr('data-datetype'),
dd_format = $(this).attr('data-format'),
dd_endformat = $(this).attr('data-finish');
if(typeof dd_format == 'undefined' || !dd_format) dd_format = dateformat[dd_type];
if(typeof dd_endformat == 'undefined' || !dd_endformat) dd_endformat = dateendformat[dd_type];
if(event.elapsed) $(this).text(dd_endformat);
else $(this).text(event.strftime(dd_format));
});
});
}
if(typeof settings.bookmark != 'undefined' && settings.bookmark) {
$tag.attr('data-bookmark',val.seq);
}
if(val.type == 'gallery') {
// gallery frame add
if(val.mode == 'gallery' && total) tag = appendGalleryFrame($(tag), val.seq, val.elsettings, '', val.elcss);
(checkGalleryListEmpty) ? $tag.addClass('emptyGallery') : $tag.removeClass('emptyGallery');
$tag.attr('data-category',category_onoff);
$tag.attr('data-product-orderby', product_orderby_onoff);
$tag.attr('data-align-rnd', align_rnd_onoff);
if(category_onoff == 'ON') {
loadGalleryCategoryBlock($tag,val.seq,settings);
if(!checkGalleryListSample) {
$tag.find('.empty-txt').remove();
$tag.find('.container:not(.fh-container),[data-loop="true"]').removeClass('empty');
if(checkGalleryListEmpty) {
var empty_info = (val.seq == 'all_products') ? $.lang[LANG]['editor.gallery.product.empty.list'] : $.lang[LANG]['editor.gallery.category.empty.list'],
empty_info = (_this.b.LUX) ? $.lang[LANG]['editor.gallery.product.empty.list'] : empty_info,
gallery_empty_str = '' + empty_info + '
';
if(val.feature=='masonry') {
$tag.find('.container:not(.fh-container)').removeAttr('style').addClass('empty').append(gallery_empty_str);
} else {
$tag.find('[data-loop="true"]').addClass('empty').empty().append(gallery_empty_str);
}
// if(!is_gc_cookie) $tag.find('.gallery-category-nav').addClass('empty');
// else $tag.find('[data-loop="true"]').addClass('empty').append(gallery_empty_str);
}
}
}
if($tag.find('.goption[data-gcol]').length > 0) {
var gOption = $tag.find('.goption[data-gcol]'),
gcol = gOption.attr('data-gcol'),
gcol_t = gOption.attr('data-gcol-t'),
gcol_m = gOption.attr('data-gcol-m');
if(typeof gcol_t == 'undefined') { gOption.attr('data-gcol-t',gcol); gcol_t = gcol; }
if(typeof gcol_m == 'undefined') { gOption.attr('data-gcol-m',gcol_t); }
}
var img_onoff = (typeof settings.img_original_display != 'undefined' && settings.img_original_display) ? settings.img_original_display : 'OFF',
title_onoff = (typeof settings.gframe_title_visible != 'undefined' && settings.gframe_title_visible == 'OFF') ? false : true;
like_onoff = (typeof settings.like_display != 'undefined' && settings.like_display == 'ON') ? settings.like_display : 'OFF';
$tag.find('[data-gallery]').attr({'data-img-original':img_onoff, 'data-gallery-title':title_onoff, 'data-gallery-like':like_onoff});
if(!title_onoff) $tag.find('[data-gallery]').attr('data-title','');
if(typeof val.price_hidden != 'undefined' && val.price_hidden == 'ON') {
$tag.find('.figure.price').html('');
}
refreshGalleryField($tag,settings);
var $glmBtnWrap = $tag.find('.loadmore-wrap'),
$glmBtn = $tag.find('.loadmore-wrap .gallery-loadmore'),
checkLoadmore = (total > view && total > cookie_view && !checkGalleryListEmpty) ? true : false,
glm_lang = LANG;
if(typeof settings.loadmore_lang != 'undefined' && settings.loadmore_lang && $.inArray(settings.loadmore_lang.toLowerCase(), ['ko','en']) > -1) glm_lang = settings.loadmore_lang.toLowerCase();
else if(typeof block_lang != 'undefined' && $.inArray(block_lang, ['ko','en']) > -1) glm_lang = block_lang;
var glm_txt = $.lang[glm_lang]['config.loadmore'];
if($glmBtnWrap.length == 0) {
// gallery loadmore btn - default (ver1)
if(checkLoadmore) {
var glm_class = (val.feature=='masonry') ? 'gallery-loadmore masonry-layout' : 'gallery-loadmore',
glm_btn = '' + glm_txt +' (' + cookie_view + ' / ' + number_format(total) + ')
';
if($tag.find('.gallery-loadmore[data-id="'+val.seq+'"]').length > 0) $('.gallery-loadmore[data-id="'+selectID+'"]').replaceWith(glm_btn);
else $tag.append(glm_btn);
} else $tag.find('.gallery-loadmore').remove();
} else {
// gallery loadmore btn - custom (ver2)
if(checkLoadmore) {
if(val.feature=='masonry') $glmBtn.addClass('masonry-layout');
else $glmBtn.removeClass('masonry-layout');
$glmBtn.attr('data-loadmore','true').attr('data-id',val.seq).attr('data-total',total).attr('data-page',Number(cookie_page)+1).attr('data-view',view).attr('data-folder',val.folder).attr('data-mode',val.mode);
$glmBtn.find('.label').text(glm_txt);
$glmBtn.find('.display .view').text(cookie_view);
$glmBtn.find('.display .total').text(total);
$glmBtnWrap.removeClass('hide').fadeIn();
} else {
$glmBtnWrap.fadeOut().addClass('hide');
$glmBtn.removeAttr('data-loadmore').removeAttr('data-id').removeAttr('data-total').removeAttr('data-page').removeAttr('data-view').removeAttr('data-folder').removeAttr('data-mode').removeClass('masonry-layout');
$glmBtn.find('.label').text(glm_txt);
$glmBtn.find('.display .view').text('0');
$glmBtn.find('.display .total').text('0');
}
}
if($tag.is('[data-type2="premium"]')) {
var gjs_status = (typeof elGalleryJS[val.seq] != 'undefined') ? 'reload-block' : 'load-block';
setGalleryJS(gjs_status,$tag);
}
}
if(val.type == 'sync') {
var sync_source = _this.syncUpdate($tag, val);
$tag.html(sync_source);
if($tag.find('[data-sync-loop="true"]').length > 0) {
if(val.type2 == 'tab') $tag.find('[data-sync-loop="true"] > li[data-list-no="1"]').attr('data-list-no','');
if(val.type2 == 'imgpitem' && sync_list_total > 0) $tag.find('[data-sync-loop="true"] > li:not([data-idx])').remove();
$tag.find('[data-sync-loop="true"] > li').eq(0).addClass('active').siblings().removeClass('active');
}
}
if(val.seq == 'all_products') {
loadAllproductSort($tag, settings, val.total.list_total);
}
if(val.type == 'forum') {
var view = $tag.find('[data-loop="true"]').attr('data-view');
if(typeof view == 'undefined') view = 10;
if(typeof $.cookie('forum_' + val.seq) != 'undefined' && $.cookie('forum_' + val.seq)) {
$.forum.init(val.seq,b.PAGE,view,$.cookie('forum_' + val.seq),$.cookie('forum_'+ val.seq +'_sfl'),$.cookie('forum_'+ val.seq +'_stx'),$.cookie('forum_'+ val.seq +'_scate'));
} else {
$.forum.init(val.seq,b.PAGE,view);
}
$.removeCookie('forum', { path : '/' });
$.removeCookie('forum_'+val.seq, { path : '/' });
$.removeCookie('forum_'+val.seq+'_sfl', { path : '/' });
$.removeCookie('forum_'+val.seq+'_stx', { path : '/' });
$.removeCookie('forum_'+val.seq+'_scate', { path : '/' });
if(val.type2 == 'guestbook') {
if(settings.input_updown == 'U') {
$tag.find('.default_top').removeClass('flex-value-order2').addClass('flex-value-order1');
$tag.find('.default_bottom').removeClass('flex-value-order1').addClass('flex-value-order2');
}
else {
if (typeof settings.input_updown == 'undefined') {//블럭 추가 당시 세팅값 없을 때
$tag.find('.default_top').removeClass('flex-value-order2').addClass('flex-value-order1');
$tag.find('.default_bottom').removeClass('flex-value-order1').addClass('flex-value-order2');
} else {
$tag.find('.default_top').removeClass('flex-value-order1').addClass('flex-value-order2');
$tag.find('.default_bottom').removeClass('flex-value-order2').addClass('flex-value-order1');
}
}
}
}
if(b.LUX && typeof res != 'undefined') {
shopHeaderDisplay($tag.find('.shop-filter-header'),res);
}
var checkVideoTag = (val.type == 'video' || $tag.find('video').length > 0) ? true : false;
if(checkVideoTag) {
if (navigator.userAgent.match(/(safari)/gi) !== null) {
$tag.find('video').each(function() {
//safari...
$(this).attr('webkit-playsinline',1);
$(this).attr('playsinline',1);
});
}
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/gi) !== null) {
$tag.find('video').each(function() {
$(this).removeAttr('muted');
$(this).removeAttr('loop');
$(this).removeAttr('autoplay');
$(this).removeAttr('preload');
});
}
}
if(val.type == 'latest') {
var latest_data = (typeof settings.latest_data != 'undefined' && settings.latest_data) ? settings.latest_data : {};
$.latest.init(val.seq, latest_data);
$tag.removeClass('preloading');
}
if(val.type == 'review') {
galleryEL[val.seq] = {
'seq' : val.seq,
'elname' : val.elname,
'eltag' : tag,
'folder' : val.folder,
'mode' : val.mode,
'elsettings' : val.elsettings,
'feature' : val.feature,
'type' : val.type,
'type2' : val.type2,
'searches' : val.searches
};
var gallery_data = (typeof settings.gallery_data != 'undefined' && settings.gallery_data) ? settings.gallery_data : {};
$.reviewContents.init(val.seq, gallery_data);
}
if(b.VIEW) {
var img_onoff = (typeof settings.img_original_display != 'undefined' && settings.img_original_display) ? settings.img_original_display : 'OFF';
$tag.find('img[data-attach="true"]').attr('data-img-original',img_onoff);
var c_g_p = (typeof $.cookie('gallery-page-' + b.PARENT.pid) != 'undefined') ? $.cookie('gallery-page-' + b.PARENT.pid) : 1;
$.cookie('gallery',b.PARENT.pid, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('loadmore-' + b.PARENT.pid, c_g_p, { path: '/', expires: 12 * 60 * 60 * 1000 });
if(typeof $.cookie('gallery-page-all_products') !== 'undefined' && $.cookie('gallery-page-all_products')) {
c_g_p = (typeof $.cookie('gallery-page-all_products') != 'undefined') ? $.cookie('gallery-page-all_products') : 1;
$.cookie('gallery','all_products', { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('loadmore-all_products', c_g_p, { path: '/', expires: 12 * 60 * 60 * 1000 });
}
}
$tag.find('[data-map="true"]:not(iframe)').each(function() {
var map_url = $(this).attr('data-url');
if(typeof map_url != 'undefined' && map_url) {
var map_iframe = getMapURL(map_url,'html');
$(this).replaceWith(map_iframe);
if(map_iframe.indexOf('google-map disabled') === -1) $(this).next('.map-undefined').remove();
}
});
if($tag.find('[data-map_kind="kakao"]').length && (typeof kakao == 'undefined' || typeof kakao.maps == 'undefined' || kakao.maps == null || property.VALIDPLAN == '')) {
$tag.find('[data-map_kind="kakao"]').html('지도연결해제됨. Javascript키 확인');
$tag.find('[data-map_kind="kakao"]').html('');
} else {
$tag.find('[data-map_kind="kakao"]').each(function() {
var container = this;
var lat = $(this).data("lat");
var lng = $(this).data("lng");
var options = { center: new kakao.maps.LatLng(lat, lng), level: 3};
var c_map = new kakao.maps.Map(container, options);
var marker = new kakao.maps.Marker({ position: new kakao.maps.LatLng(lat, lng), map: c_map});
var zoomInOut = $(this).data("zoominout");
var mapTitle = $(this).data("maptitle");
var mapContent = $(this).data("mapcontent");
var useTitle = $(this).data("usetitle");
var useContent = $(this).data("usecontent");
if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false;
if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = '';
if(typeof mapContent == 'undefined' || !mapContent) mapContent = '';
if(typeof useTitle == 'undefined' || !useTitle) useTitle = false;
if(typeof useContent == 'undefined' || !useContent) useContent = false;
if(zoomInOut == true) {
// var mapTypeControl = new kakao.maps.MapTypeControl();
// c_map.addControl(mapTypeControl, kakao.maps.ControlPosition.TOPRIGHT);
// var zoomControl = new kakao.maps.ZoomControl();
// c_map.addControl(zoomControl, kakao.maps.ControlPosition.RIGHT);
var zoomControlHtml = '';
zoomControlHtml += '\
\
';
var $zoomController = $(zoomControlHtml);
$(container).append($zoomController);
var zoom_slider = $zoomController.find('.zoom-control-slider').slider({
'orientation': 'vertical',
'min' : 1,
'max' : 14,
'step' : 1,
'value' : 3,
'handle' : 'dfafasdfas
',
// 'reversed' : true,
'tooltip' : 'hide',
}).on('slide', function(data) {
c_map.setLevel(data.value);
c_map.setCenter(marker.getPosition());
}).on('slideStop', function(data) {
c_map.setLevel(data.value);
c_map.setCenter(marker.getPosition());
});
$zoomController.find('.btn-zoom-control').on('click', function() {
if($(this).data('inout') == 'I') {
c_map.setLevel(c_map.getLevel() - 1);
zoom_slider.slider('setValue', c_map.getLevel());
} else if($(this).data('inout' == 'O')) {
c_map.setLevel(c_map.getLevel() + 1);
zoom_slider.slider('setValue', c_map.getLevel());
}
});
kakao.maps.event.addListener(c_map, 'zoom_changed', function() {
zoom_slider.slider('setValue', c_map.getLevel());
});
}
if((useTitle == true || useContent == true) && (mapTitle || mapContent)) {
var iwContent = '';
if(useTitle == true && mapTitle) {
iwContent = '' + mapTitle + '
';
}
if(useContent == true && mapContent) {
iwContent += '' + mapContent + '
';
}
// var infowindow = new kakao.maps.InfoWindow({
// position: marker.getPosition(),
// content : iwContent
// });
// infowindow.open(c_map, marker);
if(iwContent) {
iwContent = '';
var infoWindow = $(iwContent);
$(container).append(infoWindow);
// infoWindow.css('bottom', 'calc(-100% + ' + (infoWindow.outerHeight() + 36) + 'px)');
}
}
$(window).on("resize", function() {
c_map.setCenter(marker.getPosition());
});
});
}
if($tag.find('[data-map_kind="naver"]').length && (typeof naver == 'undefined' || typeof naver.maps == 'undefined' || naver.maps == null || property.VALIDPLAN == '')) {
$tag.find('[data-map_kind="naver"]').html('지도연결해제됨. Client ID 확인');
$tag.find('[data-map_kind="naver"]').html('');
} else {
$tag.find('[data-map_kind="naver"]').each(function() {
var container = this;
var lat = $(this).data("lat");
var lng = $(this).data("lng");
var options = { center: new naver.maps.LatLng(lat, lng), zoom: 17};
var c_map = new naver.maps.Map(container, options);
var marker = new naver.maps.Marker({ position: new naver.maps.LatLng(lat, lng), map: c_map});
var zoomInOut = $(this).data("zoominout");
var mapTitle = $(this).data("maptitle");
var mapContent = $(this).data("mapcontent");
var useTitle = $(this).data("usetitle");
var useContent = $(this).data("usecontent");
if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false;
if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = '';
if(typeof mapContent == 'undefined' || !mapContent) mapContent = '';
if(typeof useTitle == 'undefined' || !useTitle) useTitle = false;
if(typeof useContent == 'undefined' || !useContent) useContent = false;
if(zoomInOut == true) {
// options.zoomControl = true;
var zoomControlHtml = '';
zoomControlHtml += '\
\
';
var $zoomController = $(zoomControlHtml);
$(container).append($zoomController);
var zoom_slider = $zoomController.find('.zoom-control-slider').slider({
'orientation': 'vertical',
'min' : 6,
'max' : 21,
'step' : 1,
'value' : 17,
'handle' : 'dfafasdfas
',
'reversed' : true,
'tooltip' : 'hide',
}).on('slide', function(data) {
c_map.setZoom(data.value);
c_map.setCenter(marker.getPosition());
}).on('slideStop', function(data) {
c_map.setZoom(data.value);
c_map.setCenter(marker.getPosition());
});
$zoomController.find('.btn-zoom-control').on('click', function() {
if($(this).data('inout') == 'I') {
c_map.setZoom(c_map.getZoom() + 1);
zoom_slider.slider('setValue', c_map.getZoom());
} else if($(this).data('inout' == 'O')) {
c_map.setZoom(c_map.getZoom() - 1);
zoom_slider.slider('setValue', c_map.getZoom());
}
});
naver.maps.Event.addListener(c_map, 'zoom_changed', function(zoom) {
zoom_slider.slider('setValue', c_map.getZoom());
});
}
if((useTitle == true || useContent == true) && (mapTitle || mapContent)) {
var iwContent = '';
if(useTitle == true && mapTitle) {
iwContent = '' + mapTitle + '
';
}
if(useContent == true && mapContent) {
iwContent += '' + mapContent + '
';
}
if(iwContent) {
iwContent = '';
var infoWindow = $(iwContent);
$(container).append(infoWindow);
// infoWindow.css('bottom', 'calc(-100% + ' + (infoWindow.outerHeight() + 36) + 'px)');
}
// var infowindow = new naver.maps.InfoWindow({
// content : iwContent
// });
// infowindow.open(c_map, marker);
}
$(window).on("resize", function() {
c_map.setCenter(marker.getPosition());
});
});
}
//라이브 백업 if(val.type == 'form') {
if(val.type == 'form') {
if(!is_templates && (!b.VALIDPLAN || b.VALIDTYPE == 'PK')) {
$tag.html('').addClass('hide');
// $tag.find("[form-type='file.upload'] label").on("click", function(e) {
// e.preventDefault();
// alert($.lang[LANG]['form.file.upload.disabled']);
// });
}
// if($("head").find("script[id='forms_js']").length == 0) {
// // $("head").append("");
// } else {
$.forms.init(val.seq);
// }
}
//video block ::: gallery
if(val.type == 'video') {
if($tag.find('.video-gallery-url').length>0) { //재생방식 : 확대보기
$.each($tag.find('.item'),function(i,v){
if(val.mode=='zoom') appendGalleryFrame($(this).parents('.element'),val.seq,'',val.type);
});
}
}
//premium block : 요금제 없을 시 hide
var isPremiumBlock = (($.inArray(val.type, ['contact','contents','showcase','video']) > -1 && val.type2 == 'premium') ||
($.inArray(val.type, ['sns','forum']) > -1 && val.feature == 'premium')) ? true : false;
if(isPremiumBlock && (!is_templates && (!b.VALIDPLAN || b.VALIDTYPE == 'PK'))) $tag.html('').addClass('hide');
//add script
if(val.eljs){
var js_string = val.eljs;
var $script_tag = $('');
$script_tag.html(js_string);
$('.dsgn-body').append($script_tag);
}
if($tag.find('.slick').length > 0) {
if (val.type == 'sync' && typeof syncSlickFn == 'function') syncSlickFn('.' + val.elname);
else if($tag.is('[data-clslick]') && typeof clSlickFn == 'function') clSlickFn('.' + val.elname);
}
// log
if(typeof settings['google_track'] != 'undefined') {
$('.dsgn-body').append("");
}
//add style
var jcss = CSSJSON.toJSON(val.elcss),
elpd = style.getPadding(jcss,val.elname);
var pt = parseInt(elpd.top),
pb = parseInt(elpd.bottom);
if(pt>0||pb>0){
default_t_css = default_t_css + '\n .'+val.elname + '{';
if(Math.ceil(pt*0.8)>0)
default_t_css = default_t_css + 'padding-top: '+Math.ceil(pt*0.8) + 'px!important;';
if(Math.ceil(pb*0.8)>0)
default_t_css = default_t_css + 'padding-bottom: '+Math.ceil(pb*0.8) + 'px!important;';
default_t_css = default_t_css + '}';
default_m_css = default_m_css + '\n .'+val.elname + '{';
if(Math.ceil(pt*0.5)>0)
default_m_css = default_m_css + 'padding-top: '+Math.ceil(pt*0.5) + 'px!important;';
if(Math.ceil(pb*0.5)>0)
default_m_css = default_m_css + 'padding-bottom: '+Math.ceil(pb*0.5) + 'px!important;';
default_m_css = default_m_css + '}';
}
if(idx == data.length-1){
var css = '@media only screen and (max-width:767px) {' + default_t_css + '\n}\n';
css = css + '@media only screen and (max-width:480px) {' + default_m_css + '\n}';
if($('#el-paddingcss').length == 0) $('.dsgn-body').find('#el_'+(data.length-1)+'css').after('');
else $('#el-paddingcss').append(css);
}
if(val.type == 'product') {
if(val.is_wishlist == true) {
$('.product-detail-btn .btn-myfav .btn-myfav-icon').addClass('on');
} else {
$('.product-detail-btn .btn-myfav .btn-myfav-icon').removeClass('on');
}
}
return new Promise(function(resolve) { setTimeout(resolve) });
}
var dataloop = async function(data) {
var promises = data.map(async function(val, idx) {
return await drawData(idx, val)
});
return await Promise.all(promises);
}
dataloop(data).then(function() {
$('.el-footer').css('visibility', 'visible');
$.processOFF();
$('.dsgn-body').fitVids();
$('.carousel').carousel({
pause: 'none'
});
$('[data-aos-dummy]').each(function() {
$(this).attr('data-aos', $(this).attr('data-aos-dummy')).removeAttr('data-aos-dummy');
});
setTimeout(function() {
$('.element[data-aos]').removeClass('render-aos').addClass('aos-animate');
AOS.init();
});
changeBrokenImages('.element');
$('.element').each(function(i,v){
var $tag = $(v);
var elFonts = $tag.css('font-family');
elFonts = elFonts + ",'Nanum Gothic'";
elFonts = elFonts.replace(/"/g, '\'');
$tag.css('font-family', ($tag.css('font-family') + ",'Nanum Gothic'").replace(/"/g, '\''));
});
if(b.VIEW) {
// prev next
$('.data-page-prev').addClass('active');
$('.data-page-next').addClass('active');
if(b.PARENT.prev === null) $('.data-page-prev').removeClass('active');
if(b.PARENT.next === null) $('.data-page-next').removeClass('active');
if(b.PARENT.mode == 'shopping') {
$('.data-page-prev, .data-page-next').removeClass('active');
if(b.PARENT.prev) $('.data-page-prev').addClass('active');
if(b.PARENT.next) $('.data-page-next').addClass('active');
if(typeof property.PRODINFO === 'object') $.products.display_info();
if($('#review-onoff').val() == 'true') $.products.review(b.VIEW,b.PAGE);
if($('#qna-onoff').val() == 'true') $.products.qna(b.VIEW,b.PAGE);
} else {
if($('.page-comments[data-id="'+b.VIEW+'"]').length == 0) _this.displayComment();
//상세페이지 배경 style 추가
if(b.PARENT.mode) setGalleryProjectCss(b.PARENT,b.PARENT['elcss']);
else $('body').find('.galProjectCss').remove();
displayPageToolbar().then(function(pageToolbar){
displayBottomList(b.PARENT.pid);
if($('.page-bottomlist').length) {
$('.page-bottomlist').before(pageToolbar);
}
if ($('.page-comments').length) {
$('.page-comments').before(pageToolbar);
}
displaySnsShare(b.PARENT.pid);
displayLike(b.PARENT.pid);
displayBottomNav(b.PARENT.pid);
var p_settings = (b.PARENT.settings) ? jQuery.parseJSON(b.PARENT.settings) : {};
if((typeof p_settings.sns_share_display == 'undefined' || !p_settings.sns_share_display || p_settings.sns_share_display=='OFF') &&
(typeof p_settings.bottomNav_display == 'undefined' || !p_settings.bottomNav_display || p_settings.bottomNav_display=='OFF') &&
(typeof p_settings.like_display == 'undefined' || !p_settings.like_display || p_settings.like_display=='OFF')) {
$('.tpl-page-footer').addClass('hide');
}
});
}
}
var isPage = false;
$.each(b.MENULIST, function(i,k) {
isPage = (k.toUpperCase() == b.PAGE.toUpperCase()) ? true : isPage;
});
// if(!b.ONE && !b.VIEW && !isPage) location.replace(URL);
// menu ver3 : fheader
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.position();
// shopping wrap remove
if($('.shopping-wrap').length || $('.shopping-more-wrap').length) {
$('.shopping-wrap').remove();
$('.shopping-more-wrap').remove();
}
// shopping wrap create
if(!$('.dsgn-body').hasClass('mode-config') && $('.cl-s-product-detail').length > 0 && $('div[data-el*="el_"]').length > 1) {
if(shopping_more == 'ON') {
var prod_content = $('div[data-el*="el_"]').not('.cl-s-product-detail').addClass('hide');
$('.product.cl-s-product-detail').after('');
$('.shopping-wrap').html(prod_content);
$('div[data-el*="el_"]').each(function(idx, v) {
$(this).removeClass('hide');
if($('.shopping-wrap').height() > 800) return false;
});
}
}
/*shopping more create*/
if($('.shopping-wrap').length && $('.shopping-wrap').height() >= 800 && $('.shopping-more').length == 0) {
var more_txt = (LANG == 'ko') ? '상품정보 더보기' : 'MORE';
var colorSet = shopping_more_color,
sm_font = (!colorSet) ? '' : colorSet.color,
sm_bgColor = (!colorSet) ? '' : colorSet.background_color,
sm_border = (!colorSet) ? '' : colorSet.border_color;
var review_chk = ($('.cl-s-product-review').length > 0) ? true : false,
qna_chk = ($('.cl-s-product-qna').length > 0) ? true : false;
$('.shopping-wrap').css('max-height','800px')
.css('overflow','hidden')
.after('');
$('.shopping-wrap').removeClass('open');
if(sm_font) $('.shopping-more').css('color',sm_font);
if(sm_bgColor) $('.shopping-more').css('background-color',sm_bgColor);
if(sm_border) $('.shopping-more').css('border-color',sm_border);
if(!review_chk && !qna_chk) $('.shopping-more-wrap').css('padding-bottom','100px');
}
$('.el-footer').show();
if($('.element a[data-popup][data-popup-name]').length > 0 && (!b.VALIDPLAN || b.VALIDTYPE == 'PK')) {
$('.element a[data-popup][data-popup-name]').addClass('disabled');
}
if($('.element[data-layout]').length > 0) {
setLayoutHeight();
}
if(typeof fbq == 'function' && b.VALIDTYPE == 'SM') {
if(b.VIEW) {
var checkProduct = (b.PAGE.match(/^forum,/g) === null && typeof b.PARENT != 'undefined' && typeof b.PARENT.mode != 'undefined' && b.PARENT.mode == 'shopping') ? true : false,
mn = (b.ONE) ? b.PARENT.opage : b.PARENT.ppage;
if(checkProduct && typeof callbackEvtViewContent == 'function') callbackEvtViewContent(mn,b.PARENT.seq,b.PARENT.title,$('.total-price').text().replace(/[^0-9]/g,''));
} else {
var checkProductList = ($('.element[data-type="gallery"][data-mode="shopping"]').length > 0) ? true : false;
if(checkProductList && typeof callbackEvtLead == 'function') callbackEvtLead(b.PAGE);
}
}
deferred.resolve();
});
return deferred.promise();
}
var elPush = function (prop) {
/* prop - reorder list hide */
var pageID = b.PAGE.split(','),
chgBG = false,
tmpTag = '',
currentPAGE = '',
default_t_css = '', default_m_css = '';
currentPAGE = b.PAGE;
param = (currentPAGE=='index,template' && param.indexOf('/org/') == -1) ? param + '/org/' + b.PAGE : param;
if(b.VALIDPLAN && $.inArray(b.VALIDTYPE, ['BN','SM']) > -1 && b.CERT_USE == 'Y') {
if(b.CERT_USE == 'Y') {
if(b.UMEMBER.check_login == true) isUserCertified(history);
}
}
if(pageID[0] == 'forum' && b.VIEW) {
clearDsgnbody();
var preloading = loadingScript({'forum':true});
preloading.done(function() {
var ps_fmview = $.forum.view(b.VIEW);
ps_fmview.done(function() {
_this.displayComment();
$('.el-footer').show();
$('.dsgn-body').animate({scrollTop: 0}, 0,'easeInOutQuart');
}).fail(function(error_msg) {
console.log(error_msg);
});
return false;
});
}
if(b.pageContent.hasOwnProperty(currentPAGE)) {
var loadingContents = loadPush(b.pageContent[currentPAGE]);
loadingContents.then(function() {
$('.el-footer').css('visibility', 'visible');
$.processOFF();
});
} else {
param = (b.PUBLISH) ? param : '/render/true';
$.ajax({
url: '/template/contents/sid/' + b.SID + '/page/' + encodeURIComponent(currentPAGE) + param,
dataType: 'json',
type: 'GET',
async: true,
success: function(data) {
if(typeof data.error != 'undefined' || data.error) {
if(currentPAGE!='index,template') {
alert($.lang[LANG]['page.not.found']);
location.replace('/');
}
}
if(currentPAGE!='index,template') b.pageContent[currentPAGE] = data.contents;
if(data.initContent !== undefined) property.INITPAGE = JSON.parse(data.initContent);
var preloading = loadingScript(data.blocks_type);
preloading.then(function() {
var loadingContents = loadPush(data.contents);
loadingContents.then(function() {
$('.el-footer').css('visibility', 'visible');
$.processOFF();
});
});
}
});
}
}
var scrollspy = function() {
if(!b.ONE) return false;
var top = 0,
active = '';
// top = ($('.dsgn-body').hasClass('sidebar')) ? 0 : $('.el-menu header').outerHeight();
$.each(b.MENULINK,function(i,v) {
var $el = ($.inArray(v,property.MENULIST) > -1) ? $('.link-to-'+v) : '';
if($el.length>0) {
var offset = $el.offset();
top = ($('.dsgn-body').hasClass('sidebar')) ? 0 : $('.el-menu header').outerHeight();
if((Math.floor(offset.top) - $(document).scrollTop())<= top) {
active = v;
}
}
});
if(!$('#tpl-menu li a[href="#'+active+'"]').parent().hasClass('active')) {
$('#tpl-menu li').removeClass('active').removeClass('open');
$('#tpl-menu li a[href="#'+active+'"]').parent().addClass('active');
if( $('#tpl-menu li a[href="#'+active+'"]').closest('.dropdown-menu').length>0 ) {
if($('body').width() > 768) $('#tpl-menu li a[href="#'+active+'"]').closest('.dropdown').addClass('active');
else {
//원페이지일 때 769~783 해상도에서 갤러리 위에 마우스 올리면 하위메뉴 열리는 현상 있어서 모바일에서만 open 클래스 추가 되도록 #mobile-nav 코드 추가.
$('#mobile-nav #tpl-menu li a[href="#'+active+'"]').closest('.dropdown').addClass('open');
}
}
}
if($(document).scrollTop() + $('body').height() == $('body').prop('scrollHeight')) {
var last = b.MENULINK[b.MENULINK.length-1],
$el = ($.inArray(last,property.MENULIST) > -1) ? $('.link-to-'+last) : '';
if($el.length>0) {
if($el.offset().top>top) {
$('#tpl-menu li').removeClass('active').removeClass('open');
if($(document).scrollTop()!=0)
$('#tpl-menu li a[href="#'+last+'"]').parent().addClass('active');
if($('#tpl-menu li a[href="#'+last+'"]').closest('.dropdown-menu').length>0) {
if($('body').width() > 768) $('#tpl-menu li a[href="#'+last+'"]').closest('.dropdown').addClass('active');
else $('#tpl-menu li a[href="#'+last+'"]').closest('.dropdown').addClass('open');
}
}
}
}
}
var fixedMenu = function() {
if($('header.navbar').hasClass('navbar-fheader')) { // menu ver3 : fheader
if($('body').is('[data-gjs^="fixedscroll"]')) {
return false;
}
var isSidebar = ($('header').hasClass('sidebar')) ? true : false;
if($(document).scrollTop() > $('header.navbar').height()) {
if(window.innerWidth > 768) {
$('.menu-logo-top').hide();
$('.el-menu').addClass('fixed-fheader');
}
if(b.HEADER && !isSidebar) $('header.navbar').removeClass('transparent');
} else if($(document).scrollTop() <= $('header.navbar').height()) {
$('.el-menu').removeClass('fixed-fheader');
$('.menu-logo-top').show();
if(b.HEADER && !isSidebar) {
$('header.navbar').addClass('transparent');
$('.dsgn-body').css('padding-top','0px');
}
}
return false;
}
header_fixed = $('.header.el-menu').height();
var user_menu = $('.el-menu'),
menu_color = $('header.navbar').css('background-color'),
menu_bg_img = (typeof $('header.navbar').css('background-image') != 'undefined') ? $('header.navbar').css('background-image') : 'none',
menu_bg_position = (typeof $('header.navbar').css('background-position') != 'undefined') ? $('header.navbar').css('background-position') : 'center center',
menu_bg_repeat = (typeof $('header.navbar').css('background-repeat') != 'undefined') ? $('header.navbar').css('background-repeat') : 'no-repeat',
menu_bg_size = (typeof $('header.navbar').css('background-size') != 'undefined') ? $('header.navbar').css('background-size') : 'cover';
if($(document).scrollTop() > header_fixed && user_menu.hasClass('fixed')==false && !$('.dsgn-body').hasClass('sidebar')) {
user_menu.fadeOut('fast', function() {
$(this).addClass('fixed').fadeIn('fast');
$('.fixed').addClass('fixed-position');
if(!b.HEADER || $('header.navbar').hasClass('sidebar') ) {
var topval = ($('.creatorlink-header').length==1) ? '55px' : '0';
$('.el_0').css('margin-top',topval);
var $header_empty = $('');
if($(".header-empty").length==0) {
var topval = ($('.creatorlink-header').length==1) ? '55px' : '0';
$header_empty.css({
'background-color' : $('header.navbar').css('background-color'),
'background-image' : menu_bg_img,
'background-position' : menu_bg_position,
'background-repeat' : menu_bg_repeat,
'background-size' : menu_bg_size,
//'position' : 'relative',
'width' : '100%',
'height' : header_fixed+'px',
'top' : topval,
'z-index' : '1'
});
$('.dsgn-body').prepend($header_empty);
}
$('.header-empty').css('position','relative');
} else {
$('header.navbar').removeClass('transparent');
}
if(window.innerWidth > 768) $('.menu-logo-top').hide();
});
} else if($(document).scrollTop() < header_fixed && user_menu.hasClass('fixed') && !$('.dsgn-body').hasClass('sidebar')){
user_menu.fadeOut('fast', function(){
$('.header-empty').css('position','absolute');
$('.fixed').addClass('fixed-position');
user_menu.removeClass('fixed').fadeIn('fast');
if(!b.HEADER || $('header.navbar').hasClass('sidebar') ) {
$('.el_0').css('top','0');
} else {
$('header.navbar').addClass('transparent');
if($('.creatorlink-header').length == 1) $('div.header.fixed-position').addClass('top-zero');
}
$('.menu-logo-top').show();
});
}
}
var elFooter = function() {
var error_style = '\
';
var error_html = '\
\
\
404
Page Not Found
\
'+$.lang[LANG]['config.page.not.found.error']+'
\
\
';
if(typeof b.pageContent[b.PAGE] == 'undefined' && $('.error_404.new_design').length > 0) $('.error_404.new_design').remove();
if($('.el-footer').length > 0) {
setTimeout(function() { $('.el-footer').show(); }, 300);
if($('.element:not(.el-footer)').length < 1 && !(b.MENULIST.indexOf(b.PAGE) > -1) && !b.ONE && !b.VIEW) {
if($('.error_404.new_design').length == 0) {
$('style#el-footercss').after(error_style);
$('.element.el-footer').before(error_html); //404 error
}
}
return false;
}
if(b.FTAG == '') b.FTAG = '';
$footer = $(b.FTAG);
$footer.find('.link-site-home').prop('href',URI);
$footer.addClass('element')
.addClass('el-footer')
.addClass('hide')
.attr('data-type','footer')
.attr('data-el','el-footer')
.attr('data-id','footer')
.attr('data-name','footer-' + b.SID);
$footer.appendTo($('.dsgn-body'));
$('.dsgn-body').prepend('');
/*180822 add*/
// before v1 creatorlink-box remove
if($('.el-footer').find('.creatorlink-box').length > 0 ) {
if($('.el-footer').find('.creatorlink-box').prev().hasClass('col-md-10')) $('.el-footer').find('.creatorlink-box').prev().removeClass('col-md-10').addClass('col-md-12');
$('.el-footer').find('.creatorlink-box').remove();
}
// before v2 creatorlink-footer remove
if( $('.el-footer').find('.creatorlink-footer').length > 0) {
$('.el-footer').find('.creatorlink-footer').remove();
}
// made it with Creatorlink
if(!b.VALIDPLAN || b.VALIDTYPE == 'PK') {
var is_templates = checkTemplateSite(b.SID);
if(!is_templates) {
$('.goto-top').addClass('moved');
setMadeWithCreatorlink();
}
}
setCLEscrowFooter(b.SID, b.VALIDTYPE, b.SETTINGS.sm_escrow);
var isfooterAttach = typeof $footer.attr('data-flogo') == 'undefined' ? false : $footer.attr('data-flogo'),
checkFixTypeMenu = (typeof $('header.navbar-fheader').attr('data-fixtype') != 'undefined' && $('header.navbar-fheader').attr('data-fixtype')) ? true : false;
if(isfooterAttach) {
if(b.ONE){
if(b.VIEW) $footer.find('#site-home-footer').attr('href',URI).removeClass('mini-home');
else $footer.find('#site-home-footer').attr('href','javascript:;').addClass('mini-home');
} else $footer.find('#site-home-footer').attr('href',URI).removeClass('mini-home');
}
/*var block_display = (typeof b.SETTINGS.block_display != 'undefined' && b.SETTINGS.block_display) ? b.SETTINGS.block_display : {},
footer_display = (typeof block_display.footer_display != 'undefined' && block_display.footer_display) ? block_display.footer_display : 'ON';
if(footer_display=='OFF') $('.footer-'+b.SID+'.el-footer').hide();*/
/*180822 delete - powered by Creatorlink
// before creatorlink-box remove
if($('.el-footer').find('.creatorlink-box').length > 0 ) {
if($('.el-footer').find('.creatorlink-box').prev().hasClass('col-md-10')) $('.el-footer').find('.creatorlink-box').prev().removeClass('col-md-10').addClass('col-md-12');
$('.el-footer').find('.creatorlink-box').remove();
}
if($('.el-footer').find('*[data-edit="true"]').first().closest('.row').children('div').length == 1 &&
$('.el-footer').find('*[data-edit="true"]').first().closest('.row').children('div').hasClass('col-md-10') ) {
$('.el-footer').find('*[data-edit="true"]').first().closest('.row').children('div').removeClass('col-md-10').addClass('col-md-12');
}
if(typeof b.VALIDPLAN != 'undefined' && b.VALIDPLAN && b.VALIDTYPE != 'PK') {
if( $('.el-footer').find('.creatorlink-footer').length > 0 ) $('.el-footer').find('.creatorlink-footer').remove();
} else {
var el_f_style = $('.el-footer').attr('style');
if(typeof el_f_style != 'undefined' &&
(el_f_style.indexOf('display') > -1 || el_f_style.indexOf('opacity') > -1 || el_f_style.indexOf('z-index') > -1) ) $('.el-footer').removeAttr('style');
if($('.el-footer').css('display') == 'none') $('.el-footer').css('display','block');
if($('.el-footer').css('opacity') < 1) $('.el-footer').css('opacity',1);
if($('.el-footer').css('z-index') != 'auto') $('.el-footer').css('opacity','auto');
if( $('.el-footer').find('.creatorlink-footer').length == 0) setFooterCretorlinkBox();
setFooterLink();
}
*/
if($('.element:not(.el-footer)').length < 1 && !(b.MENULIST.indexOf(b.PAGE) > -1) && !b.ONE && !b.VIEW && b.PAGE != 'psearch') {
$('style#el-footercss').after(error_style);
$('.element.el-footer').before(error_html); //404 error
}
changeBrokenImages($footer);
if(!b.FTAG || b.FOOTER) {
// $footer.hide();
} else {
if(b.VIEW && b.PARENT.mode == 'shopping' && $(document).width() < 768) {
$('.el-footer').css('margin-bottom','55px');
}
var block_display = (typeof b.SETTINGS.block_display != 'undefined' && b.SETTINGS.block_display) ? b.SETTINGS.block_display : {},
footer_display = (typeof block_display.footer_display != 'undefined' && block_display.footer_display) ? block_display.footer_display : 'ON';
if(footer_display!='OFF') {
setTimeout(function() {
$footer.removeClass('hide');
},300);
}
setTimeout(function(){
if(checkFixTypeMenu) {
if(b.VALIDPLAN) setFixedMenuCss(false);
else {
$('.el-menu header.navbar[data-fixtype]').find('#tpl-menu').css({
'width': '100%'
});
}
}
},80);
}
}
var reloadMasonry = function(container,items) {
$('.gallery-loading-status').remove();
if(container.find('[data-loop="true"]').length > 0) container.find('[data-loop="true"]').append(items).closest('.container').masonry();
else container.masonry().append(items);
container.masonry('appended',items).masonry();
}
function setDefaultValue(value) {
return (typeof value == 'undefined') ? '' : value;
}
function setDefaultValueEtc(type, el) {
type = (typeof el.attr('data-contact-etc-type') != 'undefined' && el.attr('data-contact-etc-type') ) ? el.attr('data-contact-etc-type') : type;
var input_type = ['text','email','number','tel','url'];
if($.inArray(type,input_type)) {
return (typeof el.val() == 'undefined') ? '' : el.val();
} else if(type == 'checkbox') {
return ( el.prop('checked') ) ? 'O' : 'X';
} else if(type == "radio") {
return el.find('input:radio:checked').val();
} else if(type == 'selectbox') {
var result = (el.find('option').length > 0 ) ? el.find('option:checked').val() : el.find('.active').find('.opval').text();
return result;
} else {
return 'etc article';
}
}
function setDefaultForm(el) {
var ch_lang = getLang($(el + ' [form-idx]'), b.SID);
$(el + ' [form-idx]').val('');
$(el + ' [form-idx]').find('.form-date').val('');
$(el + ' [form-idx]').find('.form-date').removeAttr('style')
$(el).find('input:checkbox').removeAttr('checked');
$(el).find('input:radio').removeAttr('checked');
$(el + ' [form-type="file.upload"]').find('label .file-uploaded-number').text('(0/10)');
$(el + ' [form-type="file.upload"]').find('input[type="file"]').val('');
$(el + ' [form-type="file.upload"]').find('input[type="text"]').val('');
$(el + ' [form-type="file.upload"]').find('.file-title').text($.lang[ch_lang]['form.file.nofile']);
if($(el).attr('data-captcha') != 'false' && $(el).find('input.input-captcha').length > 0) {
$(el).find('input.input-captcha').val('');
load_form_kcaptcha($(el), $(el).attr('data-id'));
}
}
function setDefaultContactForm(el) {
$(el + ' [data-contact-firstname]').val('');
$(el + ' [data-contact-lastname]').val('');
$(el + ' [data-contact-email]').val('');
$(el + ' [data-contact-website]').val('');
$(el + ' [data-contact-phone]').val('');
$(el + ' [data-contact-subject]').val('');
$(el + ' [data-contact-message]').val('');
$(el).find('input:checkbox').removeAttr('checked');
$(el).find('input:radio').removeAttr('checked');
$(el + ' [form-type="file.upload"]').find('input[type="file"]').val('');
$(el + ' [form-type="file.upload"]').find('input[type="text"]').val('');
$(el + ' [form-type="file.upload"]').find('.file-title').text("첨부된 파일이 없습니다.");
}
function setDefaultContactFormEtc(el) {
$(el).find('[data-contact-etc]').each(function(i) {
var type = (typeof $(this).attr('data-contact-etc-type') != 'undefined' && $(this).attr('data-contact-etc-type') ) ? $(this).attr('data-contact-etc-type') : $(this).attr('type');
var input_type = ['text','email','number','tel','url'];
if($.inArray(type,input_type)) {
$(this).val('');
} else if(type == "checkbox") {
$(this).removeAttr('checked');
} else if(type == "radio") {
$(this).find('input:radio').first().click();
} else if(type == "selectbox") {
if($(this).find('option').length > 0) {
$(this).find('option:first').attr('selected','selected');
} else {
$(this).find('.active').removeClass('active');
$(this).find('li').first().addClass('active');
}
}
});
}
var ieLineClamp = function() {
if(isIE()) {
$('[data-ie-clamp]').each(function(index, element) {
var clamp = $(this).attr('data-ie-clamp').split(','),
line = new Array();
$.each(clamp,function(k,v) {
line.push(v);
});
for(i=line.length; i<3; i++) line[i] = 0;
var idx = getScreenIndex();
var apply = line[idx];
// console.log($(element).text());
//safeClamp(element, apply);
$clamp(element, {clamp:apply, useNativeClamp:false });
});
}
}
var safeClamp = function (selector, lines) {
lines = lines || 3; // a default
$(selector).each( function() {
if($(this).text()) {
$clamp( this, { clamp: lines, useNativeClamp:false });
}
});
}
$('.data-page-back').live({
click : function() {
var pPage = b.PARENT.page,
page = b.PAGE.split(',');
inMenu = ($.inArray(pPage,b.MENULIST) == -1 && page[0] != '_product') ? false : true;
if(!inMenu) {
$(this).showModalFlat('INFORMATION','이동할 수 없습니다',true,false,'','ok');
return false;
} else {
if($.cookie('gallery') !== undefined && $.cookie('gallery') == 'all_products') {
var c_g_p = (typeof $.cookie('gallery-page-all_products') != 'undefined') ? $.cookie('gallery-page-all_products') : 1;
$.cookie('gallery', 'all_products', { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('loadmore-all_products', c_g_p, { path: '/', expires: 12 * 60 * 60 * 1000 });
var url_replace = (b.URL == '/') ? '' : b.URL;
if(b.ONE) {
_this.history.pushState(null,b.TITLE,url_replace + '/index#전체상품');
} else {
_this.history.pushState(null,b.TITLE,url_replace + '/전체상품');
}
} else {
var c_g_p = (typeof $.cookie('gallery-page-' + b.PARENT.pid) != 'undefined') ? $.cookie('gallery-page-' + b.PARENT.pid) : 1;
$.cookie('gallery',b.PARENT.pid, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('loadmore-' + b.PARENT.pid, c_g_p, { path: '/', expires: 12 * 60 * 60 * 1000 });
var url_replace = (b.URL == '/') ? '' : b.URL;
if(b.ONE) {
_this.history.pushState(null,b.TITLE,url_replace + '/index#' + b.PARENT.page);
} else {
var page = b.PAGE.split(',');
if(page[1]=='template') {
_this.history.pushState(null,b.TITLE,url_replace + '/' + page[0]);
} else {
_this.history.pushState(null,b.TITLE,url_replace + '/' + b.PARENT.page);
}
}
}
}
}
});
$('#config-mode-view').click(function() {
location.href = '//' + b.HOST + b.REFERER;
});
$('body').on('click','.mini-home, #goto-top, .quick-menu-top', function(event) {
event.preventDefault();
$('body,html').animate({scrollTop: 0}, 900,'easeInOutQuart');
});
$('body').on('click','.quick-menu-bottom', function(event) {
event.preventDefault();
$('body,html').animate({scrollTop: document.body.scrollHeight}, 900,'easeInOutQuart');
});
$('.data-page-prev').live({
click : function(e) {
var page = b.PAGE.split(',');
if(!$(this).hasClass('active') || b.PARENT.prev === null) return false;
if(typeof b.PARENT.page == 'string' && $.inArray(b.PARENT.page,b.MENULIST) == -1 && page[0] != '_product') return false;
var url_replace = (b.URL == '/') ? '' : b.URL;
if(b.PARENT.prev)
_this.history.pushState(null,b.TITLE,url_replace + '/' + page[0] + '/view/' + b.PARENT.prev);
}
});
$('.data-page-next').live({
click : function() {
var page = b.PAGE.split(',');
if(!$(this).hasClass('active') || b.PARENT.next === null) return false;
if(typeof b.PARENT.page == 'string' && $.inArray(b.PARENT.page,b.MENULIST) == -1 && page[0] != '_product') return false;
var url_replace = (b.URL == '/') ? '' : b.URL;
if(b.PARENT.next)
_this.history.pushState(null,b.TITLE,url_replace + '/' + page[0] + '/view/' + b.PARENT.next);
}
});
//menu click
$('#tpl-menu.nav > li:not(.siteUM,.siteLANG) a:not([href="javascript:;"]):not([href*="flink@"]),.cl-moption > .cl-moption-col > .cl-moption-row > a:not([href="javascript:;"]):not([href*="flink@"]),.el-menu header.navbar a#site-home').live({
click : function(e) {
e.preventDefault();
if(typeof e.target.className == 'string' && e.target.className.indexOf('fa') > -1 && $(this).closest('header').hasClass('navbar-simple')) {
return false;
}
if(typeof $(this).attr('data-toggle') != 'undefined') { return false; }
$.each($.cookie(), function(i,v) {
if(i.indexOf('gallery-category-') > -1) {
var gallery_seq = i.replace('gallery-category-','');
gcate_home = (typeof $.cookie('gallery-catehome-'+gallery_seq) == 'undefined') ? '' : $.cookie('gallery-catehome-'+gallery_seq);
$.cookie(i, gcate_home, { path : '/', expires: 12 * 60 * 60 * 1000 });
}
if(i.indexOf('gallery-page-') > -1) $.cookie(i, 1, { path : '/', expires: 12 * 60 * 60 * 1000 });
if(i.indexOf('loadmore-') > -1) $.cookie(i, 1, { path : '/', expires: 0 });
});
$.removeCookie('gallery', { path: '/' });
$.removeCookie('gallery-item', { path : '/' });
$.removeCookie('forum', { path : '/' });
$.removeCookie('forum-item', { path : '/' });
var isClickMoption = ($(this).closest('.cl-moption-col').length > 0) ? true : false,
isClickSiteHome = (typeof $(this).attr('id') != 'undefined' && $(this).attr('id') == 'site-home') ? true : false;
if($('body').width() < 769) {
var menuVer03 = ($('.el-menu > header').hasClass('navbar-fheader')) ? true : false,
menuVer02 = (!menuVer03 && $('.el-menu > header').hasClass('navbar-simple')) ? true : false,
menuVer01 = (!menuVer03 && !menuVer02) ? true : false;
var clickNavbarToggle = ( (menuVer03 && $('.navbar-toggle').css('visibility') == 'hidden') && !isClickSiteHome ||
(menuVer02 && !isClickSiteHome) ||
menuVer01
) ? true : false;
if(clickNavbarToggle) $('.navbar-toggle').click();
}
if(isClickMoption && !property.ONE) $(this).closest('header').find('.cl-menu-option').removeClass('open');
if(!isClickSiteHome) {
if($(this).hasClass('loginout')) {
if(b.URL == '/render') {
$(this).showModalFlat('INFORMATION','미리보기에서는 제공되지 않습니다.',true,false,'','ok');
return false;
}
$('#loginModal').modal('show');
$('#loginModal').css('z-index',1042);
$('.modal-backdrop.fade.in').css('z-index', 1041);
} else {
$('#tpl-menu li').removeClass('active').removeClass('open');
$(this).parent().addClass('active');
if($(this).closest('.dropdown-menu').length>0) {
if($('body').width() > 768) {
$(this).closest('.dropdown').addClass('active').siblings().removeClass('active');
} else {
if(menuVer03) {
$(this).closest('.menu-has-children').addClass('open').siblings().removeClass('open');
$('#tpl-menu .menu-has-children:not(.open) ul.dropdown-menu').hide();
} else {
$(this).closest('.dropdown').addClass('open').siblings().removeClass('open');
$('#tpl-menu .dropdown:not(.open) ul.dropdown-menu').hide();
}
}
} else {
if(menuVer03) $('#mobile-nav li.menu-has-children ul.dropdown-menu').hide();
else {
if($('body').width() < 768) $('#tpl-menu li.dropdown ul.dropdown-menu').hide();
}
}
}
}
var loc = $(this).attr('href'),
uri = (b.PUBLISH) ? loc : loc.replace('/render/',''),
blank = $(this).attr('target'),
bookmark = $(this).attr('attr-bookmark');
if(typeof bookmark !='undefined' && bookmark) return false;
if(typeof blank != 'undefined' && (blank == '_blank' || blank == 'blank')) {
window.open(loc);
e.stopPropagation();
return false;
}
if(loc.match('^(mailto:|tel:|sms:)')) {
window.location.href = loc;
return false;
}
if(b.ONE!='1') {
if(loc == 'javascript:;') return false;
if(uri == '/render' || uri == '/') {
uri = b.MENULINK[0];
$('body,html').animate({scrollTop: 0}, 900,'easeInOutQuart');
}
if(loc.match(/\@/g) === null && loc.match(/\//g) === null || loc.match(/\?clgc\=/g) !== null) {
window.location.href = loc;
return false;
}
var url = new getLocation(loc);
golink(_this,url);
// _this.history.pushState(null,b.TITLE,(b.PUBLISH) ? "/" + uri : "/render/" + uri);
} else {
if(loc == 'javascript:;') {
loc = '#';
}
var hash = '';
if(_this.b.PUBLISH) {
if(loc.indexOf('/index/view/') > -1 && b.ONE) ;
else loc = loc.replace('/index','');
} else {
if(loc.indexOf('/index/view/') > -1 && b.ONE) ;
else loc = loc.replace('/render/index','');
}
hash = loc;
var fstr = loc.charAt(0),
pathname = window.location.pathname;
switch(fstr) {
case '#':
if(_this.b.PAGE == 'index') {
if(pathname.charAt(1) == '_' && pathname.match(/^\/\_lang\//gi) === null) {
loc = (_this.b.PUBLISH) ? '/'+loc : '/render/'+loc;
window.location.href = loc;
} else {
if($(this).hasClass('mini-home')) {
$('body,html').animate({scrollTop: 0}, 900,'easeInOutQuart');
history.pushState('', '', hash);
return false;
}
var urlType = (b.PUBLISH) ? '/index' : '/render';
_this.history.pushState(null,b.TITLE,urlType + hash);
}
} else {
loc = (_this.b.PUBLISH) ? '/index' : '/render/index';
_this.history.pushState(null,b.TITLE,loc);
history.pushState('', '', loc + hash);
}
break;
case '@':
break;
case '/':
if(loc == '/render' || loc == '/') {
loc = (_this.b.PUBLISH) ? '/index' : '/render/index';
$('body,html').animate({scrollTop: 0}, 900,'easeInOutQuart');
}
var url = new getLocation(loc);
golink(_this,url);
break;
default:
// var url = new getLocation(loc);
// golink(_this,url);
window.location.href = loc;
break;
}
// window.location.href = loc;
}
}
});
// menu click (onepage)
$('.nav li a[href*=#]:not([href="javascript:;"]), .cl-moption > .cl-moption-col > .cl-moption-row > a[href*=#]:not([href="javascript:;"])').live({
click : function(e) {
if(typeof e.target.className == 'string' && e.target.className.indexOf('fa') > -1 && $(this).closest('header').hasClass('navbar-simple')) {
e.preventDefault();
return false;
}
var link = $(this).attr('href').replace('#','');
if(link.substring(0,1) == '/') link = link.substring(1,link.length);
if(b.MENULINK.indexOf(link) > -1) {
if($('.dsgn-body').width()<769) {
setTimeout(function() {
moveLinkPage(link);
},250);
} else moveLinkPage(link);
}
}
});
$('[data-type="gallery"] [data-loop="true"] > .grid').live({
touchstart: function() {
galleryStartHover();
},
touchend: function() {
galleryCloseHover();
},
click: function() {
galleryMovelink();
}
});
$('.navbar-simple .nav li a .fa').live('click', function(e) {
if($(this).closest('header').hasClass('navbar-simple')) {
$(this).closest('a').next('ul.dropdown-menu').slideToggle(200).closest('li').toggleClass('open').siblings().removeClass('open').find('ul.dropdown-menu').slideUp(200);
e.preventDefault();
return false;
}
});
$('.navbar-simple .nav li a.dropdown-toggle[href="javascript:;"]').live('click', function(e) {
e.preventDefault();
if($('body').width() < 768) $(this).find('.fa').click();
return false;
});
$('body').on('click', '.micon', function(e) { $('#goto-top').removeClass('show'); });
$('body').on('touchstart.dropdown.data-api, click','header .siteUM-dmenu-wrap, header .siteLANG-dmenu-wrap', function(e) {
if(e.target.className.indexOf('siteUM-dmenu-wrap') > -1 || e.target.className.indexOf('siteLANG-dmenu-wrap') > -1) {
if($(this).hasClass('open')) {
$(this).removeClass('open');
$('#goto-top').addClass('show');
}
}
});
$('body').on('touchstart.dropdown.data-api, click', 'header.navbar-simple .navbar-collapse.in', function(e) {
if(e.target.className.indexOf('navbar-collapse') > -1) {
$('.navbar-toggle').click();
}
});
/* [Input URL link] Click ==> link-type: link-out*/
$('a[href*=#][attr-link]').live({
click : function(e) {
console.log('link click');
if($(this).is('[attr-link=""]') || $(this).is('[data-imglink="true"]')) {
e.preventDefault();
return false;
}
if(typeof e.target.className == 'string' && e.target.className.indexOf('fa') > -1 && $(this).closest('header').hasClass('navbar-simple')) {
e.preventDefault();
return false;
}
$.removeCookie('gallery', { path: '/' });
$.removeCookie('gallery-item', { path : '/' });
$.removeCookie('forum', { path : '/' });
$.removeCookie('forum-item', { path : '/' });
if($(this).attr('target') != '_blank') {
var link = $(this).attr('href').replace('#','');
if(link.length > 0 && link != '/') {
if(b.MENULINK.indexOf(link) > -1) {
if($('.dsgn-body').width()<769) {
setTimeout(function() {
moveLinkPage(link);
},250);
} else moveLinkPage(link);
} else if($('.' + link).length) {
moveLinkPage(link,1200,true);
}
}
}
}
});
$('.fr-custom-button[data-external-link], .fr-fic[data-external-link]').live({
click: function() {
if($(this).is('[data-external-link=""]')) return false;
var link = $(this).attr('data-external-link');
if($(this).attr('target') != '_blank') {
location.href = link;
} else {
window.open(link);
}
}
});
$('.gallery-sort-nav .toggle-dropdown').live({
click: function(e) {
$(this).closest('.gallery-sort-nav').toggleClass('open');
}
});
$('.gallery-category-nav li a, .gallery-sort-nav li a').live({
click: function() {
if($(this).closest('.gallery-category-nav').hasClass('empty')) {
$(this).blur();
return false;
}
if($(this).closest('li').hasClass('active')) return;
var isProductSort = $(this).closest('.gallery-sort-nav').length;
var d = new Date(),
now = d.getTime(),
idx = $(this).attr('data-idx'),
orderby = 'recent',
sfl = 'category',
stx = (idx != '0') ? $(this).text().trim() : '',
pid = $(this).closest('.element[data-type="gallery"]').attr('data-id');
if (isProductSort > 0) {
var active_category = $('.element[data-id="'+pid+'"] .gallery-category-nav li.active a');
stx = (active_category.length > 0 && active_category.attr('data-idx') != '0')? active_category.text() : '';
orderby = $(this).attr('data-orderby');
$('.element[data-id="'+pid+'"] .gallery-sort-nav li').removeClass('active');
$('.element[data-id="'+pid+'"] .gallery-sort-nav li').eq(idx).addClass('active');
$('.element[data-id="'+pid+'"] .gallery-sort-nav .active-sort').text($(this).text().trim());
$(this).closest('.gallery-sort-nav').removeClass('open');
} else {
orderby = $('.gallery-sort-nav li.active a').attr('data-orderby');
$('.element[data-id="'+pid+'"] .gallery-category-nav li').removeClass('active');
$('.element[data-id="'+pid+'"] .gallery-category-nav li').eq(idx).addClass('active');
}
if(pid == 'all_products') {
sfl = 'orderby';
stx = (idx != '0') ? idx : '';
$('.allProducts-sort-wrap ul li a[data-idx="'+idx+'"]').closest('li').addClass('active');
$('.allProducts-sort-mobile .dropdown-toggle span').text($('.allProducts-sort-mobile ul li a[data-idx="'+idx+'"]').text());
}
$('#el-empty').empty();
$('#el-empty').after('');
var val = _this.galleryEL[pid],
tag = htmlspecialchars_decode(val.eltag,'ENT_QUOTES'),
elsettings = (typeof val.elsettings != 'undefined' && val.elsettings) ? $.parseJSON(val.elsettings) : {},
block_lang = ($(tag).attr('data-blocklang')) ? $(tag).attr('data-blocklang') : LANG,
checkGalleryListSample = false,
checkGalleryListEmpty = true;
$('#el-empty').append($(tag));
$('#el-empty').find('[data-loop="true"]').html('');
var nodes = $(tag).find('[data-loop="true"]').children('.grid'),
p = $('#el-empty').children(),
i = [],
view = $(tag).find('[data-loop="true"]').data('view'),
g_number = $(tag).find("[data-loop='true']").data('gallery-no'),
total = 0,
display = 0;
var checkLoadmoreInLoop = ($(tag).find('[data-loop="true"] .loadmore-wrap').length) ? true : false,
glm = $(tag).find('.loadmore-wrap');
if(typeof view == 'undefined') view = 10;
var cookie_page = 1,
cookie_view = view,
// cookie_gallery_category = (typeof escape(stx) != 'undefined') ? escape(stx) : '',
cookie_gallery_category = (typeof stx != 'undefined') ? stx : '',
is_gc_cookie = (typeof $.cookie('gallery-category-'+val.seq) != 'undefined' && $.cookie('gallery-category-'+val.seq).length > 0) ? true : false;
var cookie_gallery_orderby = (typeof orderby != 'undefined')? orderby : 'recent';
// $.cookie('gallery',val.seq, { path: '/', expires: 12 * 60 * 60 * 1000 });
// $.cookie('loadmore-' + val.seq, cookie_page, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-page-' + val.seq, cookie_page, { path : '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-category-' + val.seq, cookie_gallery_category, { path : '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-orderby-' + val.seq, cookie_gallery_orderby, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.removeCookie('loadmore-' + val.seq, { path : '/' });
$.removeCookie('gallery', { path : '/' });
$('.galleryPL'+val.seq).find('[data-loop="true"]').empty();
var el_gh = $(tag).find('.goption').attr('data-gh'),
checkGalleryHeight = (typeof el_gh != 'undefined' && el_gh) ? true : false,
checkGallerySVG = ($(tag).find('.gimg-svg-wrap').length > 0) ? true : false,
checkGFrameTitleOFF = (val.mode == 'gallery' && (typeof elsettings.gframe_title_visible != 'undefined' && elsettings.gframe_title_visible == 'OFF')) ? true : false;
var checkUseComment = checkUseCommentFunc(val.mode, val.eltag);
var checkUseLike = checkUseLikeFunc(val.mode, val.eltag);
$.ajax({
url: '/template/gallery/list/pid/' + val.seq + '/sid/' + b.SID + '/spage/' + b.PAGE + '/view/' + cookie_view + '/publish/' + b.PUBLISH + param,
data: { g_mode: val.mode, visible: true, sfl: sfl, stx: stx, orderby: cookie_gallery_orderby },
dataType: 'json',
type: 'POST',
async: false,
cache: false,
success: function (data) {
$.each(data.list, function (idx, value) {
i.push(value);
});
total = (typeof data.total.list_total != 'undefined') ? data.total.list_total : data.total;
display = data.list.length;
if( total > 0 ) checkGalleryListEmpty = false;
if( i.length>0 || (i.length==0 && is_gc_cookie) ) {
var loop_count = nodes.length, item_index = 0;
var elem = [];
$.each(data.list,function(index,v) {
loop_pos = index%loop_count;
c = nodes[loop_pos];
var isTitle = (v.title.length > 0) ? true:false;
v.title = (v.title.length>0) ? v.title : $.lang[block_lang]['editor.block.gallery.sample.title'];
v.caption = (v.caption.length>0) ? v.caption : $.lang[block_lang]['editor.block.gallery.sample.caption'];
$(c).addClass('gallery-item').attr('data-index',index).attr('data-seq',v.seq);
var vgsettings = (typeof v.gsettings != 'undefined' && v.gsettings) ? $.parseJSON(v.gsettings) : {},
img_path = (typeof vgsettings['storage'] != 'undefined') ? vgsettings['storage'] : _this.b.RESOURCE + '/' + _this.b.SID + '/',
img_original = (typeof vgsettings['storage'] != 'undefined') ? img_path + '1920/' : img_path;
var folder = (val.folder == 0) ? '' : val.folder + '/',
src = getServeImage(v.image,val.folder,img_path),
src_s0 = getServeImage(v.image,'0',img_path);
if($(c).find('img').length > 0) $(c).find('img').attr('src',src);
if($(c).find('.g-img').length > 0) $(c).find('.g-img').css('background-image', 'url('+src+')');
if(checkGallerySVG) {
var gimgSVG = $(c).find('.gimg-svg-wrap svg');
gimgSVG.find('pattern').attr('id','gimgSvg_'+val.elname+'_'+index);
gimgSVG.find('image').attr('xlink:href', src);
gimgSVG.find('polygon').attr('fill', 'url(#gimgSvg_'+val.elname+'_'+index+')');
}
var glink = (typeof vgsettings['glink'] != 'undefined' && vgsettings['glink']) ? vgsettings['glink'] : '',
glink_target = (typeof vgsettings['glink_target'] != 'undefined' && vgsettings['glink_target']) ? vgsettings['glink_target'] : '';
if(glink) {
if(glink.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark]
var bookmark_seq = glink.replace(/^\@/g,'');
if(typeof _this.b.SETTINGS.blockBookmarkList == 'undefined' || typeof _this.b.SETTINGS.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') {
glink = '';
glink_target = '';
}
} else if(glink.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink]
glink_target = '';
} else if($.inArray(glink.replace(/^\//g,'').replace(/ /g,'-'),_this.b.MENULIST) > -1) { // link-type: link-menu ==> a[data-user-link]
} else { // link-type: link-out ==> a[attr-link]
if(checkBase64Encode(glink)) glink = Base64.decode(glink);
}
}
$(c).find('a').removeAttr('data-gallery').removeAttr('data-user-link').removeAttr('attr-bookmark').removeAttr('attr-link').removeAttr('attr-flink');
if (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON' && property['SITEUM'] >= 1) {
$(c).addClass('gallery-item').addClass('nonePrice');
$(c).find('a').attr('href', '#');
} else {
if(glink) {
var glink_val = makeLinkUrl(glink, b.ONE, b.VIEW);
$(c).find('a').attr('href',glink_val);
if(glink.match(/^\@/g)) {
$(c).find('a').attr('attr-bookmark',glink.replace(/^\@/g,''));
} else if(glink.match(/^flink\@[0-9]/g) !== null) {
$(c).find('a').attr('attr-flink',glink.replace(/^flink\@/g,''));
// IE ERROR_includes__H.20210603
// } else if(_this.b.MENULIST.includes(glink.replace(/ /g,'-'))) {
} else if($.inArray(glink.replace(/ /g,'-'),_this.b.MENULIST) > -1) {
$(c).find('a').attr('data-user-link',glink_val);
} else {
$(c).find('a').attr('attr-link',glink);
}
} else {
if (val.mode == 'gallery') {
src_s0 = src_s0 + '?gpos='+v.pos;
$(c).find('a').attr('href', src_s0);
$(c).find('a').attr('data-gallery', '#gframe-' + val.seq);
} else {
if(val.seq == 'all_products') {
$(c).find('a').attr('href', v.product_url);
} else {
if(_this.b.LUX) $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/_product/' + v.seq);
else $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/' + _this.b.PAGE + '/view/' + v.seq);
// $(c).find('a').attr('href', ((URI=='/') ? '' : URI) + '/' + b.PAGE + '/view/' + v.seq);
}
}
}
}
if(glink_target == '_blank') $(c).find('a').attr('target','_blank');
else $(c).find('a').removeAttr('target');
if(checkGFrameTitleOFF || !isTitle) $(c).find('a').attr('data-title', '');
else $(c).find('a').attr('data-title', v.title);
if(val.mode == 'shopping') {
if($(c).find('.figure.basket').length == 0) {
$(c).find('.figure').last().after('장바구니 담기
');
}
}
// caption
var ftitle = $(c).find('h5.figure'),
fcaption = $(c).find('p.figure').not('.comment'),
fdatetime = $(c).find('.figure.datetime'),
fhashtag = $(c).find('.figure.hashtag'),
fbrand = $(c).find('.figure.brand'),
fprice = $(c).find('.figure.price'),
freview = $(c).find('.figure.review'),
fcomment = $(c).find('.figure.comment'),
flike = $(c).find('.figure.like'),
fbasket = $(c).find('.figure.basket');
if(fcomment.length < 1 && checkUseComment && elsettings.comment_display == 'ON') {
$(c).find('figcaption p.figure.caption').after('');
fcomment = $(c).find('.figure.comment');
}
if(flike.length < 1 && elsettings.like_display == 'ON' && checkUseLike){
if (fcomment.length > 0) {
fcomment.each(function(idx, v){
if(idx == 0) $(v).after('');
else $(v).after('');
});
} else {
$(c).find('figcaption:not(.top) .figure:last-child').each(function(idx, v){
if(idx == 0) $(v).append('');
else $(v).append('');
});
}
flike = $(c).find('.figure.like');
}
$(c).find('figcaption').removeClass('hide');
if (v.title || v.caption) {
var gallery_caption = v.caption;
gallery_caption = gallery_caption.replace(/\n/g,'
');
ftitle.html(v.title);
fcaption.html(gallery_caption);
if(fdatetime.length > 0) fdatetime.text(v.datetime);
if(fhashtag.length > 0) fhashtag.text(v.hashtag);
}
if(g_number) {
var g_index = String(index + 1),
g_num = g_index.padStart(g_number, '0');
$(c).find('.figure.number').text(g_num);
}
if(fbrand.length > 0) {
var fbrand_name = (typeof v.brand_name != 'undefined' && v.brand_name) ? v.brand_name : '';
fbrand.html(v.brand_name);
}
if(val.mode == 'shopping' || val.seq == 'all_products') {
fcomment.addClass('hide');
flike.addClass('hide');
v.price = typeof v.price != 'undefined' ? parseFloat(v.price) : 0;
v.sale = typeof v.sale != 'undefined' ? parseFloat(v.sale) : 0;
var checkPriceHidden = (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON') ? true : false,
gallery_price = (v.price && !checkPriceHidden) ? v.price : 0,
gallery_sale_price = (typeof v.sale != 'undefined' && v.sale > 0 && v.sale > v.price && !checkPriceHidden) ? v.sale : 0,
gallery_sale_per = (typeof v.sale_per != 'undefined' && v.sale_per && !checkPriceHidden) ? v.sale_per : '',
product_soldout = '품절',
product_no_sale = (typeof elsettings.sh_soldout == 'string') ? elsettings.sh_soldout : '구매불가',
product_status = '';
if(v.status == 'off' && !checkPriceHidden) {
product_status = '' + product_no_sale + '';
} else if(v.quantity_on == 'on' && v.quantity < 1 && !checkPriceHidden) {
product_status = '' + product_soldout + '';
}
$(c).find('.cl-sh-soldout').remove();
if(product_status != '') $(c).attr('data-soldout',true);
else $(c).removeAttr('data-soldout');
$(c).find('.product-badge').remove();
product_status += drawBadgeList(v.use_badge, data.badge_settings);
$(c).find('.cl-sh-limit').remove();
if(v.status == 'lim') {
if(v.sale_now == false) {
var product_limit = '상품 구매 가능 기간이 아닙니다.
';
if(freview.length > 0) {
freview.after(product_limit);
} else {
$(c).find('figcaption:not(.top) .figure:last-child').after(product_limit);
}
}
}
if($(c).find('ul.figure.price').length > 0) {
// var price_off = (v.sale_price > 0 && v.sale_price > v.price) ? 100 - Math.floor((v.price / v.sale_price) * 100) : 0,
// off_str = (price_off > 0) ? price_off + '% ' : ''
var off_str = (v.sale_rate > 0) ? v.sale_rate + '% ' : '';
if(!_this.b.LUX) off_str = gallery_sale_per;
//Ver2
if(!checkPriceHidden) {
$(c).find('ul.figure.price .price-val').html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-val').removeClass('hide');
if(gallery_sale_price > 0 && gallery_price < gallery_sale_price) {
$(c).find('ul.figure.price .price-sale').html('₩' + gallery_sale_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-sale-per').html(off_str);
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').removeClass('hide');
if(_this.b.LUX && (v.hashtag).indexOf('특가세일') > -1 && $(c).find('ul.figure.price .sp-price').length == 0) {
$(c).find('ul.figure.price .price-sale').after('특가세일');
}
} else {
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').addClass('hide').html('');
}
} else {
$(c).find('ul.figure.price .price-val').html('₩0');
$(c).find('ul.figure.price .price-val').removeClass('hide');
}
if(val.seq == 'all_products' && checkPriceHidden) $(c).find('ul.figure.price').html('');
if(product_status) $(c).find('ul.figure.price').append(''+product_status+'');
var badge_size = getBadgeSize(data.badge_settings);
$(c).find('.cl-sh-soldout').removeClass('badge-small badge-medium badge-large');
$(c).find('.cl-sh-limit').removeClass('badge-small badge-medium badge-large');
if(badge_size) {
$(c).find('.cl-sh-soldout').addClass(badge_size);
$(c).find('.cl-sh-limit').addClass(badge_size);
}
} else {
//Ver1
if(fprice.length == 0) fprice = fcaption;
if(checkPriceHidden) fprice.html('');
else fprice.html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,',') + product_status);
}
if($(c).find('ul.figure.review').length > 0) {
var gallery_review = (v.review_onoff && v.review_cnt) ? v.review_cnt : 0;
if(gallery_review > 0) {
$(c).find('ul.figure.review, ul.figure.review li').removeClass('hide');
$(c).find('ul.figure.review .figure-review-cnt').html(gallery_review);
$(c).find('ul.figure.review .figure-review-score').html(v.review_score);
} else {
$(c).find('ul.figure.review, ul.figure.review li').addClass('hide');
$(c).find('ul.figure.review .figure-review-cnt, ul.figure.review .figure-review-score').html('');
}
}
if(fbasket.length > 0) {
var checkOldBlock = ($(c).find('.figure.basket[data-oldver="true"]').length > 0) ? true : false,
checkOldverBasket = (typeof elsettings.field_oldver != 'undefined' && elsettings.field_oldver && elsettings.field_oldver.indexOf('basket') > -1) ? true : false,
checkDisabledBasket = (typeof elsettings.field_disable != 'undefined' && elsettings.field_disable && elsettings.field_disable.indexOf('basket') > -1) ? true : false;
if(v.basket_off) fbasket.addClass('cannotby hide');
else if(val.seq == 'all_products') fbasket.removeClass('hide');
else if(checkDisabledBasket || (!checkDisabledBasket && checkOldBlock && !checkOldverBasket)) fbasket.addClass('hide');
else if(property.VALIDTYPE != 'SM') fbasket.addClass('hide');
else fbasket.removeClass('hide');
}
} else {
fbrand.addClass('hide');
fprice.addClass('hide');
freview.addClass('hide');
fbasket.addClass('hide');
if(val.mode == 'project' && fcomment.length > 0 && typeof v.comment_cnt != 'undefined' && v.comment_cnt > 0 && elsettings.comment_display == 'ON') {
fcomment.find('.figure-comment-cnt').html(v.comment_cnt);
if(elsettings.field_disable !== undefined && elsettings.field_disable.indexOf('comment') > -1) {
fcomment.addClass('hide');
} else {
fcomment.removeClass('hide');
}
} else {
fcomment.addClass('hide');
}
if(flike.length > 0 && elsettings.like_display == 'ON' && checkUseLike) {
flike.removeAttr('data-like').removeClass('hide active');
if(v.like !== undefined) {
flike.find('.figure-like-cnt').html(v.like.cnt);
if(v.like.own) flike.attr('data-like', v.seq).addClass('active');
}
if(elsettings.field_disable !== undefined && elsettings.field_disable.indexOf('like') > -1) {
flike.addClass('hide');
} else {
flike.removeClass('hide');
}
} else {
flike.addClass('hide');
}
}
if(checkUseLike == false) flike.html('');
var on_figure_total = $(c).find('figcaption .figure:not(.hide, .review[data-review_cnt="false"][data-review_score="false"])').length;
if(on_figure_total > 0) $(c).find('figcaption').addClass('allhide');
else $(c).find('figcaption').removeClass('allhide');
if(val.mode == 'gallery') {
if(index < cookie_view) {
$(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
} else {
$(c).find('figure').remove();
$('.galleryPL'+val.seq).find('[data-loop="true"]').append($(c)[0].outerHTML);
}
if (total == 2) {
$(c).find('figure').remove();
$('.gallery-empty').append($(c)[0].outerHTML);
}
} else {
$(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
}
});
} else {
if(idx == '0') {
checkGalleryListSample = true;
nodes.find('a')
.addClass('emptyGalleryItem')
.attr('href', '/config/page/' + b.PAGE + '/view/template')
.removeAttr('data-gallery')
.removeAttr('data-user-link')
.removeAttr('attr-bookmark')
.removeAttr('attr-flink')
.removeAttr('attr-link')
.find('img')
.attr('data-index',0);
$(p).find('[data-loop="true"]').append(nodes);
}
$.cookie('gallery-category-'+val.seq,'',{ path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-orderby-' + val.seq, '', { path: '/', expires: 12 * 60 * 60 * 1000 });
}
if(checkLoadmoreInLoop) $(p).find('[data-loop="true"]').append(glm);
tag = $(p)[0].outerHTML;
if (val.mode == 'gallery' && total == 2) {
$.each($('.gallery-empty').find('.gallery-item'), function(i,v) {
var gallerySeq = $(v).attr('data-seq');
if($('.galleryPL'+val.seq).find('.gallery-item[data-seq='+gallerySeq+']').length == 0) $('.galleryPL'+val.seq).find('[data-loop="true"]').append($(v).attr('data-index', i+2));
});
}
if (val.mode == 'gallery' && total) tag = appendGalleryFrame($(tag), val.seq, val.elsettings, '', val.elcss);
$('#el-empty').empty();
$('.gallery-empty').remove();
}
});
var $tag = $(tag),
$galleryEL = $('.element[data-id="' + val.seq + '"]'),
g_settings = (typeof val.elsettings != 'undefined' && val.elsettings) ? $.parseJSON(val.elsettings) : {};
changeBrokenImages($tag);
$.each($tag.find('[data-edit="true"]'), function() {
var source = $(this).html();
source = source.replace(/< /g,'<').replace(/ >/g,'>');
$(this).html(source);
});
if(val.feature=='masonry') {
var $container = $galleryEL.find('.container'),
$gallery_items = $tag.find('[data-loop="true"]');
$container.html('');
$galleryEL.find('[data-loop="true"]').before('');
var process_index = 0,
last_view = (view > total) ? total : view;
$gallery_items.imagesLoaded().progress(function(imgload, image) {
process_index++;
if(total>0 && last_view==process_index) {
setTimeout(function() {
reloadMasonry($container,$gallery_items);
refreshGalleryField($galleryEL,g_settings);
}, 30);
}
});
if(checkGalleryListSample && total == 0) {
// category change sample masonry
$gallery_items.find('.emptyGalleryItem').attr('data-gallery','');
setTimeout(function() {
reloadMasonry($container,$gallery_items);
refreshGalleryField($galleryEL,g_settings);
}, 30);
}
} else {
$galleryEL.find('[data-loop="true"]').replaceWith($tag.find('[data-loop="true"]'));
refreshGalleryHeight();
refreshGalleryField($galleryEL,g_settings);
}
if(!checkGalleryListSample) {
$galleryEL.find('.empty-txt').remove();
$galleryEL.find('.container:not(.fh-container),[data-loop="true"]').removeClass('empty');
if(checkGalleryListEmpty) {
var empty_info = (val.seq == 'all_products') ? $.lang[LANG]['editor.gallery.product.empty.list'] : $.lang[LANG]['editor.gallery.category.empty.list'],
empty_info = (_this.b.LUX) ? $.lang[LANG]['editor.gallery.product.empty.list'] : empty_info,
gallery_empty_str = '' + empty_info + '
';
if(val.feature=='masonry') {
$galleryEL.find('.container:not(.fh-container)').removeAttr('style').addClass('empty').append(gallery_empty_str);
} else {
$galleryEL.find('[data-loop="true"]').addClass('empty').empty().append(gallery_empty_str);
}
}
}
var $glmBtnWrap = $galleryEL.find('.loadmore-wrap'),
$glmBtn = $galleryEL.find('.loadmore-wrap .gallery-loadmore'),
checkLoadmore = (total > view && total > cookie_view && !checkGalleryListEmpty) ? true : false,
glm_lang = LANG;
if(typeof g_settings.loadmore_lang != 'undefined' && g_settings.loadmore_lang && $.inArray(g_settings.loadmore_lang.toLowerCase(), ['ko','en']) > -1) glm_lang = g_settings.loadmore_lang.toLowerCase();
else if(typeof block_lang != 'undefined' && $.inArray(block_lang, ['ko','en']) > -1) glm_lang = block_lang;
var glm_txt = $.lang[glm_lang]['config.loadmore'];
if($glmBtnWrap.length == 0) {
// gallery loadmore btn - default (ver1)
if(checkLoadmore) {
var glm_class = (val.feature=='masonry') ? 'gallery-loadmore masonry-layout' : 'gallery-loadmore',
glm_btn = '' + glm_txt +' (' + cookie_view + ' / ' + number_format(total) + ')
';
if($galleryEL.find('.gallery-loadmore').length > 0) $galleryEL.find('.gallery-loadmore').replaceWith(glm_btn);
else $galleryEL.append(glm_btn);
} else $galleryEL.find('.gallery-loadmore').remove();
} else {
// gallery loadmore btn - custom (ver2)
if(checkLoadmore) {
if(val.feature=='masonry') $glmBtn.addClass('masonry-layout');
else $glmBtn.removeClass('masonry-layout');
$glmBtn.attr('data-loadmore','true').attr('data-id',val.seq).attr('data-total',total).attr('data-page',2).attr('data-view',view).attr('data-folder',val.folder).attr('data-mode',val.mode);
$glmBtn.find('.label').text(glm_txt);
$glmBtn.find('.display .view').text(cookie_view);
$glmBtn.find('.display .total').text(total);
$glmBtnWrap.removeClass('hide').fadeIn();
} else {
$glmBtnWrap.fadeOut().addClass('hide');
$glmBtn.removeAttr('data-loadmore').removeAttr('data-id').removeAttr('data-total').removeAttr('data-page').removeAttr('data-view').removeAttr('data-folder').removeAttr('data-mode').removeClass('masonry-layout');
$glmBtn.find('.label').text(glm_txt);
$glmBtn.find('.display .view').text('0');
$glmBtn.find('.display .total').text('0');
}
}
if($galleryEL.is('[data-type2="premium"]')) setGalleryJS('change-loop',$galleryEL);
if($galleryEL.find('*[data-direffect="true"]').length > 0 ) {
setTimeout(function() {
$galleryEL.find('.grid').each(function() {
$(this).hoverdir();
});
}, 400);
}
}
});
$(':not(.review-sample-block) .review-sort-nav .toggle-dropdown').live({
click: function(e) {
$(this).closest('.review-sort-nav').toggleClass('open');
}
});
$(':not(.review-sample-block) .review-sort-nav li a').live({
click: function() {
if ($(this).closest('li').hasClass('active')) return;
var review_block_id = $(this).closest('.element').attr('data-id');
var idx = $(this).attr('data-idx'),
orderby = $(this).attr('data-orderby');
console.log('review_block_id', review_block_id);
$('.element[data-id="'+review_block_id+'"] .review-sort-nav li').removeClass('active');
$('.element[data-id="'+review_block_id+'"] .review-sort-nav li').eq(idx).addClass('active');
$('.element[data-id="'+review_block_id+'"] .review-sort-nav .active-sort').text($(this).text().trim());
$(this).closest('.review-sort-nav').removeClass('open');
var val = _this.galleryEL[review_block_id];
var settings = (typeof val.elsettings != 'undefined' && val.elsettings) ? $.parseJSON(val.elsettings) : {};
var gallery_data = (typeof settings.gallery_data != 'undefined' && settings.gallery_data) ? settings.gallery_data : {};
var cookie_review_orderby = (typeof orderby != 'undefined')? orderby : 'recent';
$.cookie('review-orderby-' + review_block_id, cookie_review_orderby, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.reviewContents.update(review_block_id, gallery_data, orderby);
}
});
$(':not(.review-sample-block) .review-data-loadmore').live({
click: function() {
var review_block_id = $(this).attr('data-id'),
page_num = (typeof $(this).attr('data-page') != 'undefined') ? Number($(this).attr('data-page')) : 1,
view = (typeof $(this).attr('data-view') != 'undefined') ? Number($(this).attr('data-view')) : 6,
$review_elLoadmore = $(this),
$review_el = $('.element[data-id="' + review_block_id + '"]'),
$rContainer = $review_el.find('.container'),
$rLoop = $review_el.find('[data-loop="true"]'),
$ro = $review_el.find('.review-sort-nav li.active a'),
orderby = ($ro.length > 0) ? $ro.attr('data-orderby') : 'recent';
var val = _this.galleryEL[review_block_id];
var settings = (typeof val.elsettings != 'undefined' && val.elsettings) ? $.parseJSON(val.elsettings) : {};
var gallery_data = (typeof settings.gallery_data != 'undefined' && settings.gallery_data) ? settings.gallery_data : {};
// var cookie_review_orderby = (typeof orderby != 'undefined')? orderby : 'recent';
$.cookie('review-orderby-' + review_block_id, orderby, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.reviewContents.update(review_block_id, gallery_data, orderby, page_num);
}
});
// menu ver3 : fheader - #mobile-nav show/hide function
$(document).on('click', 'ul li.siteSEARCH > a.psearch-btn, \
ul li.siteSEARCH .psearch-overlay.open, \
ul li.siteSEARCH .psearch-input', function(e) {
e.preventDefault();
var taret_nav = (window.innerWidth <= 768) ? $('#mobile-nav') : $('header.navbar-fheader'),
check_psearch_area = (taret_nav.find('.psearch-wrap').is(e.target) || taret_nav.find('.psearch-wrap').has(e.target).length > 0) ? true : false;
if(!check_psearch_area) {
taret_nav.find('.psearch-overlay').toggleClass('open');
setTimeout(function() {
$.psearch.showSiteProjectSEARCH(false);
taret_nav.find('.psearch-overlay').find('input.psearch-input').focus();
},300);
}
return false;
});
$(document).on('click', '#fixed-menu li.siteCART > a[href="javascript:;"], #fixed-menu-sub li.siteCART > a[href="javascript:;"]', function(e) {
e.preventDefault();
$(this).showModalFlat('INFORMATION',$.lang[LANG]['fheader.cart.no-support.render-mode'],true,false,'','ok');
return false;
});
$(document).on('click', '#mobile-nav .login-content:not(.siteUM)', function(e) {
e.preventDefault();
$('#mobile-nav #fixed-menu .siteUM a i').click();
return false;
});
$(document).on('click', '#mobile-nav .nav li.menu-has-children > a[href="javascript:;"]', function(e) {
e.preventDefault();
$(this).prev('.fa').click();
return false;
});
$('#mobile-nav ul li.menu-has-children i').off('click').on('click', function(e) {
if($(this).closest('li.menu-has-children').hasClass('open')) {
$(this).closest('li.menu-has-children').removeClass('open');
$(this).nextAll('ul').eq(0).slideToggle(200);
// $(this).next().removeClass('menu-item-active');
$(this).toggleClass('fa-chevron-down fa-chevron-up');
} else {
$(this).closest('li.menu-has-children').addClass('open').siblings('li.open').find('i').click();
$(this).nextAll('ul').eq(0).slideToggle(200);
// $(this).next().toggleClass('menu-item-active');
$(this).toggleClass('fa-chevron-down fa-chevron-up');
}
});
$(document).on('click', 'header.navbar-fheader .navbar-toggle', function(e) {
if( window.innerWidth > 768 &&
$(this).closest('header').find('.cl-menu-option').length > 0 &&
$(this).closest('header').find('.cl-menu-option').is('[data-moption="ntoggle"],.nfullDrop')
) {
e.preventDefault();
return false;
}
if($('.dsgn-body').hasClass('mobile-nav-active')) {
//close mobile menu
$('header.navbar-fheader .navbar-toggle').css({'visibility':'visible'});
$('.dsgn-body').removeClass('mobile-nav-active');
$('#mobile-body-overly').removeClass('in');
$('#mobile-nav .siteLANG.cl-fixbtn').hide();
} else {
//show mobile menu
$('header.navbar-fheader .navbar-toggle').css({'visibility':'hidden'});
$('.dsgn-body').addClass('mobile-nav-active');
$('#mobile-body-overly').addClass('in');
$('#mobile-nav .siteLANG.cl-fixbtn').show();
}
});
$(document).on('click', '.dsgn-body.mobile-nav-active', function(e) {
if( $('#mobile-nav').is(e.target) ||
$('#mobile-body-overly').is(e.target) ||
( $(e.target).is('img') && $(e.target).parent('#mobile-nav-toggle') )
) {
$('header.navbar-fheader .navbar-toggle').click();
}
});
$('header.navbar-simple .navbar-toggle').live('click',function(e) {
var check = $(this).hasClass('collapsed') ? false : true;
if(check) {
var p_t = $('.el-menu header').height() + 'px';
$('.element').each(function(){ $(this).addClass('blur-filter'); });
$('.el-menu').addClass('blur-filter');
if($('body').height() > ($('.el-menu').find('#tpl-menu').height() + 80)) $('.el-menu').find('#tpl-menu').addClass('center-position');
else $('.el-menu').find('#tpl-menu').removeClass('center-position');
$('.dsgn-body').bind('touchmove');
$('#goto-top').removeClass('show');
} else {
$('.element').each(function(){ $(this).removeClass('blur-filter'); });
$('.el-menu').removeClass('blur-filter');
$('.dsgn-body').unbind('touchmove');
$('#goto-top').addClass('show');
}
});
$('.element[data-type="gallery"]').live({
mouseenter : function() {
$(this).find('[data-direffect="true"] .grid').each(function() {
$(this).hoverdir();
});
}
});
$('.creatorlink-header .data-user > ul > li').live({
click : function() {
$(this).closest('.pull-right').toggleClass('open');
if($(this).closest('.pull-right').hasClass('open')) {
$('.popover').show();
} else {
$('.popover').hide();
}
}
});
/* [Menu link] Click ==> link-type: link-menu or link-inner*/
$('*[data-user-link]').live('click',function(e) {
if($(this).is('[data-user-link=""]')) return false;
if(typeof e.target.className == 'string' && e.target.className.indexOf('fa') > -1 && $(this).closest('header').hasClass('navbar-simple')) {
return false;
}
$.removeCookie('gallery', { path: '/' });
$.removeCookie('gallery-item', { path : '/' });
$.removeCookie('forum', { path : '/' });
$.removeCookie('forum-item', { path : '/' });
if(!selectEL || typeof selectEL == 'undefined') {
selectEL = $(this).closest('.element').attr('data-el');
}
//latest block - table header click, set click table
if(typeof $(this).attr('data-lt-header') != 'undefined') {
var type = $(this).closest('.latest-table').attr('data-type'),
pid = $(this).closest('.latest-table').attr('data-pid'),
clickEL = (type == 'gallery') ? $('.gallery-item[data-seq="'+pid+'"]') : $('.element[data-id="' + pid + '"]'),
checkThisPage = (b.ONE && clickEL.length > 0) ? true : false;
if(checkThisPage) {
if(type == 'forum') {
scrollToBlock('.element[data-id="' + pid + '"]', 1000);
return false;
} else if(type == 'gallery') {
moveGallery(pid);
return false;
}
} else $.cookie(type+'-item',pid, { path: '/' });
} else {
if(typeof $(this).attr('data-forum-type') !== 'undefined' && $(this).attr('data-forum-type') == 'qna') {
var type = $(this).closest('.latest-table').attr('data-type'),
pid = $(this).closest('.latest-table').attr('data-pid'),
clickEL = $('.element[data-id="' + pid + '"]'),
checkThisPage = (b.ONE && clickEL.length > 0) ? true : false,
page_num = $(this).attr('data-page'),
row_id = $(this).closest('.latest-post-list-title').attr('data-id');
if(checkThisPage) {
scrollToBlock('.element[data-id="' + pid + '"] .tpl-forum-list-title[data-id="'+row_id+'"]', 1000);
$('.element[data-id="' + pid + '"] .tpl-forum-list-title[data-id="'+row_id+'"]').click();
// $.removeCookie('forum_content_view', { path: '/', expires: 12 * 60 * 60 * 1000 });
return false;
} else {
$.cookie(type+'-item',pid, { path: '/' });
$.cookie('forum_content_view', pid+'&'+row_id, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.forum.setForumCookie(pid,page_num,'','','');
};
}
}
//psearch - project item(pitem) click, set click parent
if($(this).closest('.psearch-view').length > 0) {
if(typeof $(this).attr('data-psearch-seq') != 'undefined') {
$.cookie('gallery-item',$(this).attr('data-psearch-seq'), { path: '/' });
} else {
$.cookie('gallery',$(this).attr('data-psearch-pid'), { path: '/' });
}
if(b.ONE && typeof $(this).attr('data-user-link') != 'undefined' && $(this).attr('data-user-link') == 'index') {
location.replace('/');
return false;
}
}
var datatype = $('.'+selectEL).attr('data-type'),
isimglink = $('.'+selectEL).hasClass('imglink'),
hasalink = $(this).hasClass('sha_link'),
isshlink = $(this).is('[data-shlink]');
var userLink = ((datatype == 'showcase') && isimglink && isshlink) ? $(this).attr('data-shlink') : $(this).attr('href'),
target = '';
if((typeof $(this).attr('target') != 'undefined') || (typeof $(this).attr('data-blank') != 'undefined')) {
if((datatype == 'showcase') && isimglink && isshlink) {
target = $(this).attr('data-blank');
} else target = $(this).attr('target');
}
if(userLink.match(/^mailto:|^tel:|^sms:/gi) !== null) {
window.location.href = userLink;
return false;
}
if(typeof userLink == 'undefined' || $(this).attr('data-user-link') == '' ) {
if(target == '_blank' || target == 'blank') {
var openNewWindow = window.open(userLink);
return false;
} else {
var url = new getLocation(userLink);
golink(_this,url);
return false;
}
}
e.preventDefault();
if(b.ONE) {
if(userLink.charAt(0)=="/") {
var linkRegExp = /\/view\//gi;
var linkMatch = userLink.match(linkRegExp);
if(linkMatch && linkMatch[0]) {
var url = ((b.URL=="/") ? "" : b.URL) + userLink;
if(target == '_blank') {
var openNewWindow = window.open(url);
} else {
location.href=url;
}
return false;
}
userLink = userLink.charAt(0).replace("/","") + userLink.slice(1);
if(target == '_blank') {
var url = ((b.URL=="/") ? "/" : b.URL) + '#' + userLink;
var openNewWindow = window.open(url);
} else {
if(b.VIEW) {
var url = ((b.URL=="/") ? "/" : b.URL) + '#' + userLink;
url = new getLocation(url);
golink(_this,url);
} else {
moveLinkPage(userLink);
}
}
} else {
// alert('Invalid URL');
return false;
}
} else {
var url = ((b.URL=="/") ? "" : b.URL) + userLink;
if(target == '_blank' || target == 'blank') {
var openNewWindow = window.open(url);
} else {
url = new getLocation(url);
golink(_this,url);
}
}
});
/* [Block Bookmark link] Click ==> link-type: link-bookmark*/
$('a[attr-bookmark],*[data-imglink="true"][attr-bookmark],.fr-custom-button[attr-bookmark],.fr-fic[attr-bookmark]').live({
click : function(e) {
if($(this).is('[attr-bookmark=""]')) return false;
e.preventDefault();
if(typeof e.target.className == 'string' && e.target.className.indexOf('fa') > -1 && $(this).closest('header').hasClass('navbar-simple')) {
return false;
}
if(!selectEL || typeof selectEL == 'undefined') {
selectEL = $(this).closest('.element').attr('data-el');
}
var datatype = $('.'+selectEL).attr('data-type'),
isimglink = $('.'+selectEL).hasClass('imglink'),
hasalink = $(this).hasClass('sha_link'),
isshlink = $(this).is('[data-shlink]'),
blockBookmarkList = (typeof b.SETTINGS.blockBookmarkList != 'undefined' && b.SETTINGS.blockBookmarkList) ? b.SETTINGS.blockBookmarkList : {},
hideArray = (typeof blockBookmarkList.hide == 'undefined' || !blockBookmarkList.hide) ? {} : blockBookmarkList.hide;
$.removeCookie('gallery', { path: '/' });
$.removeCookie('gallery-item', { path : '/' });
$.removeCookie('forum', { path : '/' });
$.removeCookie('forum-item', { path : '/' });
var a_el = $(this),
link = ((datatype == 'showcase') && isimglink && isshlink) ? $(this).attr('data-shlink').replace(/^\@/g,'') : $(this).attr('href').replace(/^\@/g,''),
target = '';
if(hideArray.length > 0) {
// IE ERROR_includes__H.20210603
// if(hideArray.includes(link)) {
if($.inArray(link,hideArray) > -1) {
//blockbookmarkLink => 블럭 숨김 체크
return false;
}
}
if((typeof $(this).attr('target') != 'undefined') || (typeof $(this).attr('data-blank') != 'undefined')) {
if((datatype == 'showcase') && isimglink && isshlink) {
target = $(this).attr('data-blank');
} else target = $(this).attr('target');
}
if($('.element[data-bookmark="' + link + '"]').length > 0 && target != '_blank') {
moveLinkPage(b.PAGE+'\@'+link,1200,true);
} else {
var attr_bookmark = $(this).attr('attr-bookmark');
if(typeof attr_bookmark != 'undefined' && attr_bookmark && typeof b.SETTINGS.blockBookmarkList != 'undefined' && typeof b.SETTINGS.blockBookmarkList['bookmark' + attr_bookmark] != 'undefined') {
// if(b.SETTINGS.blockBookmarkList['bookmark' + attr_bookmark] == link) {
link = attr_bookmark;
// }
}
if(typeof b.SETTINGS.blockBookmarkList == 'undefined'|| !b.SETTINGS.blockBookmarkList || typeof b.SETTINGS.blockBookmarkList['bookmark'+link] == 'undefined' ) {
a_el.find('img[data-attach="true"]').unwrap();
return false;
}
$.post('/template/bookmarkBlock', {sid: b.SID, seq: link, publish : b.PUBLISH}, function(data) {
if(data.length == 0) {
console.log('Block Link Click :( Undefined block');
return false;
}
var d = data[0];
if(typeof d.orgpage == 'undefined' || d.orgpage.length == 0) d.orgpage = d.page;
var org_title = d.orgpage.replace(/-/g,' '),
bb_o_page = (d.page.match(/^index/g) !== null ) ? org_title : d.page,
bb_page = (bb_o_page.match(/\,/g) !== null) ? bb_o_page.substring(0,d.page.indexOf('\,')) : bb_o_page;
var check_link = true,
is_visible_menu = false;
$.each(b.SMENU, function (idx, obj) {
if(bb_page == obj.name.replace(/ /g,'-')) {
if(!obj.link) check_link = false;
if(obj.display == 'on') is_visible_menu = false;
}
if(obj.children) {
$.each(obj.children, function (i, v){
if(bb_page == v.name.replace(/ /g,'-')) {
if(!v.link) check_link = false;
if(v.display == 'on') is_visible_menu = false;
}
});
}
});
var is_here = ($('.element[data-bookmark="' + link + '"]').length > 0 ) ? true : false,
is_page = (b.PAGE.toLowerCase()==d.page.toLowerCase()) ? true : false,
// is_visible_menu = ($.inArray(bb_page,b.MENULINK)>-1) ? true : false,
// check_link = ( $('#tpl-menu li a[href*="'+bb_page+'"]').length > 0 && $('#tpl-menu li a[href*="'+bb_page+'"]').text().trim().replace(/ /gi,'-') == bb_page ) ? false : true,
is_link = ( check_link && is_visible_menu && org_title != 'INTRO' ) ? true : false,
is_visible = (check_link && is_visible_menu && org_title != 'INTRO') ? true : false;
// console.log('is_visible_menu : ' + is_visible_menu);
// console.log('bb_page : ' + bb_page);
// console.log('d.glivisible : ' + d.glivisible);
// console.log('is_link : ' + is_link);
// console.log('is_visible : ' + is_visible);
// console.log('is_here : ' + is_here);
// console.log('is_page : ' + is_page);
if( ( !is_visible_menu && bb_page!='index' ) ||
( typeof d.glivisible!='undefined' && d.glivisible ) ||
( /*( (is_here && target=='_blank') || !is_page ) &&*/ ( is_link || is_visible ) ) ||
( !is_here && is_page ) ) {
if(is_visible_menu == false) {
moveBookmark(d.page,'\@'+link,1200,target);
} else {
a_el.find('img[data-attach="true"]').unwrap();
return false;
}
} else {
moveBookmark(d.page,'\@'+link,1200,target);
}
}, 'json');
}
}
});
/* [File link] Click ==> link-type: link-file*/
$('a[attr-flink], .fr-custom-button[attr-flink], .fr-fic[attr-flink]').live({
click : function(e) {
if($(this).is('[attr-flink=""]')) return false;
e.preventDefault();
if(!property.VALIDPLAN || property.VALIDTYPE == 'PK') return false;
var id = $(this).attr('attr-flink');
if(typeof id == 'undefined' || !id) { return false;
} else {
// direct download
// var flink_url = location.protocol + '//' + location.host +'/down/flink/' + id;
// window.open(flink_url);
// modal open
$.getJSON('/down/flink/get/id/' + id , {}, function (data) {
checkError(data);
if(typeof data.data == 'object' && !$.isEmptyObject(data.data)) {
var flink_link = data.data;
var flinkDownModal = $(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['editor.link.file.download.check'], true, true, function() {
var flink_url = location.protocol + '//' + location.host +'/down/flink/' + id + '/sid/' + flink_link.sid + '/s/' + encodeURIComponent(flink_link.file) + '/name/' + encodeURIComponent(flink_link.name);
window.open(flink_url);
flinkDownModal.modal('hide');
}, 'cancel', 'ok');
} else {
return false;
}
}, 'json');
}
}
});
$('.element img[data-attach="true"][data-img-original="ON"]').live({
click: function(e) {
$(this).mouseenter();
},
mouseenter : function(e) {
if(!selectEL || typeof selectEL == 'undefined') {
selectEL = $(this).closest('.element').attr('data-el');
}
if(typeof selectEL == 'undefined') return false;
var offset = $(this).offset(),
left = $(this).width() + offset.left-25,
top = offset.top;
var index = $('.' + selectEL + ' img[data-attach="true"]').index(this);
if(b.VIEW) {
var src = $(this).prop('src').split('/'),
file = src[src.length-1];
if(src.indexOf('googleusercontent') > -1) {
file = src;
}
$('.config-image-view').css({ top : top + 'px', left : left + 'px' }).attr('data-src',$(this).prop('src')).attr('data-index',index).show();
}
},
mouseleave : function(e) {
$('.config-image-view').hide();
}
});
$('.config-image-view').live({
mousemove : function(e) { $('.config-image-view').show(); },
mouseout : function(e) { $('.config-image-view').show(); }
});
$('.config-image-view').on({
click: function (e) {
$('.config-image-view').hide();
var src = $(this).attr('data-src').split('/'),
file = src[src.length-1],
free = (src[4]=='free') ? true : false;
var img_src = $(this).attr('data-src')
if(img_src.indexOf('googleusercontent') > -1) {
file = img_src;
}
file = Base64.encode(file);
if(b.SID && file) {
$('.tooltip.in').removeClass('in');
$(this).attr("href","/image/original/sid/" + b.SID + "/file/" + file + '/free/' + free);
} else {
// console.log('None:: sid or src');
return false;
}
}
});
$('[data-lock-password]').live({
'keydown.autocomplete': function(e) {
if (e.keyCode == 13) {
$('[data-lock-submit]').click();
}
},
'keyup': function() {
if ($(this).val()) {
$('[data-lock-submit]').addClass('btn-primary');
} else {
$('[data-lock-submit]').removeClass('btn-primary');
}
}
});
$('.form-control[type="number"]').live('keydown', function(e) {
if (e.keyCode == 109 || e.keyCode == 189) {
return false;
}
});
$('[data-form-submit]').live('click', function() {
var is_templates = checkTemplateSite(b.SID);
if($('#flat-modal').length || is_templates) return false;
if($('#flat-modal').length) return;
var $parent = $(this).parents('.element'),
$items = $parent.find('[form-idx]'),
values = {},
pid = $parent.attr('data-id'),
submit = true,
el = '.' + $(this).parents('.element').attr('data-name');
$parent.find('.error').remove();
$.each($items, function(i,v) {
var idx = $(this).attr('form-idx'),
name = $(this).attr('form-name'),
type = $(this).attr('form-type'),
require = $(this).attr('form-require'),
seq = $(this).attr('form-seq');
switch(type) {
case "radio":
case "check":
if(type == 'radio') {
var val = $(this).find(':radio[name]:checked').val();
values[seq] = (typeof val == 'undefined') ? '' : val;
} else {
values[seq] = $(this).find(':checkbox[name]:checked').map(function() { return this.value; } ).get().join();
}
if(typeof require != 'undefined' && require) {
if(!values[seq]) {
formRequireDisplay($(this),i+1);
submit = false;
}
}
break;
case "date":
var date = $(this).find('input').map(function() { return this.value.replace(/-/g, ''); } ).get(),
valid = true;
$.each(date, function(k,d) {
if(d=='') valid = false;
});
if(typeof require != 'undefined' && require) {
if(valid == false) {
formRequireDisplay($(this),i+1);
submit = false;
}
}
values[seq] = date.join('');
break;
case "date2":
var date = $(v).find('input').val();
if($(v).find('input').length > 1 && $(v).find('.date-yyyy').length > 0) { //old
var ymd = $(v).find('.date-yyyy').val() + '-' + $(v).find('.date-mm').val() + '-' + $(v).find('.date-dd').val();
var time = $(v).find('.date-hh').val() + ':' + $(v).find('.date-ii').val();
date = ymd + ' ' + time;
}
values[seq] = date;
if(typeof require != 'undefined' && require) {
if(!values[seq]) {
formRequireDisplay($(this),i+1);
submit = false;
}
}
break;
case "file.upload":
var fileArr = new Array();
$(this).find('input[type="hidden"]').each(function(idx, v) {
var f = '#FILE#||' + $(v).val();
fileArr.push(f);
});
var val = fileArr.join(',');
values[seq] = (typeof val == 'undefined') ? '' : val;
if(typeof require != 'undefined' && require) {
if(!values[seq].replace('#FILE#||', '')) {
formRequireDisplay($(this),i+1);
submit = false;
}
}
break;
default :
values[seq] = $(this).val().trim();
if(values[seq] && checkEmojis(values[seq])) {
formRequireDisplay($(this),i+1,'emoji');
submit = false;
} else if(typeof require != 'undefined' && require) {
if(!values[seq]) {
formRequireDisplay($(this),i+1);
submit = false;
}
}
break;
}
});
var $privacy = $parent.find('.form-privacy'),
check;
if($privacy.css('display')!='none') {
check = $privacy.find('.check-privacy').prop('checked');
if(check === false) {
formRequireDisplay($privacy.find('.check-privacy'),'privacy');
submit = false;
}
}
var $captcha = $parent.find('.form-captcha');
var formCaptcha = '';
if($captcha.length > 0) {
formCaptcha = $captcha.find('.input-captcha').val();
if(formCaptcha == '') {
formRequireDisplay($captcha.find('.input-captcha'),'captcha');
submit = false;
}
}
if($('.form-inline .error').length > 0) {
var $error = $parent.find('.error');
var header_height = $('.navbar-fheader').height();
$.each($error, function(i,v) {
if(i==0) {
var $form_group = $(this).parent().find('[form-type]');
var type = $form_group.attr('form-type');
var privacy = $(this).parent().hasClass('form-privacy');
if(type=='radio'||type=='check'||privacy) {
var form_offset = $(this).parents('.form-group').offset();
$("html, body").animate({scrollTop: form_offset.top-header_height});
} else {
$(this).parent().find('.form-control').first().focus();
}
}
});
}
if(submit) {
$.processON();
$.ajax({
url: '/template/forms/submit',
data: { sid : b.SID, pid : pid, values : values, check : check, captcha : formCaptcha },
dataType: 'json',
type: 'POST',
async: true,
cache: false,
success: function (data) {
$.processOFF();
checkError(data);
if(typeof data.captcha_error != 'undefined' && data.captcha_error != '') {
alert($.lang[LANG][data.captcha_error]);
$captcha.find('.input-captcha').focus();
return false;
}
$(this).showModalFlat('INFORMATION',data.done,true,false,'', 'ok', '', 'cl-modal cl-none-title cl-cmmodal cl-p130 cl-s-btn w560','','',function(){
if(typeof formCallback == 'function') formCallback(pid);
});
setDefaultForm(el);
}
},'json');
}
});
var formRequireDisplay = function($obj,idx,error_type) {
if(typeof error_type == 'undefined') error_type = '';
var blang = $obj.parents('.element').attr('data-lang'),
sdefault = '';
if(typeof property.SLANG.select != 'undefined') {
var _lang = property.SLANG.select;
if(_lang.indexOf('한국어') > -1) {
sdefault = '필수 입력 사항';
} else if(_lang.indexOf('English') > -1) {
sdefault = 'Required';
} else if(_lang.indexOf('日本語') > -1) {
sdefault = '必須';
} else {
sdefault = 'Required';
}
} else sdefault = '필수 입력 사항';
if(error_type == 'emoji') {
sdefault = $.lang[LANG]['config.unable.emoji'];
}
/*
if(typeof blang == 'undefined') {
blang = getLanguage(true);
}
if(blang == 'ko') {
sdefault = '필수 입력 사항';
} else if(blang == 'en') {
sdefault = 'Required';
} else if(blang == 'ja') {
sdefault = '必須';
} else {
sdefault = 'Required';
}
*/
var $parent = $obj.parents('.form-group'),
$html = $('' + sdefault + '
');
$parent.append($html);
if($obj.parents('.form-inline').find('.error').length==1) {
if(isNumber(idx)) $('body').scrollTo($('[form-idx="' + idx + '"]'), 0, { offset : -150 } );
else $('body').scrollTo($parent, 0, { offset : -150 } );
}
}
$('.date-yyyy').live('keyup', function(e) {
var val = $(this).val();
if(val.length>=4) {
if((e.target.selectionStart).length) ;
else {
if(isNaN(parseInt(val))) {
$(this).val('1900');
}
$(this).parents('.form-group').find('.date-mm').focus();
}
}
}).live('blur', function(e) {
var val = $(this).val();
if(isNaN(parseInt(val))) {
$(this).val('1900');
} else {
if(parseInt(val)<1900) {
$(this).val('1900');
}
}
});
$('.date-mm, .date-dd, .date-hh, .date-ii').live('keyup', function(e) {
var val = $(this).val();
if(val.length>=2) {
if((e.target.selectionStart).length) ;
else {
if(isNaN(parseInt(val))) {
$(this).val('00');
}
if($(this).hasClass('date-mm')) {
$(this).parents('.form-group').find('.date-dd').focus();
} else if($(this).hasClass('date-dd')) {
$(this).parents('.form-group').find('.date-hh').focus();
} else if($(this).hasClass('date-hh')) {
$(this).parents('.form-group').find('.date-ii').focus();
} else if($(this).hasClass('date-ii')) {
// $(this).parents('.form-group').next().find('input').focus();
}
}
}
}).live('blur', function(e) {
var val = $(this).val();
if(isNaN(parseInt(val))) {
$(this).val('01');
} else {
if(val.length==1) {
$(this).val('0' + val);
} else {
if($(this).hasClass('date-mm') && parseInt(val)>12) {
$(this).val('12');
} else if($(this).hasClass('date-dd') && parseInt(val)>31) {
$(this).val('31');
} else if($(this).hasClass('date-hh') && parseInt(val)>23) {
$(this).val('00');
} else if($(this).hasClass('date-ii') && parseInt(val)>59) {
$(this).val('00');
}
}
}
});
$('[data-lock-submit]').live('click', function() {
var el = $(this).closest('.form-inline');
var pw = el.find('[data-lock-password]').val().trim();
if(pw.length == 0 ) {
el.find('[data-lock-password]').focus();
el.find('.error-text').text('! ' + $.lang[LANG]['config.enter-password']);
return false;
}
$.modalON();
var url = ($(this).attr('data-lock') == 'site')? '/template/siteLockController/type/pw_check':'/template/menuLockController/type/pw_check';
$.post(url, {s: b.SMENU, sid: b.SID, page: b.PAGE, pw: pw, publish : b.PUBLISH}, function(data) {
checkError(data);
$.modalOFF();
if(data.result) {
window.location.reload(true);
} else {
el.find('[data-lock-password]').focus();
el.find('.error-text').text('! ' + $.lang[LANG]['siteum.regexp.pw.invalid']);
}
}, 'json');
});
$('[data-contact-submit]').live('click',function(e) {
var is_templates = checkTemplateSite(b.SID);
// if($('#flat-modal').length || window.location != window.parent.location) return;
//템플릿 추가 화면에서만 버튼 동작 안 되게끔 처리, 사용자 미리보기 화면에서는 동작
if($('#flat-modal').length || is_templates) return;
$.modalON();
var el = '.' + $(this).parents('.element').attr('data-name'),
el_id = $(this).parents('.element').attr('data-id'),
google_track = $(this).attr('data-google-track'),
google_track_run = false,
daum_track = $(this).attr('data-daum-track'),
daum_track_run = false,
naver_track = $(this).attr('data-naver-track'),
naver_track_run = false;
var hasEmoji = false;
$(el+' .form-group .form-control:not([readonly])').each(function() {
if(checkEmojis($(this).val().trim())) {
hasEmoji = true;
return false;
}
});
if(hasEmoji) {
e.preventDefault();
$.modalOFF();
errorEmojisModal();
return false;
}
google_track_run = (typeof google_track != 'undefined') ? true : false;
daum_track_run = (typeof daum_track != 'undefined') ? true : false;
naver_track_run = (typeof naver_track != 'undefined') ? true : false;
if($(el).length==0 || $(el).length>1) {
alert('Invalid form data');
return false;
}
var firstname = ($(el + ' [data-contact-firstname]').length >0 ) ? setDefaultValue($(el + ' [data-contact-firstname]').val().trim()) : '',
lastname = ($(el + ' [data-contact-lastname]').length > 0) ? setDefaultValue($(el + ' [data-contact-lastname]').val().trim()) : '',
email = ($(el + ' [data-contact-email]').length > 0) ? setDefaultValue($(el + ' [data-contact-email]').val().trim()) : '',
web = ($(el + ' [data-contact-website]').length > 0) ? setDefaultValue($(el + ' [data-contact-website]').val().trim()) : '',
phone = ($(el + ' [data-contact-phone]').length > 0) ? setDefaultValue($(el + ' [data-contact-phone]').val().trim()) : '' ,
subject = ($(el + ' [data-contact-subject]').length > 0) ? setDefaultValue($(el + ' [data-contact-subject]').val().trim()) : '',
message = ($(el + ' [data-contact-message]').length > 0) ? setDefaultValue($(el + ' [data-contact-message]').val().trim()) : '',
etc = {};
$(el + ' [data-contact-etc]').each(function(i) {
var key = $(this).attr('data-contact-etc');
etc[key] = setDefaultValueEtc($(this).attr('type'),$(this));
});
var require_firstname = $(el + ' [data-contact-firstname]').attr('data-required'),
require_lastname = $(el + ' [data-contact-lastname]').attr('data-required'),
require_email = $(el + ' [data-contact-email]').attr('data-required'),
require_web = $(el + ' [data-contact-website]').attr('data-required'),
require_phone = $(el + ' [data-contact-phone]').attr('data-required'),
require_subject = $(el + ' [data-contact-subject]').attr('data-required');
/*default:: required[email,message] | optional[firstname,lastname,web,phone,subject] // data-optional='true'->optional, 'false'->required */
var optional_firstname = $(el + ' [data-contact-firstname]').attr('data-optional'),
optional_lastname = $(el + ' [data-contact-lastname]').attr('data-optional'),
optional_email = $(el + ' [data-contact-email]').attr('data-optional'),
optional_web = $(el + ' [data-contact-web]').attr('data-optional'),
optional_phone = $(el + ' [data-contact-phone]').attr('data-optional'),
optional_subject = $(el + ' [data-contact-subject]').attr('data-optional'),
optional_message = $(el + ' [data-contact-message]').attr('data-optional');
var optional_etc = {};
$(el + ' [data-contact-etc]').each(function(i) {
var key = $(this).attr('data-contact-etc');
optional_etc[key] = $(this).attr('data-optional');
});
var $parent = $(this).parents('.element'),
el = '.' + $(this).parents('.element').attr('data-name'),
contprivacy = $(el+' .form-group.contact-privacy-area').css('display'),
contprivacy_display = (typeof contprivacy == 'undefined' || contprivacy == 'none') ? false : true,
privacy_check = $parent.find('.contact-checkbox-text'),
privacy_chk = privacy_check.is(":checked"),
check = true,
check_option = [];
if(!firstname) {
var name_text = ($(el + ' [data-contact-lastname]').length > 0) ? 'first name' : 'name';
if(typeof optional_firstname != 'undefined' && optional_firstname == 'false') check = true;
else if ($(el + ' [data-contact-firstname]').length == 0) check = true;
else check = false;
var str = ($(el + ' [data-contact-firstname]').length > 0 && $(el + ' [data-contact-firstname]').attr('data-contact-firstname').length > 0) ? $(el + ' [data-contact-firstname]').attr('data-contact-firstname') : name_text;
if(!check) check_option.push(str);
}
if($(el + ' [data-contact-lastname]').length > 0 && !lastname) {
if(typeof optional_lastname != 'undefined' && optional_lastname == 'false') check = true;
else if ($(el + ' [data-contact-lastname]').length == 0) check = true;
else check = false;
var str = ($(el + ' [data-contact-lastname]').attr('data-contact-lastname').length > 0) ? $(el + ' [data-contact-lastname]').attr('data-contact-lastname') : 'last name';
if(!check) check_option.push(str);
}
/*if((!firstname && typeof optional_firstname != 'undefined' && optional_firstname == "false") || (!lastname && typeof optional_lastname != 'undefined' && optional_lastname == "false")) {
var str = ($(el + ' [data-contact-firstname]').attr('data-contact-firstname').length > 0) ? $(el + ' [data-contact-firstname]').attr('data-contact-firstname') : 'name';
check_option.push(str);
}*/
if(!web && typeof optional_web != 'undefined' && optional_web == 'false') {
var str = ($(el + ' [data-contact-web]').attr('data-contact-web').length > 0) ? $(el + ' [data-contact-web]').attr('data-contact-web') : 'web';
check_option.push(str);
}
if(!phone && typeof optional_phone != 'undefined' && optional_phone == 'false') {
var str = ($(el + ' [data-contact-phone]').attr('data-contact-phone').length > 0) ? $(el + ' [data-contact-phone]').attr('data-contact-phone') : 'phone';
check_option.push(str);
}
if(!subject && typeof optional_subject != 'undefined' && optional_subject == 'false') {
var str = ($(el + ' [data-contact-subject]').attr('data-contact-subject').length > 0) ? $(el + ' [data-contact-subject]').attr('data-contact-subject') : 'subject';
check_option.push(str);
}
if(!email) {
if(typeof optional_email != 'undefined' && optional_email == 'true') check = true;
else if ($(el + ' [data-contact-email]').length == 0) check = true;
else check = false;
var str = ($(el + ' [data-contact-email]').attr('data-contact-email').length > 0) ? $(el + ' [data-contact-email]').attr('data-contact-email') : 'email';
if(!check) check_option.push(str);
}
if(!message) {
if(typeof optional_message != 'undefined' && optional_message == 'true') check = true;
else check = false;
var str = ($(el + ' [data-contact-message]').attr('data-contact-message').length > 0) ? $(el + ' [data-contact-message]').attr('data-contact-message') : 'message';
if(!check) check_option.push(str);
}
$.each(etc,function(k,v){
if(!etc[k] && typeof optional_etc[k] != 'undefined' & optional_etc[k] == 'false') {
check_option.push(k);
}
});
check = ((check_option.length == 0) && ((contprivacy_display == false) || (privacy_chk == true))) ? true : false;
if(require_firstname == 'true' && !firstname) {
$(this).showModalFlat('INFORMATION',$(el + ' [data-contact-firstname]').attr('placeholder') + $.lang[LANG]['check.required'], true, false, '', 'ok');
return false;
}
if(require_lastname == 'true' && !lastname) {
$(this).showModalFlat('INFORMATION',$(el + ' [data-contact-lastname]').attr('placeholder') + $.lang[LANG]['message.check.required'], true, false, '', 'ok');
return false;
}
if(require_web == 'true' && !web) {
$(this).showModalFlat('INFORMATION',$(el + ' [data-contact-website]').attr('placeholder') + $.lang[LANG]['message.check.required'], true, false, '', 'ok');
return false;
}
if(require_phone == 'true' && !phone) {
$(this).showModalFlat('INFORMATION',$(el + ' [data-contact-phone]').attr('placeholder') + $.lang[LANG]['message.check.required'], true, false, '', 'ok');
return false;
}
if(require_subject == 'true' && !subject) {
$(this).showModalFlat('INFORMATION',$(el + ' [data-contact-subject]').attr('placeholder') + $.lang[LANG]['message.check.required'], true, false, '', 'ok');
return false;
}
if(check) {
$.post('/template/update/type/contact',{
id : b.SID,
seq : el_id,
s : 'message',
firstname : firstname,
lastname : lastname,
email : email,
web : web,
phone : phone,
subject : subject,
message : message,
etc : JSON.stringify(etc),
}, function(data) {
checkError(data);
if(typeof data.error == 'undefined' || data.error == '') {
var ch_lang = getLang($(el), b.SID),
submit_txt = (typeof data.submitStr != 'undefined' && data.submitStr) ? data.submitStr : $.lang[ch_lang]['message.sent'];
$(this).showModalFlat('INFORMATION',submit_txt,true,false, '', 'ok', '', 'cl-modal cl-none-title cl-cmmodal cl-p130 cl-s-btn w560');
setDefaultContactForm(el);
setDefaultContactFormEtc(el);
if(typeof contactCallback == 'function')
contactCallback(el_id);
}
},'json');
setTimeout(function() {
$.modalOFF();
},1000);
} else {
$.modalOFF();
var check_str = '';
$.each(check_option,function(k,v) {
check_str = (check_str) ? check_str + ' / ': '';
check_str = check_str + v;
});
if(check_str) {
var modal = $(this).showModalFlat('INFORMATION',check_str+ $.lang[LANG]['message.check.required'],true,false, '', 'ok', '', 'cl-modal cl-none-title cl-cmmodal cl-p130 cl-s-btn w560');
} else {
var modal = $(this).showModalFlat('INFORMATION',$.lang[LANG]['message.privacy.check.required'],true,false, '', 'ok');
}
}
});
$('.contact-privacy-text').live('click',function() {
var contactEL = $(this).parents('.element'),
contactPriavcy = $(contactEL).find('.form-inline .contact-privacy-area .contact-privacy-box'),
checkType = (typeof $(contactEL).attr('data-type') != 'undefined' && $(contactEL).attr('data-type') == 'contact') ? true : false;
if(checkType && contactPriavcy.length > 0) {
if(contactPriavcy.css('display') == 'none') contactPriavcy.show();
else contactPriavcy.hide();
}
});
$('.element .gallery-loadmore').live({
click: function(e) {
if(typeof $(this).data('id') == 'undefined' || typeof $(this).data('page') == 'undefined') {
e.preventDefault();
return false;
}
var id = $(this).attr('data-id'),
gpage = (typeof $(this).attr('data-page') != 'undefined') ? Number($(this).attr('data-page')) : 1,
view = (typeof $(this).attr('data-view') != 'undefined') ? Number($(this).attr('data-view')) : 6,
mode = $(this).attr('data-mode'),
$galleryELLoadmore = $(this),
$galleryEL = $('.element[data-id="' + id + '"]'),
$gContainer = $galleryEL.find('.container'),
$gLoop = $galleryEL.find('[data-loop="true"]'),
$gc = $galleryEL.find('.gallery-category-nav li.active'),
$go = $galleryEL.find('.gallery-sort-nav li.active a'),
sfl = ($gc.index() > 0) ? 'category' : '',
stx = (sfl) ? $gc.text().trim() : '',
orderby = ($go.length > 0) ? $go.attr('data-orderby') : 'recent';
var val = galleryEL[id],
tag = htmlspecialchars_decode(val.eltag,'ENT_QUOTES'),
g_settings = (typeof val.elsettings != 'undefined' && val.elsettings) ? $.parseJSON(val.elsettings) : {},
folder = (typeof val.folder != 'undefined' && val.folder > 0) ? val.folder : '',
isMasonry = $galleryELLoadmore.hasClass('masonry-layout'),
block_lang = (typeof g_settings.blocklang != 'undefined') ? g_settings.blocklang : LANG;
var nodes = $gLoop.clone().children('.grid'),
g_number = $gLoop.data('gallery-no'),
total = 0,
items = 0,
gallery_item = '';
var checkLoadmoreInLoop = ($(tag).find('[data-loop="true"] .loadmore-wrap').length) ? true : false,
glm = $(tag).find('.loadmore-wrap');
var el_gh = $(tag).find('.goption').attr('data-gh'),
checkGalleryHeight = (typeof el_gh != 'undefined' && el_gh) ? true : false,
checkGallerySVG = ($(tag).find('.gimg-svg-wrap').length > 0) ? true : false,
checkGFrameTitleOFF = (val.mode == 'gallery' && (typeof g_settings.gframe_title_visible != 'undefined' && g_settings.gframe_title_visible == 'OFF')) ? true : false;
if(id == 'all_products') {
sfl = 'orderby';
stx = (typeof $gc.find('a').attr('data-idx') != 'undefined') ? $gc.find('a').attr('data-idx') : $('.allProducts-sort-list>li:first-child').find('a').attr('data-idx');
}
var checkUseComment = checkUseCommentFunc(val.mode, val.eltag);
var checkUseLike = checkUseLikeFunc(val.mode, val.eltag);
var uri = getSearchURL();
// if(uri.category_no == '') {
// uri.category_no = (typeof g_settings.lux_category_no != 'undefined') ? g_settings.lux_category_no : '';
// }
if (isObjectEmpty(uri) && _this.b.LUX) {
uri = val.searches.uri;
}
$.ajax({
url: '/template/gallery/list/pid/' + id + '/sid/' + property.SID + '/spage/' + property.PAGE + '/page/' + gpage + '/view/' + view + '/publish/' + property.PUBLISH,
data: { g_mode: mode, visible: true, sfl: sfl, stx: stx, orderby: orderby, total: true, uri : uri },
dataType: 'json',
type: 'POST',
async: false,
cache: false,
success: function (data) {
$.cookie('gallery-page-' + id, gpage, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-category-' + id, stx, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-orderby-' + id, orderby, { path: '/', expires: 12 * 60 * 60 * 1000 });
if($galleryEL.is('[data-gjs]') && gpage > 1) setLoadmoreGalleryJS($galleryEL.attr('data-gjs'),id,true);
var loop_count = nodes.length;
total = (typeof data.total.list_total != 'undefined') ? data.total.list_total : data.total;
items = data.list.length;
var g_popup_remove = $('.galleryPL'+id+'.gallery-popup').find('.gallery-item');
$.each(g_popup_remove,function(i,v) {
if(items > i) $(this).remove();
});
$.each(data.list,function(i,v) {
loop_pos = i%loop_count;
c = nodes[loop_pos];
item_index = ((gpage-1)*view) + i;
var isTitle = (v.title.length > 0) ? true:false;
$(c).addClass('gallery-item').attr('data-index',item_index).attr('data-gpos',v.pos).attr('data-seq',v.seq);
var vgsettings = (typeof v.gsettings != 'undefined' && v.gsettings) ? $.parseJSON(v.gsettings) : {},
img_path = (typeof vgsettings['storage'] != 'undefined') ? vgsettings['storage'] : _this.b.RESOURCE + '/' + _this.b.SID + '/',
img_original = (typeof vgsettings['storage'] != 'undefined') ? img_path + '1920/' : img_path;
var src = getServeImage(v.image,val.folder,img_path),
src_s0 = getServeImage(v.image,'0',img_path);
if($(c).find('img').length > 0) $(c).find('img').attr('src',src);
if($(c).find('.g-img').length > 0) $(c).find('.g-img').css('background-image', 'url('+src+')');
if(checkGallerySVG) {
var gimgSVG = $(c).find('.gimg-svg-wrap svg');
gimgSVG.find('pattern').attr('id','gimgSvg_'+val.elname+'_'+item_index);
gimgSVG.find('image').attr('xlink:href', src);
gimgSVG.find('polygon').attr('fill', 'url(#gimgSvg_'+val.elname+'_'+item_index+')');
}
var glink = (typeof vgsettings['glink'] != 'undefined' && vgsettings['glink']) ? vgsettings['glink'] : '',
glink_target = (typeof vgsettings['glink_target'] != 'undefined' && vgsettings['glink_target']) ? vgsettings['glink_target'] : '';
if(glink) {
if(glink.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark]
var bookmark_seq = glink.replace(/^\@/g,'');
if(typeof _this.b.SETTINGS.blockBookmarkList == 'undefined' || typeof _this.b.SETTINGS.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') {
glink = '';
glink_target = '';
}
} else if(glink.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink]
glink_target = '';
} else if($.inArray(glink.replace(/^\//g,'').replace(/ /g,'-'),_this.b.MENULIST) > -1) { // link-type: link-menu ==> a[data-user-link]
} else { // link-type: link-out ==> a[attr-link]
if(checkBase64Encode(glink)) glink = Base64.decode(glink);
}
}
$(c).find('a').removeAttr('data-gallery').removeAttr('data-user-link').removeAttr('attr-bookmark').removeAttr('attr-link').removeAttr('attr-flink');
if (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON' && property['SITEUM'] >= 1) {
$(c).addClass('gallery-item').addClass('nonePrice');
$(c).find('a').attr('href', '#');
} else {
if(glink) {
var glink_val = makeLinkUrl(glink, b.ONE, b.VIEW);
$(c).find('a').attr('href',glink_val);
if(glink.match(/^\@/g)) {
$(c).find('a').attr('attr-bookmark',glink.replace(/^\@/g,''));
} else if(glink.match(/^flink\@[0-9]/g)) {
$(c).find('a').attr('attr-flink',glink.replace(/^flink\@/g,''));
// IE ERROR_includes__H.20210603
// } else if(_this.b.MENULIST.includes(glink.replace(/ /g,'-'))) {
} else if($.inArray(glink.replace(/ /g,'-'),_this.b.MENULIST) > -1) {
$(c).find('a').attr('data-user-link',glink_val);
} else {
$(c).find('a').attr('attr-link',glink);
}
} else {
if (val.mode == 'gallery') {
src_s0 = src_s0 + '?gpos='+v.pos;
$(c).find('a').attr('href', src_s0);
$(c).find('a').attr('data-gallery', '#gframe-' + val.seq);
} else {
if(val.seq == 'all_products') {
$(c).find('a').attr('href', v.product_url);
$(c).removeClass('nonePrice');
} else {
if(_this.b.LUX) $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/_product/' + v.seq);
else $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/' + _this.b.PAGE + '/view/' + v.seq);
// $(c).find('a').attr('href', ((b.URL=='/') ? '' : b.URL) + '/' + b.PAGE + '/view/' + v.seq);
}
}
}
}
if(glink_target == '_blank') $(c).find('a').attr('target','_blank');
else $(c).find('a').removeAttr('target');
if(v.title.length==0) v.title = $.lang[block_lang]['editor.block.gallery.sample.title'];;
if(v.caption.length==0) v.caption = $.lang[block_lang]['editor.block.gallery.sample.caption'];
if(checkGFrameTitleOFF || !isTitle) $(c).find('a').attr('data-title', '');
else $(c).find('a').attr('data-title', v.title);
if(mode == 'shopping') {
if($(c).find('.figure.basket').length == 0) {
$(c).find('.figure').last().after('장바구니 담기
');
}
}
// caption
var ftitle = $(c).find('h5.figure'),
fcaption = $(c).find('p.figure').not('.comment'),
fdatetime = $(c).find('.figure.datetime'),
fhashtag = $(c).find('.figure.hashtag'),
fbrand = $(c).find('.figure.brand'),
fprice = $(c).find('.figure.price'),
freview = $(c).find('.figure.review'),
fcomment = $(c).find('.figure.comment'),
flike = $(c).find('.figure.like'),
fbasket = $(c).find('.figure.basket');
if(fcomment.length < 1 && g_settings.comment_display == 'ON' && checkUseComment) {
$(c).find('figcaption p.figure.caption').after('');
fcomment = $(c).find('.figure.comment');
}
if(flike.length < 1 && g_settings.like_display == 'ON' && checkUseLike){
if (fcomment.length > 0) {
fcomment.after('');
} else {
$(c).find('figcaption:not(.top) .figure:last-child').after('');
}
flike = $(c).find('.figure.like');
}
$(c).find('figcaption').removeClass('hide');
if(v.title || v.caption) {
var gallery_caption = v.caption;
gallery_caption = gallery_caption.replace(/\n/g,'
');
ftitle.html(v.title);
fcaption.html(gallery_caption);
if(fdatetime.length > 0) fdatetime.text(v.datetime);
if(fhashtag.length > 0) fhashtag.text(v.hashtag);
}
if(g_number) {
var g_index = String(item_index + 1),
g_num = g_index.padStart(g_number, '0');
$(c).find('.figure.number').text(g_num);
}
if(fbrand.length > 0) {
var fbrand_name = (typeof v.brand_name != 'undefined' && v.brand_name) ? v.brand_name : '';
fbrand.html(v.brand_name);
}
if(mode == 'shopping' || id == 'all_products') {
fcomment.addClass('hide');
flike.addClass('hide');
v.price = parseFloat(v.price);
v.sale = parseFloat(v.sale);
var checkPriceHidden = (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON') ? true : false,
gallery_price = (v.price && !checkPriceHidden) ? v.price : 0,
gallery_sale_price = (typeof v.sale != 'undefined' && v.sale > 0 && v.sale > v.price && !checkPriceHidden) ? v.sale : 0,
gallery_sale_per = (typeof v.sale_per != 'undefined' && v.sale_per && !checkPriceHidden) ? v.sale_per : '',
product_soldout = '품절',
product_no_sale = (typeof g_settings.sh_soldout == 'string') ? g_settings.sh_soldout : '구매불가',
product_status = '';
if(v.status == 'off' && !checkPriceHidden) {
product_status = '' + product_no_sale + '';
} else if(v.quantity_on == 'on' && v.quantity < 1 && !checkPriceHidden) {
product_status = '' + product_soldout + '';
}
$(c).find('.cl-sh-soldout').remove();
if(product_status != '') $(c).attr('data-soldout',true);
else $(c).removeAttr('data-soldout');
$(c).find('.product-badge').remove();
product_status += drawBadgeList(v.use_badge, data.badge_settings);
$(c).find('.cl-sh-limit').remove();
if(v.status == 'lim') {
if(v.sale_now == false) {
var product_limit = '상품 구매 가능 기간이 아닙니다.
';
if(freview.length > 0) {
freview.after(product_limit);
} else {
$(c).find('figcaption:not(.top) .figure:last-child').after(product_limit);
}
}
}
if($(c).find('ul.figure.price').length > 0) {
// var price_off = (v.sale_price > 0 && v.sale_price > v.price) ? 100 - Math.floor((v.price / v.sale_price) * 100) : 0,
// off_str = (price_off > 0) ? price_off + '% ' : ''
var off_str = (v.sale_rate > 0) ? v.sale_rate + '% ' : '';
if(!_this.b.LUX) off_str = gallery_sale_per;
//Ver02
if(!checkPriceHidden) {
$(c).find('ul.figure.price .price-val').html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-val').removeClass('hide');
if(gallery_sale_price > 0 && gallery_price < gallery_sale_price) {
$(c).find('ul.figure.price .price-sale').html('₩' + gallery_sale_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-sale-per').html(off_str);
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').removeClass('hide');
if(_this.b.LUX && (v.hashtag).indexOf('특가세일') > -1 && $(c).find('ul.figure.price .sp-price').length == 0) {
$(c).find('ul.figure.price .price-sale').after('특가세일');
}
} else {
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').addClass('hide').html('');
}
} else {
$(c).find('ul.figure.price .price-val').html('₩0');
$(c).find('ul.figure.price .price-val').removeClass('hide');
}
if(id == 'all_products' && checkPriceHidden) $(c).find('ul.figure.price').html('');
if(product_status) $(c).find('ul.figure.price').append(''+product_status+'');
var badge_size = getBadgeSize(data.badge_settings);
$(c).find('.cl-sh-soldout').removeClass('badge-small badge-medium badge-large');
$(c).find('.cl-sh-limit').removeClass('badge-small badge-medium badge-large');
if(badge_size) {
$(c).find('.cl-sh-soldout').addClass(badge_size);
$(c).find('.cl-sh-limit').addClass(badge_size);
}
} else {
//Ver01
if(fprice.length == 0) fprice = fcaption;
if(checkPriceHidden) fprice.html('');
else fprice.html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,',') + product_status);
}
if($(c).find('ul.figure.review').length > 0) {
var gallery_review = (v.review_onoff && v.review_cnt) ? v.review_cnt : 0;
if(gallery_review > 0) {
$(c).find('ul.figure.review, ul.figure.review li').removeClass('hide');
$(c).find('ul.figure.review .figure-review-cnt').html(gallery_review);
$(c).find('ul.figure.review .figure-review-score').html(v.review_score);
} else {
$(c).find('ul.figure.review, ul.figure.review li').addClass('hide');
$(c).find('ul.figure.review .figure-review-cnt, ul.figure.review .figure-review-score').html('');
}
}
if(fbasket.length > 0) {
var checkOldBlock = ($(c).find('.figure.basket[data-oldver="true"]').length > 0) ? true : false,
checkOldverBasket = (typeof g_settings.field_oldver != 'undefined' && g_settings.field_oldver && g_settings.field_oldver.indexOf('basket') > -1) ? true : false,
checkDisabledBasket = (typeof g_settings.field_disable != 'undefined' && g_settings.field_disable && g_settings.field_disable.indexOf('basket') > -1) ? true : false;
if(v.basket_off) fbasket.addClass('cannotby hide');
else if(id == 'all_products') fbasket.removeClass('hide');
else if(checkDisabledBasket || (!checkDisabledBasket && checkOldBlock && !checkOldverBasket)) fbasket.addClass('hide');
else if(property.VALIDTYPE != 'SM') fbasket.addClass('hide');
else fbasket.removeClass('hide');
}
} else {
fbrand.addClass('hide');
fprice.addClass('hide');
freview.addClass('hide')
fbasket.addClass('hide');
if(mode == 'project' && fcomment.length > 0 && typeof v.comment_cnt != 'undefined' && v.comment_cnt > 0 && g_settings.comment_display == 'ON') {
fcomment.find('.figure-comment-cnt').html(v.comment_cnt);
if(g_settings.field_disable !== undefined && g_settings.field_disable.indexOf('comment') > -1) {
fcomment.addClass('hide');
} else {
fcomment.removeClass('hide');
}
} else {
fcomment.addClass('hide');
}
if(flike.length > 0 && g_settings.like_display == 'ON' && checkUseLike) {
flike.removeAttr('data-like').removeClass('hide active');
if(v.like !== undefined) {
flike.find('.figure-like-cnt').html(v.like.cnt);
if(v.like.own) flike.attr('data-like', v.seq).addClass('active');
}
if(g_settings.field_disable !== undefined && g_settings.field_disable.indexOf('like') > -1) {
flike.addClass('hide');
} else {
flike.removeClass('hide');
}
} else {
flike.addClass('hide');
}
}
if(checkUseLike == false) flike.html('');
var on_figure_total = $(c).find('figcaption .figure:not(.hide, .review[data-review_cnt="false"][data-review_score="false"])').length;
if(on_figure_total > 0) $(c).find('figcaption').addClass('allhide');
else $(c).find('figcaption').removeClass('allhide');
if(isMasonry) {
gallery_item = gallery_item + $(c)[0].outerHTML;
} else {
if(checkLoadmoreInLoop) $gLoop.find('.loadmore-wrap').before($(c)[0].outerHTML);
else $gLoop.append($(c)[0].outerHTML);
}
});
}
});
changeBrokenImages($galleryEL);
if(isMasonry) {
var $gallery_items = $(gallery_item);
$gallery_items.hide();
$('.gallery-loadmore[data-id="' + id + '"]').before('');
var process_index = 0;
$gallery_items.imagesLoaded().progress(function(imgload, image) {
process_index++;
var $item = $(image.img).parents('.grid');
$item.show();
if(items == process_index) {
reloadMasonry($gContainer,$gallery_items);
if(checkGalleryHeight) refreshGalleryHeight();
refreshGalleryField($galleryEL,g_settings);
}
});
} else {
if(checkGalleryHeight) refreshGalleryHeight();
refreshGalleryField($galleryEL,g_settings);
}
var cookie_page = gpage,
new_view = (view > total) ? total : view,
cookie_view = ( (cookie_page*new_view) > total ) ? total : cookie_page*new_view;
$galleryEL.find('.display').text(cookie_view);
var $glmBtnWrap = $galleryELLoadmore.closest('.loadmore-wrap'),
$glmBtn = $galleryEL.find('.loadmore-wrap .gallery-loadmore'),
checkLoadmore = (total > view && total > cookie_view) ? true : false;
if($glmBtnWrap.length == 0) {
// gallery loadmore btn - default (ver1)
if(checkLoadmore) $galleryELLoadmore.attr('data-page', cookie_page + 1);
else $galleryELLoadmore.remove();
} else {
// gallery loadmore btn - custom (ver2)
if(checkLoadmore) {
$glmBtn.attr('data-page', cookie_page + 1);
$glmBtnWrap.removeClass('hide').fadeIn();
} else {
$glmBtnWrap.fadeOut().addClass('hide');
$glmBtn.removeAttr('data-loadmore').removeAttr('data-id').removeAttr('data-total').removeAttr('data-page').removeAttr('data-view').removeAttr('data-folder').removeAttr('data-mode').removeClass('masonry-layout');
$glmBtn.find('.display .view').text('0');
$glmBtn.find('.display .total').text('0');
}
}
if($galleryEL.is('[data-type2="premium"]')) setGalleryJS('add-loop',$galleryEL);
if($galleryEL.find('*[data-direffect="true"]').length > 0 ) {
setTimeout(function() {
$galleryEL.find('.grid').each(function() {
$(this).hoverdir();
});
}, 400);
}
}
});
$('.gallery-loadmore, .data-feed-load-more').live('touchstart', function (e) {
var g_color = $(this).css('color'),
g_bgcolor = $(this).css('background-color'),
g_bdcolor = $(this).css('border-color');
if(isMobile()) {
$(this).css('color', g_color);
$(this).css('background-color', g_bgcolor);
$(this).css('border-color', g_bdcolor);
}
});
$('.gallery-item a[title]').live('mouseenter', function () {
$(this).tooltip('destroy');
});
$('.gallery-item a:not([attr-flink])').live({
click : function(e) {
e.preventDefault();
if($(e.target).is('.figure.basket') || $(e.target).is('.basket-btn')) return false;
var loc = $(this).attr('href'),
mode = $(this).attr('data-gallery'),
menu_link = $(this).attr('data-user-link'),
bookmark = $(this).attr('attr-bookmark'),
blank = $(this).attr('target'),
user_link = $(this).attr('attr-link');
if( (typeof mode!='undefined' && mode.length>0) ||
(typeof menu_link!='undefined' && menu_link.length>0) ||
// (typeof user_link!='undefined' && user_link.length>0) ||
(typeof bookmark!='undefined' && bookmark.length>0)
) return;
if(typeof blank!='undefined' && blank.length) {
var url = (typeof user_link != 'undefined' && user_link.match('^(tel:|mailto:|sms:)') === null) ? makeLinkUrl(user_link, b.ONE, b.VIEW) : loc;
var openNewWindow = window.open(url);
} else {
if(typeof user_link != 'undefined' && user_link) {
location.href=loc;
} else {
var url = new getLocation(loc);
golink(_this,url);
}
}
// uri = (b.PUBLISH) ? loc : loc.replace('/render/',''),
// attr = $(this).attr('attr-link');
// if(typeof attr!='undefined' && attr) return;
// _this.history.pushState(null,b.TITLE,(b.PUBLISH) ? '/' : '/render/' + uri);
}
});
$('.gallery-item .figure.like').live('click', function(e){
e.preventDefault();
return false;
});
$('.gallery-item .figure.basket, .pitem .basket-box').live('click', function(e) {
e.preventDefault();
var checkPsearch = ($(this).closest('.pitem').length > 0) ? true : false;
if(b.PUBLISH) {
if(!checkPsearch && $(this).closest('.gallery-item').hasClass('nonePrice')) {
$(this).closest('.nonePrice').click();
return false;
}
var tmp_pid = (checkPsearch) ? $(this).closest('.pitem').attr('data-pid') : $(this).closest('.element').attr('data-id'),
tmp_seq = (checkPsearch) ? $(this).closest('.pitem').attr('data-gid') : $(this).closest('.gallery-item').attr('data-seq');
$.quickbasket.init(b.SID,tmp_pid,tmp_seq);
} else {
$(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['manager.check.no-support.render-mode'], true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0');
return false;
}
});
// $('.gallery-item').live('click', function(e) {
// if($(this).find('[attr-flink]').length > 0 ) {
// e.preventDefault();
// return false;
// }
// if($(e.target).hasClass('like') || $(e.target).closest('.figure').hasClass('like')) {
// e.preventDefault();
// return false;
// }
// var $el = $(this).parents('.element');
// var pid = $el.attr('data-id');
// $('.blueimp-gallery').addClass('blueimp-gallery-controls');
// $('.blueimp-gallery a.zoom-in').remove();
// $('.blueimp-gallery a.gallery-like').addClass('hide').removeClass('active').removeAttr('data-like');
// var gid = $(this).find('a').attr('data-gallery');
// var totalSlide = $(gid).find('.slide').length;
// $('.blueimp-gallery .slide-index .total-slide').text(totalSlide);
// if($(this).find('a').attr('data-img-original') == 'ON') {
// $('.blueimp-gallery a.close').after('');
// }
// $(gid).off('slide').off('slideend');
// $(gid).on('slide', function (event, index, slide) {
// if($(this).find('a').attr('data-gallery-like') === 'ON') $('.blueimp-gallery a.gallery-like').removeAttr('data-like').addClass('hide');
// }).on('slideend', function(event, index, slide){
// $('.blueimp-gallery .slide-index .current-slide').text(index+1);
// if($(this).find('a').attr('data-gallery-like') === 'ON') {
// var itemSeq = $el.find('.gallery-item').eq(index).attr('data-seq');
// if(itemSeq == undefined) {
// itemSeq = $('.galleryPL'+pid+'.gallery-popup .gallery-item[data-index='+index+']').attr('data-seq');
// }
// var l_position = setTimeout(function(){
// if(!$(slide).hasClass('slide-loading')) {
// galleryLikePosition(gid, slide, itemSeq);
// clearTimeout(l_position);
// }
// }, 600);
// }
// });
// $('.blueimp-gallery').find('h3.title').html($(this).find('a').attr('data-title'));
// $.cookie('gallery-item', $(this).attr('data-seq'), { path : '/', expires: 12 * 60 * 60 * 1000 });
// if(b.PARENT.prev != null) $('.data-page-prev').addClass('active');
// if(b.PARENT.next != null) $('.data-page-next').addClass('active');
// e.stopPropagation();
// });
// $('body').on('click','.blueimp-gallery a.zoom-in', function(e) {
// var idx = 0,
// eid = $(this).attr('data-id');
// $('#gframe-' + eid + ' .slide').each(function(i,v) {
// var trans = $(v).attr('style');
// if(trans.indexOf('translate(0px, 0px)') > -1 || trans.indexOf('transform: translate(0px) translateZ(0px)') > -1) {
// idx=i;
// }
// });
// // var src = $('#gframe-' + eid + ' .slide[data-index="' + idx + '"] > img').attr('src');
// // $('.blueimp-gallery a.zoom-in').attr('href',src).attr('target','_blank');
// e.stopPropagation();
// });
``
$('.element[data-type="contact"] .google-map .gm-fullscreen-control').live('click', function(e) {
$(this).toggleClass('gm-open');
if(!$(this).hasClass('gm-open')) {
var el = $(this).closest('.element').attr('data-el');
scrollToBlock('.'+el,300);
}
});
$('#mobile-nav .siteLANG.cl-fixbtn.cl-visible .cl-lang').live({
click: function(e) {
if($('#mobile-nav .siteLANG.cl-fixbtn.cl-visible .dropdown-menu-wrap').hasClass('open')) {
$('#mobile-nav #tpl-menu').css({
'position':'relative',
'z-index':'-1'
});
} else {
$('#mobile-nav #tpl-menu').css({
'position':'',
'z-index':''
});
}
}
});
$('#mobile-nav .dropdown-menu-wrap.open').live({
click: function(e) {
$('#mobile-nav .menu-has-children .dropdown-menu a').css('pointer-events','');
$('#mobile-nav .menu-has-children i.fa-chevron-down').css('z-index','')
}
});
/* page count */
if(Object.keys(b.CONTENTS).length) {
var ps_elupdate = this.contentUpdate(b.CONTENTS),
vpmode = (typeof $('.mobilepc_ch').attr('data-desktop-option') != 'undefined') ? $('.mobilepc_ch').attr('data-desktop-option') : b.SETTINGS.viewportMode;
ps_elupdate.done(function(r_data) {
elFooter();
if(typeof r_data != 'undefined' && typeof r_data.showOnlyFooter != 'undefined' && r_data.showOnlyFooter) {
return false;
}
if(b.COUNT) {
if(b.PARENT.mode == 'shopping') {
if(typeof property.PRODINFO === 'object') $.products.display_info();
if($('#review-onoff').val() == 'true') $.products.review(b.VIEW,b.PAGE);
if($('#qna-onoff').val() == 'true') $.products.qna(b.VIEW,b.PAGE);
} else {
if(b.VIEW) _this.displayComment();
}
}
$('[data-aos-dummy]').each(function() {
$(this).attr('data-aos', $(this).attr('data-aos-dummy')).removeAttr('data-aos-dummy');
});
}).then(function() {
// if(typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) {
// console.log(b.SETTINGS.zoom);
// $.mpcWeb.mpcWebhtml(vpmode,b.CONTENTS,b.SETTINGS.zoom);
// }
}).then(function() {
if(b.VIEW && b.PARENT.mode != 'shopping') {
displayPageToolbar().then(function(pageToolbar){
displayBottomList(b.PARENT.pid);
if($('.page-bottomlist').length) {
$('.page-bottomlist').before(pageToolbar);
}
if ($('.page-comments').length) {
$('.page-comments').before(pageToolbar);
}
});
}
}).then(function() {
if(b.VIEW && b.PARENT.mode != 'shopping') displaySnsShare(b.PARENT.pid);
}).then(function() {
if(b.VIEW && b.PARENT.mode != 'shopping') displayLike(b.PARENT.pid);
}).then(function() {
if(b.VIEW && b.PARENT.mode != 'shopping') displayBottomNav(b.PARENT.pid);
}).then(function() {
if(typeof b.SETTINGS.hideScrollTop != 'undefined' && b.SETTINGS.hideScrollTop == true) $('#goto-top').addClass('hide');
if(b.VALIDPLAN && b.VALIDTYPE != 'PK') {
var ismodeSm = ($('.cl-s-page').hasClass('mode-shopping')) ? true : false;
if(!ismodeSm && b.ONE && !b.VIEW || b.PAGE == b.MENULINK[0] && !b.VIEW) setSitePopup();
$.siteBanner.init(true,true);
// console.log(b);
if(b.VALIDTYPE == 'BN' || b.VALIDTYPE == 'SM') {
if(typeof b.SETTINGS.fnav != 'undefined' && !$.isEmptyObject(b.SETTINGS.fnav)) $.fnav.draw(b.SETTINGS.fnav);
}
}
if(typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) mobileWebfnavCheck(vpmode);
if($('#page-loading-css').length > 0) {
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.position();
$('#page-loading-css').remove();
}
});
}
else {
var checkUrl = b.PAGE.split(","),
vpmode = '';
vpmode = $.mpcWeb.mpcGetVpmode(vpmode,b.SETTINGS);
isMenuLock(function() {
if($('#page-loading-css').length > 0) {
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.position();
$('#page-loading-css').remove();
}
if(property.ISLOCK == 'false') {
if(property.COUNT==0) {
elFooter();
if(checkUrl[0] == "forum" && b.VIEW) {
if(b.VALIDPLAN && b.VALIDTYPE != 'PK' && typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) {
$.mpcWeb.mpcWebhtml(vpmode,b.CONTENTS,b.SETTINGS.zoom);
}
var ps_fmview = $.forum.view(b.VIEW);
ps_fmview.done(function() {
if($('.page-comments[data-id="'+b.VIEW+'"]').length == 0) _this.displayComment();
setTimeout(function() {
if(b.VIEW) {
displaySnsShare(b.PARENT.pid);
displayLike(b.PARENT.pid);
displayBottomNav(b.PARENT.pid);
displayBottomList(b.PARENT.pid);
}
if(b.VALIDPLAN && (b.VALIDTYPE == 'BN' || b.VALIDTYPE == 'SM')) {
if(typeof b.SETTINGS.fnav != 'undefined' && !$.isEmptyObject(b.SETTINGS.fnav)) $.fnav.draw(b.SETTINGS.fnav);
}
if(b.VALIDPLAN && b.VALIDTYPE != 'PK' && typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) {
$.mpcWeb.mpcWebhtml(vpmode,'',b.SETTINGS.zoom);
mobileWebfnavCheck(vpmode);
}
}, 100);
}).fail(function(error_msg) {
console.log(error_msg);
});
}
if(property.PAGE == 'psearch') {
vpmode = $.mpcWeb.mpcGetVpmode(vpmode,property.SETTINGS);
if(b.VALIDPLAN && b.VALIDTYPE != 'PK' && typeof property.SETTINGS.viewportMode != 'undefined' && property.SETTINGS.vpMode_onoff===true) $.mpcWeb.mpcWebhtml(vpmode,property.CONTENTS,property.SETTINGS.zoom);
setTimeout(function() {
if(property.VALIDPLAN && (property.VALIDTYPE == 'BN' || property.VALIDTYPE == 'SM')) {
if(typeof property.SETTINGS.fnav != 'undefined' && !$.isEmptyObject(property.SETTINGS.fnav)) $.fnav.draw(property.SETTINGS.fnav);
}
if(typeof property.SETTINGS.viewportMode != 'undefined' && property.SETTINGS.vpMode_onoff===true) mobileWebfnavCheck(vpmode);
}, 500);
}
var ismodeSm = ($('.cl-s-page').hasClass('mode-shopping')) ? true : false;
if(b.VALIDPLAN && b.VALIDTYPE != 'PK') {
if(!ismodeSm && b.ONE && !b.VIEW || b.PAGE == b.MENULINK[0] && !b.VIEW) setSitePopup();
$.siteBanner.init(true,true);
}
if(b.VALIDPLAN && (b.VALIDTYPE == 'BN' || b.VALIDTYPE == 'SM')) {
if(typeof b.SETTINGS.fnav != 'undefined' && !$.isEmptyObject(b.SETTINGS.fnav)) $.fnav.draw(b.SETTINGS.fnav);
}
if(b.VALIDPLAN && b.VALIDTYPE != 'PK' && typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) {
$.mpcWeb.mpcWebhtml(vpmode,'',b.SETTINGS.zoom);
mobileWebfnavCheck(vpmode);
}
}
} else {
elFooter();
}
});
}
$(window).load(function() {
var p_settings = (b.PARENT.settings) ? jQuery.parseJSON(b.PARENT.settings) : {};
if((typeof p_settings.sns_share_display == 'undefined' || !p_settings.sns_share_display || p_settings.sns_share_display=='OFF') &&
(typeof p_settings.bottomNav_display == 'undefined' || !p_settings.bottomNav_display || p_settings.bottomNav_display=='OFF') &&
(typeof p_settings.like_display == 'undefined' || !p_settings.like_display || p_settings.like_display=='OFF')) {
$('.tpl-page-footer').addClass('hide');
}
$('#no-fouc').css('opacity','1');
if(typeof $.cookie('gallery-item') != 'undefined' && b.VIEW == '') {
moveGallery($.cookie('gallery-item'));
}
if(typeof $.cookie('forum_content_view') == 'undefined'){
moveScroll(0);
}
_this.loaded();
var musicPlay = true;
if(typeof b.SETTINGS.musicStop != 'undefined' && (b.SETTINGS.musicStop === true || b.SETTINGS.musicStop == 'true'))
musicPlay = false;
if(typeof b.SETTINGS.musicUse != 'undefined' && (b.SETTINGS.musicUse === true || b.SETTINGS.musicUse == 'true'))
$.musicON(musicPlay);
if(musicPlay == false) $.musicPause();
var used_disk_value = b.USED_DISK / 1024,
used_disk = Math.ceil(used_disk_value); // byte으로 가져와서 megsabyte으로 변한다
if(Number(b.DISK_SPACE) != -1 && (used_disk > b.DISK_SPACE) && (b.MB_LEVEL != 10)) setlimitdiskPopup();
// menu sidebar - height overflow
if($('body').width() > 768) {
$('header.navbar-li:not([data-fixtype]) #fixed-menu > li.dropdown').live({
mouseenter: function(e) {
var this_bottom = $(this).find('.cl-icon').position().top + $(this).find('.cl-icon').height();
$(this).find('.dropdown-menu').css({
'top': this_bottom+'px',
});
},
mouseleave: function(e) {
$(this).find('.dropdown-menu').removeAttr('style');
}
});
$('header.navbar-li[data-fixtype] #fixed-menu > li.dropdown').live({
mouseenter: function(e) {
var dropdown_cover = '',
this_bottom = 0,
is_fhAlign = (typeof $('.el-menu header.navbar[data-fixtype]').find('.container').attr('data-fh-align') != 'undefined') ? true : false,
checkSidebar = ($('.el-menu header.navbar').hasClass('sidebar')) ? true : false,
$cl_fixbtn = ($('header.navbar[data-fixtype] .cl-fixed-menu .cl-fixbtn.cl-visible').length>0) ? $('header.navbar[data-fixtype] .cl-fixed-menu .cl-fixbtn.cl-visible') : '',
visible_aHght = ($(this).find(' > a:visible').length>0) ? $(this).parents('.cl-fixed-menu').find('li.cl-fixbtn').height() : 10;
var height_arr = [],
height_max = '';
$cl_fixbtn.find('> a:visible').each(function(){
var fixbtn_height = ($(this).find('.cl-icon').length>0) ? $(this).find('.cl-icon').height() : $(this).height(),
fixbtn_fsize = Number($(this).css('font-size').replace(/px/gi,''));
// console.log($(this).height());
// console.log($(this).parents('li.cl-fixbtn').height());
if($(this).height() != $(this).parents('li.cl-fixbtn').height()) {
fixbtn_height = ($(this).find('.cl-icon').height() > $(this).height()) ? $(this).find('.cl-icon').height() :
(($(this).find('.cl-icon').height() + fixbtn_fsize < $(this).height()) ? fixbtn_fsize : $(this).outerHeight());
}
height_arr.push(fixbtn_height);
});
height_max = Math.max(...height_arr);
var li_Hght = 0;
$(this).parents('.cl-fixed-menu').find('li.cl-fixbtn').each(function(i,v){
var li_display = $(this).css('display');
if(li_display!='none') {
li_Hght = Number($(this).height());
return false;
}
});
var li_Hght_half = Number((li_Hght/2).toFixed(0)),
height_max_half = Number((height_max/2).toFixed(0)),
ul_height_max_cal = li_Hght_half - height_max_half;
ul_height_max_cal = (ul_height_max_cal <= 0 && ul_height_max_cal>-3) ? 0 : ul_height_max_cal;
this_bottom = ul_height_max_cal + Number(height_max.toFixed(0)) + 5;
//if(!is_fhAlign && !checkSidebar && $(this).hasClass('siteLANG')) { this_bottom -= ul_height_max_cal;}
if(checkSidebar) {
var fixtype = $('.el-menu header.navbar').attr('data-fixtype'),
fixtype_check_arr = ['01','02','03','08'];
this_bottom = ($.inArray(fixtype,fixtype_check_arr)>-1) ? this_bottom : visible_aHght;
}
if(!checkSidebar) {
$(this).find('.dropdown-menu').before(dropdown_cover);
}
$(this).find('.dropdown-menu').css({
'top': this_bottom+'px'
});
},
mouseleave: function(e) {
$(this).find('.dropdown-menu').removeAttr('style');
$(this).find('.dropdown_cover').remove();
}
});
$('.sidebar .nav li.dropdown').live({
mouseenter: function(e) {
var checkSubMenuPosition = $(this).find('.dropdown-menu').css('position');
if(checkSubMenuPosition == 'absolute') {
var this_top = $(this).offset().top - $(document).scrollTop();
if($(this).closest('header').parent('#element-display').length > 0) this_top -= $(this).closest('header').parent('#element-display').offset().top;
$(this).find('.dropdown-menu').css({
'position': 'fixed',
'top': this_top+'px',
'left': '260px'
});
}
},
mouseleave: function(e) {
$(this).find('.dropdown-menu').removeAttr('style');
}
});
} else {
$('header.navbar-li #fixed-menu > li.dropdown').find('.dropdown-menu').removeAttr('style');
$('header.sidebar #tpl-menu > li.dropdown').find('.dropdown-menu').removeAttr('style');
}
if(typeof $.cookie('ci_goto-gallery') != 'undefined' && $.cookie('ci_goto-gallery')) {
var goto_gallery = '.element[data-id="' + $.cookie('ci_goto-gallery') + '"]',
cookie_domain = (property.HOST.indexOf(':') > -1) ? property.HOST.substring(0,property.HOST.indexOf(':')) : property.HOST;
if($(goto_gallery).length > 0) {
scrollToBlock(goto_gallery, 1000);
}
$.cookie('ci_goto-gallery', '', { domain: '.' + cookie_domain,expires: -1 });
$.cookie('ci_goto-gallery-cate', '', { domain: '.' + cookie_domain,expires: -1 });
}
if(isAosBlock) {
$('body,html').addClass('aos-height');
$('html').addClass('aos-overflowX');
if(window.innerWidth < 769) {
$('body').addClass('aos-overflowX');
}
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.position();
}
if(typeof fbq == 'function' && b.VALIDTYPE == 'SM') {
if(b.VIEW) {
var checkProduct = (b.PAGE.match(/^forum,/g) === null && typeof b.PARENT != 'undefined' && typeof b.PARENT.mode != 'undefined' && b.PARENT.mode == 'shopping') ? true : false,
mn = (b.ONE) ? b.PARENT.opage : b.PARENT.ppage;
if(checkProduct && typeof callbackEvtViewContent == 'function') callbackEvtViewContent(mn,b.PARENT.seq,b.PARENT.title,$('.total-price').text().replace(/[^0-9]/g,''));
} else {
var checkProductList = ($('.element[data-type="gallery"][data-mode="shopping"]').length > 0) ? true : false;
if(checkProductList && typeof callbackEvtLead == 'function') callbackEvtLead(b.PAGE);
}
}
});
},
contentUpdate : function(contents) {
// console.log(' page draw:: contentUpdate');
var deferred = $.Deferred();
var b = this.b,
_this = this,
idx = 0;
var checkSiteLock = isSitePasswordLock();
checkSiteLock.then(function() {
isMenuLock(function() {
var default_t_css = '', default_m_css = '';
var checkGalleryView = (b.VIEW && b.PAGE.match(/^forum,/g) === null) ? true : false,
page_pos = 0,
site_settings = (typeof b.SETTINGS != 'undefined' && b.SETTINGS) ? b.SETTINGS : {},
vpmode = '';
var is_templates = checkTemplateSite(b.SID);
vpmode = $.mpcWeb.mpcGetVpmode(vpmode,b.SETTINGS);
if(b.VALIDPLAN && b.VALIDTYPE != 'PK' && typeof b.SETTINGS.viewportMode != 'undefined' && b.SETTINGS.vpMode_onoff===true) {
$.mpcWeb.mpcWebhtml(vpmode,b.CONTENTS,b.SETTINGS.zoom);
}
$.each(contents, function(i,v) {
page_pos += 1;
var c = v.element,
$el = $('.' + c.elname),
msny = (c.feature=='masonry') ? true : false;
if(b.ONE && c.orgpos==1) $el.addClass('link-to-'+c.orgpage.replace(/ /g,'-'));
var settings = (c.elsettings == '' || typeof c.elsettings == 'undefined') ? {} : $.parseJSON(c.elsettings),
block_lang = (typeof settings.blocklang != 'undefined') ? settings.blocklang : LANG;
if(c.type == 'video') {
if($el.find('.video-gallery-url').length > 0) c.mode = 'zoom';
else c.mode = 'thumb';
}
//처음 접속 시
$el.addClass('el_' + idx)
.addClass('element')
.attr('data-id', c.seq)
.attr('data-el','el_' + idx)
.attr('data-pos', c.pos)
.attr('data-name', c.elname)
.attr('data-msny', msny)
.attr('data-type', c.type)
.attr('data-type2', c.type2)
.attr('data-feature', c.feature)
.attr('data-mode', c.mode)
.attr('data-width', c.folder)
.attr('data-overlap',c.overlap);
if($el.length > 1 && c.type == 'showcase') {
$($el).each(function(i, v) {
if(i>0) v.dataset['el'] = '';
});
}
if($el.hasClass('error_404')==false) {
if($el.hasClass('el-footer')==false) {
if($el.hasClass('cl-s-product-detail')==false) {
aosAddblock(site_settings,settings,$el);
}
}
}
var data_aos_attr = '';
if($el.is('[data-aos]')) {
data_aos_attr = $el.attr('data-aos');
$el.removeAttr('data-aos');
$el.addClass('aos-init')
}
var blocklang = '';
if(typeof settings.blocklang != 'undefined') {
blocklang = settings.blocklang;
$el.attr('data-blocklang',blocklang);
}
if (c.type == 'sync') {
var sync_list_total = (typeof v.element.sync !='undefined' && typeof v.element.sync.list != 'undefined' && (v.element.sync.list).length > 0) ? (v.element.sync.list).length : 0;
if($el.find('.slick-page-label').length > 0) {
var page_label = sync_list_total;
if(c.type2 == 'imgpitem' && sync_list_total == 0) page_label = $el.find('.slick .item').length;
$el.find('.slick-page-label .slick-page-now').text(1);
$el.find('.slick-page-label .slick-page-total').text(page_label);
}
if($el.find('.sync-option').length > 0) {
var sync_css = CSSJSON.toJSON(htmlspecialchars_decode(c.elcss));
syncStyle = style.get(sync_css,c.elname),
sync_view = (typeof syncStyle.__sync_view != 'undefined') ? syncStyle.__sync_view : 4,
sync_view_t = (typeof syncStyle.__sync_view_t != 'undefined') ? syncStyle.__sync_view_t : 2,
sync_view_m = (typeof syncStyle.__sync_view_m != 'undefined') ? syncStyle.__sync_view_m : 1,
sync_space = (typeof syncStyle.__sync_space != 'undefined') ? syncStyle.__sync_space : 10,
sync_space_top = (typeof syncStyle.__sync_space_top != 'undefined') ? syncStyle.__sync_space_top : 1,
sync_height = (typeof syncStyle.__sync_height != 'undefined') ? syncStyle.__sync_height : 1,
sync_page_unit = (typeof syncStyle.__sync_page_unit != 'undefined') ? syncStyle.__sync_page_unit : -1;
$el.find('.sync-option').attr({
'data-sync-view': Number(sync_view),
'data-sync-view-t': Number(sync_view_t),
'data-sync-view-m': Number(sync_view_m),
'data-sync-space': Number(sync_space),
'data-sync-space-top': Number(sync_space_top),
'data-sync-height': Number(sync_height)
});
if(sync_page_unit > -1) {
$el.find('.sync-option').attr('data-sync-hidden', (Number(sync_page_unit) + 1));
if($el.find('.sync-page-label').length > 0) {
var sync_p_cnt = $el.find('.sync-row .sync-item').length,
sync_p_total = Math.ceil(sync_p_cnt / Number(sync_page_unit));
$el.find('.sync-page .sync-page-now').text(1);
$el.find('.sync-page .sync-page-total').text(sync_p_total);
if(sync_p_total == 1) $el.find('.sync-page-wrap').hide();
else $el.find('.sync-page-wrap').show();
}
}
}
}
if(checkGalleryView) {
if(c.page == 'fixedblock_'+b.PARENT.pid) $el.addClass('el-fixedblock');
else $el.removeClass('el-fixedblock');
$el.attr('data-pos', page_pos);
// if(b.LUX && (c.orgpos == '1' || $el.is('.lux-product-block'))) $el.attr('data-ppos', (c.pos*1) + 1);
// else $el.attr('data-ppos', c.pos);
$el.attr('data-ppos', c.pos);
$el.attr('data-posby', c.elnew);
}
if(b.ISLOCK == 'false') $el.removeClass('hide');
else $el.addClass('locked');
if(c.type == 'forum' || c.type == 'latest' || c.type == 'sync') $el.addClass('preloading');
//add style
var jcss = CSSJSON.toJSON(c.elcss),
elpd = style.getPadding(jcss,c.elname);
var elFonts = $el.css('font-family');
elFonts = elFonts + ",'Nanum Gothic'";
var reFonts = elFonts.replace(/"/g, "\'");
$el.css('font-family',reFonts);
var pt = parseInt(elpd.top),
pb = parseInt(elpd.bottom);
if(pt>0||pb>0){
default_t_css = default_t_css + '\n .'+c.elname + '{';
if(Math.ceil(pt*0.8)>0)
default_t_css = default_t_css + 'padding-top: '+Math.ceil(pt*0.8) + 'px!important;';
if(Math.ceil(pb*0.8)>0)
default_t_css = default_t_css + 'padding-bottom: '+Math.ceil(pb*0.8) + 'px!important;';
default_t_css = default_t_css + '}';
default_m_css = default_m_css + '\n .'+c.elname + '{';
if(Math.ceil(pt*0.5)>0)
default_m_css = default_m_css + 'padding-top: '+Math.ceil(pt*0.5) + 'px!important;';
if(Math.ceil(pb*0.5)>0)
default_m_css = default_m_css + 'padding-bottom: '+Math.ceil(pb*0.5) + 'px!important;';
default_m_css = default_m_css + '}';
}
if(idx == Object.keys(b.CONTENTS).length-1){
var css = '@media only screen and (max-width:767px) {' + default_t_css + '\n}\n';
css = css + '@media only screen and (max-width:480px) {' + default_m_css + '\n}';
if($('#el-paddingcss').length == 0) $('.dsgn-body').find('#el_'+(Object.keys(b.CONTENTS).length-1)+'css').after('');
else $('#el-paddingcss').append(css);
}
var settings = (c.elsettings == '' || typeof c.elsettings == 'undefined') ? {} : $.parseJSON(c.elsettings);
if(typeof settings.bookmark != 'undefined' && settings.bookmark) {
$el.attr('data-bookmark',c.seq);
}
if(b.VIEW && (c.type == 'project' || c.type == 'product')) {
$el.find('.data-page-prev').addClass('active');
$el.find('.data-page-next').addClass('active');
if(b.PARENT.prev == null) $el.find('.data-page-prev').removeClass('active');
if(b.PARENT.next == null) $el.find('.data-page-next').removeClass('active');
//상세페이지 배경 style 추가
if(c.type == 'project') setGalleryProjectCss(b.PARENT,b.PARENT['elcss']);
}
if(b.VIEW) {
var img_onoff = (typeof settings.img_original_display != 'undefined' && settings.img_original_display) ? settings.img_original_display : 'OFF';
$el.find('img[data-attach="true"]').attr('data-img-original',img_onoff);
}
var checkVideoTag = (c.type == 'video' || $el.find('video').length > 0) ? true : false;
if(checkVideoTag) {
if (navigator.userAgent.match(/(safari)/gi) !== null) {
$el.find('video').each(function() {
//safari...
$(this).attr('webkit-playsinline',1);
$(this).attr('playsinline',1);
});
}
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/gi) !== null) {
$el.find('video').each(function() {
$(this).removeAttr('muted');
$(this).removeAttr('loop');
$(this).removeAttr('autoplay');
$(this).removeAttr('preload');
});
}
}
//video block ::: gallery
if(c.type == 'video') {
if($el.find('.video-gallery-url').length>0) { //재생방식 : 확대보기
$.each($el.find('.item'),function(i,v){
if(c.mode=='zoom') appendGalleryFrame($(this).parents('.element'),c.seq,'',c.type);
});
}
}
if(c.type == 'forum') {
var page_num = 1
if (typeof $.cookie('forum_' + v.element.seq) != 'undefined' && $.cookie('forum_' + v.element.seq)) {
page_num = $.cookie('forum_' + v.element.seq);
}
_this.forumUpdate(v.element.seq, page_num, v.view, c.page, v.list);
} else if(c.type == 'gallery') {
_this.galleryEL[c.seq] = {
'seq' : c.seq,
'elname' : c.elname,
'eltag' : c.eltag,
'folder' : c.folder,
'mode' : c.mode,
'elsettings' : c.elsettings,
'feature' : c.feature,
'type' : c.type,
'type2' : c.type2,
'searches' : c.searches
};
_this.galleryUpdate(c,v);
if(c.only_category) {
localStorage.setItem('searches',JSON.stringify(new Array(c.searches.uri[0])));
}
if (typeof c.price_hidden != 'undefined' && c.price_hidden == 'ON') {
$el.find('.figure.price').html('');
}
} else if(c.type == 'sync') {
var sync_source = _this.syncUpdate($el,v.element);
$el.html(sync_source);
if($el.find('[data-sync-loop="true"]').length > 0) {
if(c.type2 == 'tab') $el.find('[data-sync-loop="true"] > li[data-list-no="1"]').attr('data-list-no','');
if(c.type2 == 'imgpitem' && sync_list_total > 0) $el.find('[data-sync-loop="true"] > li:not([data-idx])').remove();
$el.find('[data-sync-loop="true"] > li').eq(0).addClass('active').siblings().removeClass('active');
}
} else if(c.type == 'sns' && c.type2 == 'feed') {
$el.find('.data-feed-load-more').attr('data-feed-el',c.elname);
$el.find('.data-feed-load-more').removeAttr('style');
$el.find('.show-posts').removeClass('show-posts');
if(c.mode == 'site') {
if(!$.isEmptyObject(b.SOCIAL)) {
var load_sns = {};
if(!$.isEmptyObject(b.SOCIAL.instagram) && typeof settings.sns_instagram != 'undefined' && settings.sns_instagram == 'ON') load_sns['instagram'] = b.SOCIAL.instagram;
if(!$.isEmptyObject(b.SOCIAL.twitter) && typeof settings.sns_twitter != 'undefined' && settings.sns_twitter == 'ON') load_sns['twitter'] = b.SOCIAL.twitter;
if(!$.isEmptyObject(load_sns)) {
loadingElement(c.elname,'loading posts...');
updateFeed(c.elname,load_sns,function() {
$('.'+c.elname+' .listprogress').remove();
});
}
}
} else {
// SNS FEED:: before version
if(typeof settings.sns != 'undefined' && settings.sns.twitter) {
loadingElement(c.elname,'loading posts...');
updateFeed(c.elname,settings.sns);
}
}
} else if(c.type == 'others' && c.type2 == 'countdown') {
var el_dday = $el.find('[data-dday="true"]'),
cd_date = (el_dday.attr('data-countdown')) ? el_dday.attr('data-countdown') : new Date(),
dateformat = { days : '%D', hours: '%H', minutes: '%M', seconds: '%S' },
dateendformat = { days : '00', hours: '00', minutes: '00', seconds: '00' };
if( typeof settings.countdown != 'undefined' && settings.countdown ) { //set - block setting date
cd_date = settings.countdown;
}
if( !el_dday.attr('data-countdown') && typeof cd_date == 'object' ) { //set - example date
cd_date.setTime(cd_date.getTime() + (35*24*60*60*1000));
}
cd_date = moment(cd_date).format('YYYY/MM/DD HH:mm:ss');
el_dday.countdown(cd_date, function(event) {
$(this).find('.date-item[data-datetype]').each(function(i) {
var dd_type = $(this).attr('data-datetype'),
dd_format = $(this).attr('data-format'),
dd_endformat = $(this).attr('data-finish');
if(typeof dd_format == 'undefined' || !dd_format) dd_format = dateformat[dd_type];
if(typeof dd_endformat == 'undefined' || !dd_endformat) dd_endformat = dateendformat[dd_type];
if(event.elapsed) $(this).text(dd_endformat);
else $(this).text(event.strftime(dd_format));
});
});
} else if (c.type == 'latest') {
var latest_data = (typeof settings.latest_data != 'undefined' && settings.latest_data) ? settings.latest_data : {};
$.latest.init(c.seq,latest_data);
} else if (c.type == 'review') {
_this.galleryEL[c.seq] = {
'seq' : c.seq,
'elname' : c.elname,
'eltag' : c.eltag,
'folder' : c.folder,
'mode' : c.mode,
'elsettings' : c.elsettings,
'feature' : c.feature,
'type' : c.type,
'type2' : c.type2,
'searches' : c.searches
};
var gallery_data = (typeof settings.gallery_data != 'undefined' && settings.gallery_data) ? settings.gallery_data : {};
$.reviewContents.init(c.seq, gallery_data);
} else if (c.type == 'form') {
if(!is_templates && (!b.VALIDPLAN || b.VALIDTYPE == 'PK')) {
$el.html('').addClass('hide');
// $el.find("[form-type='file.upload'] label").on("click", function(e) {
// e.preventDefault();
// alert($.lang[LANG]['form.file.upload.disabled']);
// });
}
// if($("head").find("script[id='forms_js']").length == 0) {
// $("head").append("");
// } else {
$.forms.init(c.seq);
// }
}
//premium block : 요금제 없을 시 hide
var isPremiumBlock = (($.inArray(c.type, ['video','contact','contents']) > -1 && c.type2 == 'premium') ||
($.inArray(c.type, ['sns','forum']) > -1 && c.feature == 'premium') ||
(c.type == 'showcase' && c.feature == 'premium')) ? true : false;
// if(isPremiumBlock && (!b.VALIDPLAN || b.VALIDTYPE == 'PK')) $el.html('').addClass('hide');
if(isPremiumBlock && (!is_templates && (!b.VALIDPLAN || b.VALIDTYPE == 'PK'))) $el.html('').addClass('hide');
if($el.find('.slick').length > 0) {
if (c.type == 'sync' && typeof syncSlickFn == 'function') syncSlickFn('.' + c.elname);
else if($el.is('[data-clslick]') && typeof clSlickFn == 'function') clSlickFn('.' + c.elname);
}
if(data_aos_attr) {
$el.removeClass('aos-animate');
$el.addClass('render-aos');
setTimeout(function(){
$el.removeClass('render-aos').addClass('aos-animate');
})
$el.attr('data-aos-dummy', data_aos_attr)
}
changeBrokenImages($el);
idx++;
});
// $('.tag.preloading').replaceWith(function () {
// return $(this).html();
// });
$('.preloading').removeClass('preloading');
if(b.ISLOCK == 'true') {
$('.locked').remove();
return deferred.resolve({'showOnlyFooter':true});
}
if($('.element [data-map_kind="kakao"]').length && (typeof kakao == 'undefined' || typeof kakao.maps == 'undefined' || kakao.maps == null || property.VALIDPLAN == '')) {
$('.element [data-map_kind="kakao"]').html('지도연결해제됨. Javascript키 확인');
$('.element [data-map_kind="kakao"]').html('');
} else {
$('.element [data-map_kind="kakao"]').each(function() {
var container = this;
var lat = $(this).data("lat");
var lng = $(this).data("lng");
var options = { center: new kakao.maps.LatLng(lat, lng), level: 3};
var zoomInOut = $(this).data("zoominout");
var mapTitle = $(this).data("maptitle");
var mapContent = $(this).data("mapcontent");
var useTitle = $(this).data("usetitle");
var useContent = $(this).data("usecontent");
if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false;
if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = '';
if(typeof mapContent == 'undefined' || !mapContent) mapContent = '';
if(typeof useTitle == 'undefined' || !useTitle) useTitle = false;
if(typeof useContent == 'undefined' || !useContent) useContent = false;
var c_map = new kakao.maps.Map(container, options);
var marker = new kakao.maps.Marker({ position: new kakao.maps.LatLng(lat, lng), map: c_map});
if(zoomInOut == true) {
var zoomControlHtml = '';
zoomControlHtml += '\
\
';
var $zoomController = $(zoomControlHtml);
$(container).append($zoomController);
var zoom_slider = $zoomController.find('.zoom-control-slider').slider({
'orientation': 'vertical',
'min' : 1,
'max' : 14,
'step' : 1,
'value' : 3,
'handle' : 'dfafasdfas
',
// 'reversed' : true,
'tooltip' : 'hide',
}).on('slide', function(data) {
c_map.setLevel(data.value);
c_map.setCenter(marker.getPosition());
}).on('slideStop', function(data) {
c_map.setLevel(data.value);
c_map.setCenter(marker.getPosition());
});
$zoomController.find('.btn-zoom-control').on('click', function() {
if($(this).data('inout') == 'I') {
c_map.setLevel(c_map.getLevel() - 1);
zoom_slider.slider('setValue', c_map.getLevel());
} else if($(this).data('inout' == 'O')) {
c_map.setLevel(c_map.getLevel() + 1);
zoom_slider.slider('setValue', c_map.getLevel());
}
});
kakao.maps.event.addListener(c_map, 'zoom_changed', function() {
zoom_slider.slider('setValue', c_map.getLevel());
});
}
if((useTitle == true || useContent == true) && (mapTitle || mapContent)) {
var iwContent = '';
if(useTitle == true && mapTitle) {
iwContent = '' + mapTitle + '
';
}
if(useContent == true && mapContent) {
iwContent += '' + mapContent + '
';
}
if(iwContent) {
iwContent = '';
var infoWindow = $(iwContent);
$(container).append(infoWindow);
}
}
$(window).on("resize", function() {
c_map.relayout();
c_map.setCenter(marker.getPosition());
});
});
}
if($('.element [data-map_kind="naver"]').length && (typeof naver == 'undefined' || typeof naver.maps == 'undefined' || naver.maps == null || property.VALIDPLAN == '')) {
$('.element [data-map_kind="naver"]').html('지도연결해제됨. Client ID 확인');
$('.element [data-map_kind="naver"]').html('');
} else {
$('.element [data-map_kind="naver"]').each(function() {
var container = this;
var lat = $(this).data("lat");
var lng = $(this).data("lng");
var options = { center: new naver.maps.LatLng(lat, lng), zoom: 17};
var zoomInOut = $(this).data("zoominout");
var mapTitle = $(this).data("maptitle");
var mapContent = $(this).data("mapcontent");
var useTitle = $(this).data("usetitle");
var useContent = $(this).data("usecontent");
if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false;
if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = '';
if(typeof mapContent == 'undefined' || !mapContent) mapContent = '';
if(typeof useTitle == 'undefined' || !useTitle) useTitle = false;
if(typeof useContent == 'undefined' || !useContent) useContent = false;
var c_map = new naver.maps.Map(container, options);
var marker = new naver.maps.Marker({ position: new naver.maps.LatLng(lat, lng), map: c_map});
if(zoomInOut == true) {
var zoomControlHtml = '';
zoomControlHtml += '\
\
';
var $zoomController = $(zoomControlHtml);
$(container).append($zoomController);
var zoom_slider = $zoomController.find('.zoom-control-slider').slider({
'orientation': 'vertical',
'min' : 6,
'max' : 21,
'step' : 1,
'value' : 17,
'handle' : 'dfafasdfas
',
'reversed' : true,
'tooltip' : 'hide',
}).on('slide', function(data) {
c_map.setZoom(data.value);
c_map.setCenter(marker.getPosition());
}).on('slideStop', function(data) {
c_map.setZoom(data.value);
c_map.setCenter(marker.getPosition());
});
$zoomController.find('.btn-zoom-control').on('click', function() {
if($(this).data('inout') == 'I') {
c_map.setZoom(c_map.getZoom() + 1);
zoom_slider.slider('setValue', c_map.getZoom());
} else if($(this).data('inout' == 'O')) {
c_map.setZoom(c_map.getZoom() - 1);
zoom_slider.slider('setValue', c_map.getZoom());
}
});
naver.maps.Event.addListener(c_map, 'zoom_changed', function(zoom) {
zoom_slider.slider('setValue', c_map.getZoom());
});
}
if((useTitle == true || useContent == true) && (mapTitle || mapContent)) {
var iwContent = '';
if(useTitle == true && mapTitle) {
iwContent = '' + mapTitle + '
';
}
if(useContent == true && mapContent) {
iwContent += '' + mapContent + '
';
}
if(iwContent) {
iwContent = '';
var infoWindow = $(iwContent);
$(container).append(infoWindow);
}
}
$(window).on("resize", function() {
// c_map.relayout();
c_map.setCenter(marker.getPosition());
});
});
}
$('.element [data-map="true"]:not(iframe)').each(function() {
var map_url = $(this).attr('data-url');
if(typeof map_url != 'undefined' && map_url) {
var map_iframe = getMapURL(map_url,'html');
$(this).replaceWith(map_iframe);
if(map_iframe.indexOf('google-map disabled') === -1) $(this).next('.map-undefined').remove();
}
});
if($('.element a[data-popup][data-popup-name]').length > 0 && (!b.VALIDPLAN || b.VALIDTYPE == 'PK')) {
$('.element a[data-popup][data-popup-name]').addClass('disabled');
}
if($('.element[data-layout]').length > 0) {
setLayoutHeight();
}
$('.dsgn-body').fitVids();
deferred.resolve();
});
});
//parallax();
return deferred.promise();
},
setLoginout : function (show, sid, site, profileimg) {
if(show=='1') {
$.getJSON('/template/checkLogin', function(data) {
if(data.user && site) {
if($('#tpl-menu').find('.loginout')) $('#tpl-menu').find('.loginout').remove();
setLoginoutNav(sid, function() {
getProfileMember();
getProfileAuthor(sid,profileimg);
$('.el_0').css('margin-top','55px');
});
} else {
$('#tpl-menu').append('');
}
});
}
},
liveUpdate : function(obj) {
// console.log('liveUpdate');
var b = this.b;
var menu = $('#tpl-menu'),
idx = 0,
regex = /^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/,
regex2 = /^((http(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/;
menu.empty();
if($('.fmcss').length > 0) $('.fmcss').remove(); //forum background css
$.each(obj, function (idx, obj) {
if(obj.name == '전체상품') {
if(b.LUX || b.VALIDTYPE != 'SM' || !b.SLANG || (typeof b.SLANG.select_code !== 'undefined' && b.SLANG.select_code != 'ko')){
return true;
}
}
b.MENULIST.push(obj.name.replace(/ /g,'-'));
if(obj.children) {
$.each(obj.children, function (idx, obj){
b.MENULIST.push(obj.name.replace(/ /g,'-'));
});
}
});
if(b.ONE) {
linkUrl = (b.VIEW) ? '/#' : '#';
linkUrl = (b.VIEW && !b.PUBLISH) ? '/render/index#' : linkUrl;
} else {
linkUrl = (b.URL=='/') ? '/' : b.URL + '/';
}
for (i = 0; i < obj.length; i++) {
var link = obj[i].name;
if(link == '전체상품') {
if(b.LUX || b.VALIDTYPE != 'SM' || !b.SLANG || (typeof b.SLANG.select_code !== 'undefined' && b.SLANG.select_code != 'ko')) {
continue;
}
}
// IE ERROR_includes__H.20210603
// if(b.MENULIST.includes(link.replace(/ /g,'-'))) link = link.replace(/ /g,'-');
if($.inArray(link.replace(/ /g,'-'),b.MENULIST) > -1) link = link.replace(/ /g,'-');
var parent = b.PAGE.split(','),
link_text = '', target = '', isBookmark = '', isFlink = '';
if(i==0) {
if(obj[i].display=='on') {
b.MENUCHECK.intro = true;
b.MENULINK.push(link);
}
continue;
}
if(obj[i].name =='전체상품') {
obj[i].link = '';
}
var active = (link == b.PAGE || link == parent[0]) ? 'active' : '',
sub = obj[i].children.length;
if (obj[i].display == 'on') {
b.MENUCHECK.main = true;
var menuoption_child = [];
var checkLink = (obj[i].link) ? true : false,
checkLinkInner = (checkLink && $.inArray(obj[i].link.replace(/ /g,'-'), b.MENULIST) > -1) ? true : false,
checkLinkBookmark = (obj[i].link.match(/^\@/g) !== null) ? true : false,
checkLinkFile = (obj[i].link.match(/^flink\@[0-9]/gi) !== null) ? true : false;
link = (checkLink) ? ((checkLinkInner) ? obj[i].link.replace(/ /g,'-') : obj[i].link) : link;
isBookmark = (checkLinkBookmark) ? ' attr-bookmark="'+link.replace(/^\@/g,'')+'"' : '';
isFlink = (checkLinkFile) ? ' attr-flink="' + link.replace(/^flink\@/gi,'') + '"' : '';
target = (obj[i].ltarget == '_blank') ? 'target="_blank"' : '';
if(checkLink && !checkLinkInner && !checkLinkBookmark) { // link-type: link-out ==> a[attr-link]
if(checkBase64Encode(link)) link = Base64.decode(link);
}
if(link == 'folder-menu') {
link_text = 'javascript:;';
target = '';
if(typeof menu.closest('.navbar-menu-'+b.SID).attr('data-submenu') != 'undefined') target = ' data-toggle="dropdown" aria-expanded="false" data-submenu="true" ';
} else {
if(!checkLink) b.MENULINK.push(link);
// IE ERROR_includes__H.20210603
// link_text = (b.MENULIST.includes(link)) ? linkUrl + link : (!regex2.test(link) && regex.test(link)) ? '//'+link : link;
link_text = ($.inArray(link,b.MENULIST) > -1) ? linkUrl + link : (!regex2.test(link) && regex.test(link)) ? '//'+link : link;
}
if (sub) {
var sub_menu = '',
sub_show = 0;
sub_menu = '\r\n';
var caret = ($('header.navbar').hasClass('sidebar')) ? ' ' : ' ';
if (sub_show) {
var sub_menu_open = (typeof menu.closest('.navbar-menu-'+b.SID).attr('data-submenu') != 'undefined' && menu.closest('.navbar-menu-'+b.SID).attr('data-submenu') == 'open' && active != 'open') ? 'open' : '';
menu.append('\r\n\r\n');
} else {
menu.append('\r\n' + obj[i].name + '\r\n');
}
if(sub_show) menu.find('.dropdown:last').append(sub_menu);
} else {
menu.append('\r\n' + obj[i].name + '');
}
b.MENUOPTION.push({
'idx0': b.MENUOPTION.length,
'name': obj[i].name,
'active': active,
'href': link_text,
'target': target,
'isbookmark': isBookmark,
'isflink': isFlink,
'depth': 0,
'children': menuoption_child,
});
idx++;
}
}
// menu ver3 : fheader
// - Add #fixed-menu, #mobile-nav
// - Set mobile-design
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.init();
if( typeof b.VALIDPLAN != 'undefined' && b.VALIDPLAN &&
typeof b.VALIDTYPE != 'undefined' && b.VALIDTYPE != 'PK'
) {
if(b.VALIDTYPE == 'SM') {
$.umember.init(b.SITEUM,b.SITEUMLANG,b.SITEUMDISPLAY, function() {
$.psearch.init();
$.shopping.init();
$.slang.init(b.SLANG);
});
} else if(b.VALIDTYPE == 'BN') {
$.umember.init(b.SITEUM,b.SITEUMLANG,b.SITEUMDISPLAY, function() {
$.slang.init(b.SLANG);
});
} else {
$.slang.init(b.SLANG);
}
} else {
$.slang.init();
}
// menu ver3 : fheader
// - Set site page top padding
// - Set menu config btn position
if($('header.navbar').hasClass('navbar-fheader')) $.fheader.set();
$('header .navbar-nav').removeClass('hide').removeClass('preloading');
$('body,html').animate({scrollTop: 0}, 300,'easeInOutQuart');
},
syncUpdate : function($el,data) {
$('#el-empty').empty().append($el.outerHTML());
var $sync = $('#el-empty'),
nodes = $sync.find('.item'),
$sync_row = ($sync.find('.sync-option').length > 0) ? $sync.find('.sync-row') : $sync.find('.slick'),
$sync_loop = $sync.find('[data-sync-loop="true"]');
if(typeof data.sync !='undefined' && typeof data.sync.list != 'undefined' && (data.sync.list).length) {
$sync_row.empty();
var nodes_count = nodes.length;
$.each(data.sync.list, function(i,v) {
var nodes_pos = i % nodes_count,
$item = $(nodes[nodes_pos]);
var imgbg_check = (typeof $item.find('.img-bg').attr('style') == 'undefined') ? false : true;
$item.find('a').attr('href',(_this.b.PUBLISH) ? '/_product/' + v.seq : '/render/_product/' + v.seq);
$item.find('img').attr('src',v.image);
$item.find('.brand').text(v.brand_name);
$item.find('.name').text(v.title);
$item.find('.price').text('₩'+number_format(v.price));
if(imgbg_check) $item.find('.img-bg').attr('style','background-image: url("' + v.image + '"');
if(v.sale_rate > 0) $item.find('.sale').text(v.sale_rate + '%');
else $item.find('.sale').addClass('hidden');
if(v.sale > 0 && v.sale > v.price) $item.find('.price-sale').text('₩'+number_format(v.sale));
else $item.find('.price-sale').addClass('hidden');
if($item.find('.sync-label-number').length > 0) $item.find('.sync-label-number').text(i+1);
if(v.soldout) $item.find('.soldout').removeClass('hidden');
$sync_row.append($item.outerHTML());
if(data.type2 == 'imgpitem' && $sync_loop.length > 0) {
if($sync_loop.children('li').eq(i).length == 0) $sync_loop.append($sync_loop.children('li').eq(0).clone().removeClass('active'));
$sync_loop.children('li').eq(i).attr('data-idx',i);
}
});
}
var r = $('#el-empty > .element:eq(0)').html();
$('#el-empty').empty();
// console.log(r);
return r;
},
galleryUpdate : function(el,data) {
var is_templates = checkTemplateSite(this.b.SID);
if(el.type == 'gallery' && el.type2 == 'premium' && (!is_templates && (!this.b.VALIDPLAN || this.b.VALIDTYPE == 'PK'))) {
$('.element[data-id="' + el.seq + '"]').html('').addClass('hide');
return false;
}
var _this = this;
$('#el-empty').append($(data.source));
$('#el-empty').find('[data-loop="true"]').html('');
var checkGalleryListSample = false,
checkGalleryListEmpty = true,
source = data.source,
nodes = $(source).find('[data-loop="true"]').children('.grid'),
p = $('#el-empty').children(),
g = p.clone().removeClass().addClass('galleryPL'+el.seq).addClass('gallery-popup'),
i = [],
view = $(source).find('[data-loop="true"]').data('view'),
g_number = $(tag).find("[data-loop='true']").data('gallery-no'),
total = (typeof data.total != 'undefined' && data.total) ? data.total : 0;
$('#el-empty').after(g);
$(g).after('');
if(typeof view == 'undefined') view = 10;
var g_settings = (typeof el.elsettings == 'undefined' || el.elsettings == '') ? {} : $.parseJSON(el.elsettings),
cookie_page = 1,
cookie_view = view,
cookie_gallery_category = '',
is_gc_cookie = (typeof $.cookie('gallery-category-'+el.seq) != 'undefined' && $.cookie('gallery-category-'+el.seq).length > 0) ? true : false,
block_lang = (typeof g_settings.blocklang != 'undefined') ? g_settings.blocklang : LANG,
field_oldver = (typeof g_settings.field_oldver != 'undefined' && g_settings.field_oldver.length > 0) ? g_settings.field_oldver : [];
field_disable = (typeof g_settings.field_disable != 'undefined' && g_settings.field_disable.length > 0) ? g_settings.field_disable : [];
var cookie_gallery_orderby = 'recent';
var category_onoff = (typeof g_settings.category_display != 'undefined' && g_settings.category_display) ? g_settings.category_display : 'OFF';
var product_orderby_onoff = (typeof g_settings.product_orderby != 'undefined' && g_settings.product_orderby) ? g_settings.product_orderby : 'OFF';
var align_rnd_onoff = (typeof g_settings.align_rnd != 'undefined' && g_settings.align_rnd) ? g_settings.align_rnd : 'OFF';
if(el.mode != 'shopping') product_orderby_onoff = 'OFF';
// var adultonly_onoff = (typeof g_settings.adult_only != 'undefined' && g_settings.adult_only) ? g_settings.adult_only : 'OFF';
if( category_onoff == 'ON' &&
typeof $.cookie('ci_goto-gallery') != 'undefined' && $.cookie('ci_goto-gallery') == el.seq &&
typeof $.cookie('ci_goto-gallery-cate') != 'undefined' && g_settings.category.indexOf('|' + $.cookie('ci_goto-gallery-cate') + '|') > -1 &&
typeof g_settings.category != 'undefined' && g_settings.category
) {
cookie_gallery_category = $.cookie('ci_goto-gallery-cate');
is_gc_cookie = true;
} else if($.cookie('loadmore-' + el.seq)) {
cookie_page = $.cookie('loadmore-'+el.seq);
cookie_gallery_category = (typeof $.cookie('gallery-category-'+el.seq) != 'undefined') ? $.cookie('gallery-category-'+el.seq) : '';
cookie_gallery_orderby = (typeof $.cookie('gallery-orderby-' + el.seq) != 'undefined') ? $.cookie('gallery-orderby-' + el.seq) : '';
cookie_view = cookie_page * view;
} else {
var checkCateHomeHide = (category_onoff == 'ON' &&
typeof g_settings.category != 'undefined' && g_settings.category &&
typeof g_settings.category_home_hide != 'undefined' && g_settings.category_home_hide) ? true : false;
if(checkCateHomeHide) {
var gc = g_settings.category.replace(/\|/g,'').split(',');
cookie_gallery_category = gc[0];
is_gc_cookie = true;
$.cookie('gallery-catehome-' + el.seq, cookie_gallery_category, { path : '/', expires: 12 * 60 * 60 * 1000 });
}
}
if(el.seq == 'all_products') {
// cookie_page = (typeof $.cookie('gallery-page-all_products') !== 'undefined' && $.cookie('gallery-page-all_products') != '')? $.cookie('gallery-page-all_products') : 1;
cookie_gallery_category = setAllProductsCurrentCat(g_settings);
// cookie_view = cookie_page * view;
} else {
if(!property.VIEW) $.removeCookie('gallery-page-all_products', { path: '/' });
}
$.cookie('gallery-page-' + el.seq, cookie_page, { path : '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-category-' + el.seq, cookie_gallery_category, { path : '/', expires: 12 * 60 * 60 * 1000 });
$.cookie('gallery-orderby-' + el.seq, cookie_gallery_orderby, { path: '/', expires: 12 * 60 * 60 * 1000 });
$.removeCookie('loadmore-' + el.seq, { path : '/' });
var checkLoadmoreInLoop = ($(source).find('[data-loop="true"] .loadmore-wrap').length) ? true : false,
glm = $(source).find('.loadmore-wrap');
var el_gh = $(source).find('.goption').attr('data-gh'),
checkGalleryHeight = (typeof el_gh != 'undefined' && el_gh) ? true : false,
checkGallerySVG = ($(source).find('.gimg-svg-wrap').length > 0) ? true : false,
checkGFrameTitleOFF = (el.mode == 'gallery' && (typeof g_settings.gframe_title_visible != 'undefined' && g_settings.gframe_title_visible == 'OFF')) ? true : false;
var param = (el.page=='index,template' && property.param.indexOf('/org/') == -1) ? property.param + '/org/' + el.page : property.param;
var post_data = { g_mode: el.mode, visible: true, sfl: 'category', stx: cookie_gallery_category };
if(el.seq == 'all_products') {
post_data = { g_mode: el.mode, visible: true, sfl: 'orderby', stx: cookie_gallery_category };
}
var g_data = {
'list' : property.CONTENTS['el' + el.seq]['list'],
'total' : property.CONTENTS['el' + el.seq]['total']
}
var checkUseComment = checkUseCommentFunc(el.mode, el.eltag);
var checkUseLike = checkUseLikeFunc(el.mode, el.eltag);
$.each(g_data.list, function (idx, v) {
i.push(v);
});
total = (typeof g_data.total.list_total != 'undefined') ? g_data.total.list_total : g_data.total;
// total = (typeof g_data.total.list_total != 'undefined') ? g_data.total.list_total : 0;
cookie_view = (cookie_view < total) ? cookie_view : total;
if( total > 0 ) checkGalleryListEmpty = false;
if( i.length>0 || (i.length==0 && is_gc_cookie) ) {
var loop_count = nodes.length, item_index = 0, elem = [];
$.each(g_data.list,function(index,v) {
loop_pos = index%loop_count;
c = nodes[loop_pos];
var isTitle = (v.title.length > 0) ? true:false;
v.title = (v.title.length>0) ? v.title : $.lang[block_lang]['editor.block.gallery.sample.title'];
v.caption = (v.caption.length>0) ? v.caption : $.lang[block_lang]['editor.block.gallery.sample.caption'];
$(c).addClass('gallery-item').attr('data-index',index).attr('data-seq',v.seq);
var vgsettings = (typeof v.gsettings != 'undefined' && v.gsettings) ? $.parseJSON(v.gsettings) : {},
img_path = (typeof vgsettings['storage'] != 'undefined') ? vgsettings['storage'] : _this.b.RESOURCE + '/' + _this.b.SID + '/',
img_original = (typeof vgsettings['storage'] != 'undefined') ? img_path + '1920/' : img_path;
var folder = (typeof data.element.folder == 'undefined' || data.element.folder == 0) ? '' : data.element.folder + '/',
src = getServeImage(v.image,data.element.folder,img_path),
src_s0 = getServeImage(v.image,'0',img_path);
if($(c).find('img').length > 0) $(c).find('img').attr('src',src);
if(el.mode == 'shopping') {
if($(c).find('img').length > 0) $(c).find('img').attr('alt',v.title);
} else {
alt_replace = v.alt.replace(/\s+|\n+/g, '-');
alt_replace.replace(/-+/g, '-')
if($(c).find('img').length > 0) $(c).find('img').attr('alt',alt_replace);
}
if($(c).find('.g-img').length > 0) $(c).find('.g-img').css('background-image', 'url('+src+')');
if(checkGallerySVG) {
var gimgSVG = $(c).find('.gimg-svg-wrap svg');
gimgSVG.find('pattern').attr('id','gimgSvg_'+el.elname+'_'+index);
gimgSVG.find('image').attr('xlink:href', src);
gimgSVG.find('polygon').attr('fill', 'url(#gimgSvg_'+el.elname+'_'+index+')');
}
var glink = (typeof vgsettings['glink'] != 'undefined' && vgsettings['glink']) ? vgsettings['glink'] : '',
glink_target = (typeof vgsettings['glink_target'] != 'undefined' && vgsettings['glink_target']) ? vgsettings['glink_target'] : '';
if(glink) {
if(glink.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark]
var bookmark_seq = glink.replace(/^\@/g,'');
if(typeof _this.b.SETTINGS.blockBookmarkList == 'undefined' || typeof _this.b.SETTINGS.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') {
glink = '';
glink_target = '';
}
} else if(glink.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink]
glink_target = '';
} else if($.inArray(glink.replace(/^\//g,'').replace(/ /g,'-'),_this.b.MENULIST) > -1) { // link-type: link-menu ==> a[data-user-link]
} else { // link-type: link-out ==> a[attr-link]
if(checkBase64Encode(glink)) glink = Base64.decode(glink);
}
}
$(c).find('a').removeAttr('data-gallery').removeAttr('data-user-link').removeAttr('attr-bookmark').removeAttr('attr-link').removeAttr('attr-flink');
if (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON' && property['SITEUM'] >= 1) {
$(c).addClass('gallery-item').addClass('nonePrice');
$(c).find('a').attr('href', '#');
} else {
if(glink) {
var glink_val = makeLinkUrl(glink, _this.b.ONE, _this.b.VIEW);
$(c).find('a').attr('href',glink_val);
if(glink.match(/^\@/g) !== null) {
$(c).find('a').attr('attr-bookmark',glink.replace(/^\@/g,''));
} else if(glink.match(/^flink\@[0-9]/g) !== null) {
$(c).find('a').attr('attr-flink',glink.replace(/^flink\@/g,''));
// IE ERROR_includes__H.20210603
// } else if(_this.b.MENULIST.includes(glink.replace(/ /g,'-'))) {
} else if($.inArray(glink.replace(/ /g,'-'),_this.b.MENULIST) > -1) {
$(c).find('a').attr('data-user-link',glink_val);
} else {
$(c).find('a').attr('attr-link',glink);
}
} else {
if (el.mode == 'gallery') {
src_s0 = src_s0 + '?gpos='+v.pos;
$(c).find('a').attr('href', src_s0);
$(c).find('a').attr('data-gallery', '#gframe-' + el.seq);
} else {
if(el.seq == "all_products") {
$(c).find('a').attr('href', v.product_url);
} else {
if(typeof URI == 'function') URI = '/';
if(_this.b.LUX && el.mode == 'shopping') $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/_product/' + v.seq);
else $(c).find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/' + _this.b.PAGE + '/view/' + v.seq);
}
}
}
}
if(glink_target == '_blank') $(c).find('a').attr('target','_blank');
else $(c).find('a').removeAttr('target');
if(checkGFrameTitleOFF || !isTitle) $(c).find('a').attr('data-title', '');
else $(c).find('a').attr('data-title', v.title);
// if(adultonly_onoff == 'ON') $(c).addClass('adultonly');
if(el.mode == 'shopping') {
if($(c).find('.figure.basket').length == 0) {
$(c).find('.figure').last().after('장바구니 담기
');
}
}
// caption
var ftitle = $(c).find('h5.figure'),
fcaption = $(c).find('p.figure').not('.comment'),
fdatetime = $(c).find('.figure.datetime'),
fhashtag = $(c).find('.figure.hashtag'),
fbrand = $(c).find('.figure.brand'),
fprice = $(c).find('.figure.price'),
freview = $(c).find('.figure.review'),
fcomment = $(c).find('.figure.comment'),
flike = $(c).find('.figure.like'),
fbasket = $(c).find('.figure.basket');
if(fcomment.length < 1 && g_settings.comment_display == 'ON' && checkUseComment) {
$(c).find('figcaption p.figure.caption').after('');
fcomment = $(c).find('.figure.comment');
}
if(flike.length < 1 && g_settings.like_display == 'ON' && checkUseLike){
if (fcomment.length > 0) {
if(index == 0) fcomment.after('');
else fcomment.after('');
} else {
if(index == 0) $(c).find('figcaption:not(.top) .figure:last-child').after('');
else $(c).find('figcaption:not(.top) .figure:last-child').after('');
}
flike = $(c).find('.figure.like');
}
$(c).find('figcaption').removeClass('hide');
if (v.title || v.caption) {
var gallery_caption = v.caption;
gallery_caption = gallery_caption.trim().replace(/\n/g,'
');
ftitle.html(v.title);
fcaption.html(gallery_caption);
if(fdatetime.length > 0) fdatetime.text(v.datetime);
if(fhashtag.length > 0) fhashtag.text(v.hashtag);
}
if(g_number) {
var g_index = String(index + 1),
g_num = g_index.padStart(g_number, '0');
$(c).find('.figure.number').text(g_num);
}
if(fbrand.length > 0) {
var fbrand_name = (typeof v.brand_name != 'undefined' && v.brand_name) ? v.brand_name : '';
fbrand.html(v.brand_name);
}
if(el.mode == 'shopping' || el.seq == 'all_products') {
fcomment.addClass('hide');
flike.addClass('hide');
v.price = typeof v.price != 'undefined' ? parseFloat(v.price) : 0;
v.sale = typeof v.sale != 'undefined' ? parseFloat(v.sale) : 0;
var checkPriceHidden = (typeof v.price_hidden != 'undefined' && v.price_hidden == 'ON') ? true : false,
gallery_price = (v.price && !checkPriceHidden) ? v.price : 0,
gallery_sale_price = (typeof v.sale != 'undefined' && v.sale > 0 && v.sale > v.price && !checkPriceHidden) ? v.sale : 0,
gallery_sale_per = (typeof v.sale_per != 'undefined' && v.sale_per && !checkPriceHidden) ? v.sale_per : '',
product_soldout = '품절',
product_no_sale = (typeof g_settings.sh_soldout == 'string') ? g_settings.sh_soldout : '구매불가',
product_status = '';
if(v.status == 'off' && !checkPriceHidden) {
product_status = '' + product_no_sale + '';
} else if(v.quantity_on == 'on' && v.quantity < 1 && !checkPriceHidden) {
product_status = '' + product_soldout + '';
}
$(c).find('.cl-sh-soldout').remove();
if(product_status != '') $(c).attr('data-soldout',true);
else $(c).removeAttr('data-soldout');
$(c).find('.product-badge').remove();
product_status += drawBadgeList(v.use_badge, data.badge_settings);
$(c).find('.cl-sh-limit').remove();
if(v.status == 'lim') {
if(v.sale_now == false) {
var product_limit = '상품 구매 가능 기간이 아닙니다.
';
if(freview.length > 0) {
freview.after(product_limit);
} else {
$(c).find('figcaption:not(.top) .figure:last-child').after(product_limit);
}
}
}
if($(c).find('ul.figure.price').length > 0) {
// var price_off = (v.sale_price > 0 && v.sale_price > v.price) ? 100 - Math.floor((v.price / v.sale_price) * 100) : 0,
// off_str = (price_off > 0) ? price_off + '% ' : ''
var off_str = (v.sale_rate > 0) ? v.sale_rate + '% ' : '';
if(!_this.b.LUX) off_str = gallery_sale_per;
//Ver2
if(!checkPriceHidden) {
$(c).find('ul.figure.price .price-val').html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-val').removeClass('hide');
if(gallery_sale_price > 0 && gallery_price < gallery_sale_price) {
$(c).find('ul.figure.price .price-sale').html('₩' + gallery_sale_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,','));
$(c).find('ul.figure.price .price-sale-per').html(off_str);
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').removeClass('hide');
if(_this.b.LUX && (v.hashtag).indexOf('특가세일') > -1 && $(c).find('ul.figure.price .sp-price').length == 0) {
$(c).find('ul.figure.price .price-sale').after('특가세일');
}
} else {
$(c).find('ul.figure.price .price-sale, ul.figure.price .price-sale-per').addClass('hide').html('');
}
} else {
$(c).find('ul.figure.price .price-val').html('₩0');
$(c).find('ul.figure.price .price-val').removeClass('hide');
}
if(el.seq == 'all_products' && checkPriceHidden) $(c).find('ul.figure.price').html('');
if(product_status) $(c).find('ul.figure.price').append(''+product_status+'');
var badge_size = getBadgeSize(data.badge_settings);
$(c).find('.cl-sh-soldout').removeClass('badge-small badge-medium badge-large');
$(c).find('.cl-sh-limit').removeClass('badge-small badge-medium badge-large');
if(badge_size) {
$(c).find('.cl-sh-soldout').addClass(badge_size);
$(c).find('.cl-sh-limit').addClass(badge_size);
}
} else {
//Ver1
if(fprice.length == 0) fprice = fcaption;
if(checkPriceHidden) fprice.html('');
else fprice.html('₩' + gallery_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g,',') + product_status);
}
if($(c).find('ul.figure.review').length > 0) {
var gallery_review = (v.review_onoff && v.review_cnt) ? v.review_cnt : 0;
if(gallery_review > 0) {
$(c).find('ul.figure.review, ul.figure.review li').removeClass('hide');
$(c).find('ul.figure.review .figure-review-cnt').html(gallery_review);
$(c).find('ul.figure.review .figure-review-score').html(v.review_score);
} else {
$(c).find('ul.figure.review, ul.figure.review li').addClass('hide');
$(c).find('ul.figure.review .figure-review-cnt, ul.figure.review .figure-review-score').html('');
}
}
if(fbasket.length > 0) {
var checkOldBlock = ($(c).find('.figure.basket[data-oldver="true"]').length > 0) ? true : false,
checkOldverBasket = (typeof field_oldver != 'undefined' && field_oldver && field_oldver.indexOf('basket') > -1) ? true : false,
checkDisabledBasket = (typeof field_disable != 'undefined' && field_disable && field_disable.indexOf('basket') > -1) ? true : false;
if(v.basket_off) fbasket.addClass('cannotby hide');
else if(el.seq == 'all_products') fbasket.removeClass('hide');
else if(checkDisabledBasket || (!checkDisabledBasket && checkOldBlock && !checkOldverBasket)) fbasket.addClass('hide');
else if(property.VALIDTYPE != 'SM') fbasket.addClass('hide');
else fbasket.removeClass('hide');
}
} else {
fbrand.addClass('hide');
fprice.addClass('hide');
freview.addClass('hide');
fbasket.addClass('hide');
if(el.mode == 'project' && fcomment.length > 0 && typeof v.comment_cnt != 'undefined' && v.comment_cnt > 0 && g_settings.comment_display == 'ON') {
fcomment.find('.figure-comment-cnt').html(v.comment_cnt);
if(field_disable !== undefined && field_disable.indexOf('comment') > -1) {
fcomment.addClass('hide');
} else {
fcomment.removeClass('hide');
}
} else {
fcomment.addClass('hide');
}
if(flike.length > 0 && g_settings.like_display == 'ON' && checkUseLike) {
flike.removeAttr('data-like').removeClass('hide active');
if(v.like !== undefined) {
flike.find('.figure-like-cnt').html(v.like.cnt);
if(v.like.own) flike.attr('data-like', v.seq).addClass('active');
}
if(field_disable !== undefined && field_disable.indexOf('like') > -1) {
flike.addClass('hide');
} else {
flike.removeClass('hide');
}
} else {
flike.addClass('hide');
}
}
if(checkUseLike == false) flike.html('');
var on_figure_total = $(c).find('figcaption .figure:not(.hide, .review[data-review_cnt="false"][data-review_score="false"])').length;
if(on_figure_total > 0) $(c).find('figcaption').addClass('allhide');
else $(c).find('figcaption').removeClass('allhide');
// $(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
if(el.mode == 'gallery') {
if(index < data.view) {
$(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
} else {
$(c).find('figure').remove();
$(g).find('[data-loop="true"]').append($(c)[0].outerHTML);
}
if (total == 2) {
$(c).find('figure').remove();
$('.gallery-empty').append($(c)[0].outerHTML);
}
} else {
$(p).find('[data-loop="true"]').append($(c)[0].outerHTML);
}
});
} else {
checkGalleryListSample = true;
if(_this.b.LUX) {
category_onoff = 'ON';
checkGalleryListSample = false;
}
if(el.mode=='project' && _this.b.TEMPLATE == false) {
nodes.addClass('gallery-item');
nodes.find('a').attr('href', ((_this.b.URL=='/') ? '' : _this.b.URL) + '/' + _this.b.PAGE + '/view/template').removeAttr('data-gallery').find('img').attr('data-index',0);
}
if(_this.b.TEMPLATE !== false) {
if(g_settings.comment_display != 'ON' || (field_disable !== undefined && field_disable.indexOf('comment') > -1)) nodes.find('.figure.comment').addClass('hide');
else nodes.find('.figure.comment').removeClass('hide');
if(g_settings.like_display != 'ON' || (field_disable !== undefined && field_disable.indexOf('like') > -1)) nodes.find('.figure.like').addClass('hide');
else nodes.find('.figure.like').removeClass('hide');
}
$(p).find('[data-loop="true"]').append(nodes);
}
if(checkLoadmoreInLoop) $(p).find('[data-loop="true"]').append(glm);
var tag = $(p)[0].outerHTML,
$galleryEL = $('.element[data-id="' + el.seq + '"]');
if (el.mode == 'gallery' && total == 2) {
$.each($('.gallery-empty').find('.gallery-item'), function(i,v) {
$(g).find('[data-loop="true"]').append(v);
});
}
if (el.mode == 'gallery' && total) tag = appendGalleryFrame($(tag), el.seq, g_settings, '', el.elcss);
$galleryEL.html($(tag).html()).removeClass('preloading');
$('#el-empty').empty();
$('.gallery-empty').remove();
var $tag = $galleryEL.find('.shop-filter-header');
if($tag.length) shopHeaderDisplay($tag,data);
$galleryEL.attr('data-category',category_onoff);
$galleryEL.attr('data-product-orderby', product_orderby_onoff);
$galleryEL.attr('data-align-rnd', align_rnd_onoff);
if(category_onoff == 'ON' || product_orderby_onoff == 'ON') {
loadGalleryCategoryBlock($galleryEL,el.seq,g_settings);
if(!checkGalleryListSample) {
$galleryEL.find('.empty-txt').remove();
$galleryEL.find('.container:not(.fh-container),[data-loop="true"]').removeClass('empty');
if(checkGalleryListEmpty) {
var empty_info = (el.seq == 'all_products') ? $.lang[LANG]['editor.gallery.product.empty.list'] : $.lang[LANG]['editor.gallery.category.empty.list'],
empty_info = (_this.b.LUX) ? $.lang[LANG]['editor.gallery.product.empty.list'] : empty_info,
gallery_empty_str = '' + empty_info + '
';
if(el.feature=='masonry') {
$galleryEL.find('.container:not(.fh-container)').removeAttr('style').addClass('empty').append(gallery_empty_str);
} else {
$galleryEL.find('[data-loop="true"]').addClass('empty').empty().append(gallery_empty_str);
}
}
}
}
if($galleryEL.find('.goption[data-gcol]').length > 0) {
var gOption = $galleryEL.find('.goption[data-gcol]'),
gcol = gOption.attr('data-gcol'),
gcol_t = gOption.attr('data-gcol-t'),
gcol_m = gOption.attr('data-gcol-m');
if(typeof gcol_t == 'undefined') { gOption.attr('data-gcol-t',gcol); gcol_t = gcol; }
if(typeof gcol_m == 'undefined') { gOption.attr('data-gcol-m',gcol_t); }
}
refreshGalleryField($galleryEL,g_settings);
// gallery option - gh
if ($galleryEL.find('.goption[data-gh]').length > 0) refreshGalleryHeight(el.elname);
var $glmBtnWrap = $galleryEL.find('.loadmore-wrap'),
$glmBtn = $galleryEL.find('.loadmore-wrap .gallery-loadmore'),
checkLoadmore = (total > view && total > cookie_view && !checkGalleryListEmpty) ? true : false,
glm_lang = LANG;
if(typeof g_settings.loadmore_lang != 'undefined' && g_settings.loadmore_lang && $.inArray(g_settings.loadmore_lang.toLowerCase(), ['ko','en']) > -1) glm_lang = g_settings.loadmore_lang.toLowerCase();
else if(typeof block_lang != 'undefined' && $.inArray(block_lang, ['ko','en']) > -1) glm_lang = block_lang;
var glm_txt = $.lang[glm_lang]['config.loadmore'];
if($glmBtnWrap.length == 0) {
// gallery loadmore btn - default (ver1)
if(checkLoadmore) {
var glm_class = (el.feature=='masonry') ? 'gallery-loadmore masonry-layout' : 'gallery-loadmore',
glm_btn = '' + glm_txt +' (' + cookie_view + ' / ' + number_format(total) + ')
';
if($galleryEL.find('.gallery-loadmore').length > 0) $galleryEL.find('.gallery-loadmore').replaceWith(glm_btn);
else $galleryEL.append(glm_btn);
} else $galleryEL.find('.gallery-loadmore').remove();
} else {
// gallery loadmore btn - custom (ver2)
if(checkLoadmore) {
if(el.feature=='masonry') $glmBtn.addClass('masonry-layout');
else $glmBtn.removeClass('masonry-layout');
$glmBtn.attr('data-loadmore','true').attr('data-id',el.seq).attr('data-total',total).attr('data-page',Number(cookie_page)+1).attr('data-view',view).attr('data-folder',el.folder).attr('data-mode',el.mode);
$glmBtn.find('.label').text(glm_txt);
$glmBtn.find('.display .view').text(cookie_view);
$glmBtn.find('.display .total').text(total);
$glmBtnWrap.removeClass('hide').fadeIn();
} else {
$glmBtnWrap.fadeOut().addClass('hide');
$glmBtn.removeAttr('data-loadmore').removeAttr('data-id').removeAttr('data-total').removeAttr('data-page').removeAttr('data-view').removeAttr('data-folder').removeAttr('data-mode').removeClass('masonry-layout');
$glmBtn.find('.label').text(glm_txt);
$glmBtn.find('.display .view').text('0');
$glmBtn.find('.display .total').text('0');
}
}
if($galleryEL.is('[data-type2="premium"]')) setGalleryJS('load-loop',$galleryEL);
if(el.seq == 'all_products') {
if(property.ONE) $galleryEL.addClass('link-to-전체상품');
loadAllproductSort($galleryEL, g_settings, el.total.list_total);
}
if(el.feature=='masonry') this.refreshMasonry(el.elname);
},
forumUpdate : function(pid,page_num,view,page,data) {
if(page_num > 1) {
$.forum.init(pid, page, view, page_num,'', '', '');
} else {
$.forum.update(pid, page_num, view, page, '', '', '',data);
}
},
refreshMasonry : function(el) {
var $container = $('.'+el+' .container');
$container.imagesLoaded(function () {
$container.masonry({
itemSelector: '.grid',
columnWidth: '.grid'
});
$container.masonry();
$container.find('img').off('load.'+el).on('load.'+el, function () {
$container.masonry();
});
});
},
displayComment : function() {
var checkUrl = this.b.PAGE.split(','),
type = (checkUrl[0] == 'forum') ? 'F' : 'P',
check_view_empty = (this.b.VIEW && this.b.COUNT == 1 && $('.error_404.element[data-name="error_404"]').length == 1) ? true : false;
if(type == "P" && (this.b.COUNT == 0 || check_view_empty)) {
$('.error_404.element[data-name="error_404"] *[data-lang]').each(function() {
$(this).html($.lang[LANG][$(this).attr('data-lang')]);
});
return false;
}
var option = (this.b.PARENT.settings) ? jQuery.parseJSON(this.b.PARENT.settings) : {};
if(type == 'F') {
var fv_settings = {};
$.ajax({
url: '/fm/fmConfig',
dataType: 'json',
type: 'POST',
data: { id : this.b.VIEW },
async: false,
cache: false,
success: function (fr_data) {
var fmConf = fr_data.config;
var comment_display = 'OFF';
if(typeof fmConf.fm_settings.comment_display == 'undefined') {
comment_display = (typeof fmConf.elsettings.comment_display == 'undefined')? 'OFF':fmConf.elsettings.comment_display;
} else {
comment_display = fmConf.fm_settings.comment_display;
}
fv_settings = {comment_display : comment_display}
}
});
if(fv_settings.comment_display == 'OFF') return false;
} else {
if(typeof option.comment_display == 'undefined' || !option.comment_display || option.comment_display=='OFF') return false;
}
$.comment.init();
},
loaded : function() {
var b = _this.b;
if($('body').width() <= 768 && $('.dsgn-body').hasClass('sidebar')) {
if($('header.navbar').hasClass('sidebar')) {
cssSidebar('off');
}
//$('.dsgn-body').removeClass('sidebar').addClass('removed-sidebar');
} else if ($('body').width() > 768 /*&& $('.dsgn-body').hasClass('removed-sidebar')*/) {
if($('header.navbar').hasClass('sidebar')) {
cssSidebar('on');
}
//$('.dsgn-body').removeClass('removed-sidebar').addClass('sidebar');
}
$('.carousel').live('click',function(){
$('.carousel').carousel('cycle');
});
$('.carousel').live({
click: function() {
$('.carousel').carousel('cycle');
},
hover: function(){
$('.carousel').carousel('cycle');
}
});
$('.carousel').carousel({
pause: 'none'
});
$('[data-fixed-width]').each(function() {
$(this).css('width',$(this).attr('data-fixed-width')+'px');
});
SCREEN = getScreen();
var targetUrl = document.URL,
isMoveLink = targetUrl.match(/#/g);
$('.menu-logo-top').show();
if(typeof $.cookie('gallery-item') != 'undefined' && b.VIEW == '') {
moveGallery($.cookie('gallery-item'));
} else if(typeof $.cookie('forum-item') != 'undefined' && b.VIEW == '') {
// console.log('loaded', 'fm_view', $.cookie('forum_content_view'));
if(typeof $.cookie('forum_content_view') != 'undefined'){
var fm_view = $.cookie('forum_content_view');
var fv = (fm_view !== undefined && fm_view)? fm_view.split('&'):array();
var pid = (fv)? fv[0]:'';
var row_id = (fv)? fv[1]:'';
setTimeout(function(){
scrollToBlock('.element[data-id="' + pid + '"] .tpl-forum-list-title[data-id="'+row_id+'"]', 1000);
}, 500);
$.removeCookie('forum-item', { path : '/' });
$('.element[data-id="' + pid + '"] .tpl-forum-list-title[data-id="'+row_id+'"]').click();
} else {
scrollToBlock('.element[data-id="' + $.cookie('forum-item') + '"]', 1000);
$.removeCookie('forum-item', { path : '/' });
}
}
if($('body').width() > 768) {
$('.form-date').attr('type','text');
$('.form-date').attr('maxlength','2');
$('.date-yyyy').attr('maxlength','4');
}
$.modalOFF();
},
loadPage : function(page) {
}
}
var aosAddblock = function(site_settings,settings,$el) {
if($el.is('[data-type="gallery"][data-type2="premium"]')) {
$el.attr('data-aosinfo',false);
return false;
}
var block_aos_site = (typeof site_settings.block_aos != 'undefined' && site_settings.block_aos) ? site_settings.block_aos : {},
block_aosAll_site = (typeof block_aos_site['all'] != 'undefined' && block_aos_site['all']) ? block_aos_site['all'] : {},
aos_time_site = (typeof block_aosAll_site.t != 'undefined' && block_aosAll_site.t) ? block_aosAll_site.t : '',
aos_motion_site = (typeof block_aosAll_site.m != 'undefined' && block_aosAll_site.m) ? block_aosAll_site.m : '',
aos_duration_site = (typeof block_aosAll_site.d != 'undefined' && block_aosAll_site.d) ? block_aosAll_site.d : '700';
var block_aos_page = (typeof settings.block_aos != 'undefined' && settings.block_aos) ? settings.block_aos : {},
aos_time_page = (typeof block_aos_page.t != 'undefined' && block_aos_page.t) ? block_aos_page.t : '',
aos_motion_page = (typeof block_aos_page.m != 'undefined' && block_aos_page.m) ? block_aos_page.m : '',
aos_duration_page = (typeof block_aos_page.d != 'undefined' && block_aos_page.d) ? block_aos_page.d : '700';
if(block_aos_site && (aos_time_site > aos_time_page) && aos_motion_site!='no-motion' &&
$('body').find('.menu-lock-block').length<1 && $('body').find('.site-lock-block').length<1) {
$el.attr('data-aos',aos_motion_site)
.attr('data-aos-duration',aos_duration_site)
if(aos_motion_site == 'fade-zoom-in' || aos_motion_page =='fade-zoom-in') {
$el.attr('data-aos-easing','ease-in-back');
}
isAosBlock = true;
$el.attr('data-aosinfo',true);
} else {
if($.isEmptyObject(block_aos_page) == false && (aos_time_site < aos_time_page) && aos_motion_page!='no-motion' &&
$('body').find('.menu-lock-block').length<1 && $('body').find('.site-lock-block').length<1) {
$el.attr('data-aos',aos_motion_page)
.attr('data-aos-duration',aos_duration_page);
if(aos_motion_site == 'fade-zoom-in' || aos_motion_page =='fade-zoom-in') {
$el.attr('data-aos-easing','ease-in-back');
}
isAosBlock = true;
$el.attr('data-aosinfo',true);
} else $el.attr('data-aosinfo',false);
}
}
var mobileWebfnavCheck = function(vpmode) {
var checkFnav = ($('.fnav').length > 0 && vpmode=="mobile_web") ? true : false,
WebType = isMobile();
if(checkFnav && WebType) {
$('.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');
}
if(WebType) {
$('.element.el-footer').addClass('mpcwebheight');
$.mpcWeb.mpcMusicandGoTop(checkFnav,vpmode);
}
}
var setlimitdiskPopup = function() {
var icon = '',
str = '\
'+$.lang[LANG]['plan.disk-space.popup.limit.contents']+'
\
\
';
$(this).showModalFlat(icon + $.lang[LANG]['plan.disk-space.popup.limit.title'], str,false,false).addClass('flat-site-spacelimit-modal');
$('.modal-backdrop.in').css('opacity','0');
}
var setSitePopup = function() {
if(typeof property.SETTINGS != 'undefined' && property.SETTINGS.showPopup === true && typeof property.SETTINGS.sitePopup != 'undefined' && property.SITELOCK != 'true') {
sitePopupOpen();
}
}
var sitePopupOpen = function(idx,data) {
var site_popup = (typeof data != 'undefined' & data) ? data : new Array();
if(site_popup.length == 0) site_popup = (typeof property.SETTINGS.sitePopup != 'undefined' && property.SETTINGS.sitePopup) ? property.SETTINGS.sitePopup : site_popup;
if(site_popup.length > 0) {
$('.refresh-popup').show().removeAttr('style');
var isShow = true;
if(typeof idx != 'undefined') {
if($('#'+property.SID+'Popup'+idx).length == 0) isShow = false;
else $('#'+property.SID+'Popup'+idx).fadeIn();
} else {
if($('.site-popup .modal-popup').length > 0) {
$('.site-popup .modal-popup').fadeIn();
} else {
isShow = false;
}
}
if(!isShow) {
var modal = $(this).showPopupModal(site_popup,property.SID);
return modal;
}
}
}
var sitePopupResize = function() {
if($('.popup').find('.modal-popup').length == 0) return false;
var img_w = new Array(),
total_w = 0,
add_w = 0,
d_m = ($('.popup-modal').hasClass('popupimg-overflow-y')) ? 30 : 15;
d_top = $('.header.el-menu').outerHeight() + 15,
d_left = 0,
x = 0, y = 0, y_r = 0;
$('.modal-popup').each(function(i) {
if($(this).css('display') != 'none') {
img_w[i] = $(this).width();
total_w += img_w[i] + d_m;
}
});
var isOverflow = ($('.dsgn-body').width() < (Number($('.popup-modal').children().eq(0).css('left').replace('px',''))+total_w)) ? true : false,
display_i = -1;
if(isOverflow) { $('.popup-modal').addClass('popupimg-overflow-y');
} else { $('.popup-modal').removeClass('popupimg-overflow-y'); }
$('.modal-popup').each(function(i) {
if($(this).css('display') != 'none') {
display_i++;
if(isOverflow) {
x = (display_i==0) ? d_top : d_top + (display_i*30);
y = d_left + ((display_i+1)*30);
y_r = 120 - y;
img_w[i] = 'auto';
} else {
d_left = ($('.dsgn-body').width() - total_w)/2;
x = d_top;
y = d_left + add_w + (i*15);
}
add_w = add_w + $(this).width();
var css_val = (isOverflow) ? {'top': x +'px', 'left': y+'px', 'right': y_r+'px', 'margin-left': '0px', 'width': img_w[i], 'max-width': $(this).width()} : {'top': x +'px', 'left': y+'px' , 'width': img_w[i]};
$(this).css(css_val);
}
});
}
var activeEL = function(el) {
if(typeof el == 'undefined' || el=='') return;
// header_fixed = $('header.navbar').height();
// var offset = ($('.dsgn-body').hasClass('sidebar')) ? 0 : -header_fixed;
// $('body').scrollTo('.'+el,0,{offset:offset});
scrollToBlock('.'+el);
}
var setLoginoutNav = function (sid, callback) {
$('.creatorlink-header').remove();
$('#tpl-menu li.loginout').remove();
var str = '\n';
str = str + '\n';
str = str + '\n';
$('.header.el-menu').before(str);
var top = ($('header').hasClass('transparent')) ? '0' : '55px';
$('.header.el-menu').css('top',top);
if(top == '0') $('.creatorlink-header + .popover + .fixed-position').css('top','0');
if(typeof callback == 'function') callback();
}
var getProfileAuthor = function(sid,img) {
var imgstr = (img == 'https://storage.googleapis.com/i.addblock.net/member/profile_default.jpg') ? 'https://storage.googleapis.com/i.addblock.net/member/profile_default_top.png' : img;
var str = '\n';
str = str + ' \n';
str = str + '\n';
$('.data-site .profile-img').append(str);
}
var getProfileMember = function() {
$.getJSON('/template/checkLogin', function(data) {
// if(!data.user) { }
var imgstr = (data.myimg == 'https://storage.googleapis.com/i.addblock.net/member/profile_default.jpg') ? 'https://storage.googleapis.com/i.addblock.net/member/profile_default_top.png' : data.myimg;
var str = '\n';
str = str + ' \n';
str = str + '\n';
$('.data-user .profile-img').append(str);
$('.data-user .profile-img').addClass('user-'+data.name);
$('.data-user .user-name').append(''+data.name+'');
// $('.data-user .logoutlink').before('You're logged in as '+data.name+' ');
var str3_mysite = '';
if($('.data-site ul li span.text').text() == data.sid) {
$('.data-site').text('');
var isNewmessage = (data.newCount == 0 ) ? false : true;
var str2 = '\n';
$(".data-user .message").append(str2);
} else {
str3_mysite = ' \n';
}
var str3 = '\n';
str3 = str3 + '
\n';
str3 = str3 + '
\n';
str3 = str3 + '
"+data.name+"
\n';
str3 = str3 + str3_mysite;
str3 = str3 + '
\n';
str3 = str3 + '
\n';
str3 = str3 + '
\n';
str3 = str3 + '
\n';
str3 = str3 + '
\n';
str3 = str3 + '
\n';
$('.creatorlink-header').after(str3);
});
}
var pageHeight = function() {
$('.page-comments').css('margin-top','0px');
$('.el-footer').css('margin-top','0px');
var docHeight = $('.dsgn-body').height();
$('.dsgn-body').wrapInner('');
var dsgnHeight = $('.dsgn-body-wrap').height();
var diff = docHeight - dsgnHeight;
$('.dsgn-body > .dsgn-body-wrap').contents().unwrap();
return (diff>0) ? diff : 0;
}
var setHeight = function(height) {
if(typeof property.VIEW == 'undefined' || property.VIEW == "") return false;
if(height>0) {
height = (typeof MODE == 'undefined') ? height : height-35;
if($('.page-comments').length) {
$('.page-comments').css('margin-top',height+'px');
} else if($('.page-bottomlist').length) {
$('.page-bottomlist').css('margin-top',height+'px');
} else if($('.el-footer').length) {
$('.el-footer').css('margin-top',height+'px');
}
}
}
var appendGalleryFrame = function(tpl, seq, elsettings, bt_type, elcss) {
var bt_type = (bt_type) ? bt_type : 'gallery';
if(typeof property.TEMPLATE == 'undefined' || property.TEMPLATE == '') tpl.find('[data-gallery]').attr('data-gallery','#gframe-' + seq);
var settings = (typeof elsettings == 'object') ? elsettings : {};
if($.isEmptyObject(settings)) settings = (typeof elsettings != 'undefined' && ($.isEmptyObject(elsettings) === false)) ? $.parseJSON(elsettings) : {};
var img_onoff = (settings != null && typeof settings.img_original_display != 'undefined' && settings.img_original_display) ? settings.img_original_display : 'OFF',
title_onoff = (settings != null && typeof settings.gframe_title_visible != 'undefined' && settings.gframe_title_visible == 'OFF') ? false : true,
autoplay = (settings != null && typeof settings.gframe_autoplay != 'undefined' && settings.gframe_autoplay == 'ON') ? true : false,
interval = (settings != null && typeof settings.gframe_interval != 'undefined' && settings.gframe_interval) ? settings.gframe_interval : 5000,
like_onoff = (settings != null && typeof settings.like_display != 'undefined' && settings.like_display == 'ON') ? settings.like_display : 'OFF';
tpl.find('[data-gallery]').attr({'data-img-original':img_onoff, 'data-gallery-title':title_onoff, 'data-gallery-like':like_onoff});
if(!title_onoff) {
tpl.find('[data-gallery]').attr({'data-title':''});
}
galleryFrame(seq,autoplay,interval,bt_type);
if(like_onoff == 'ON') galleryFrameCss(seq, settings);
return tpl;
}
var galleryFrameCss = function(seq, elsettings) {
var elname = '.userEL' + seq;
var gframe = '#gframe-' + seq;
if($('.gframeCss' + seq).length == 0) $('#dsgn-body').after('');
var like_fill = (elsettings.gl_like_color !== undefined)? elsettings.gl_like_color : ((property.PARENT.mode=='project') ? '#505050':'#8e9095');
var likeActive_fill = (elsettings.gl_likeActive_color !== undefined)? elsettings.gl_likeActive_color:'#ee445f';
var galleryStyle = '';
galleryStyle += gframe+'.blueimp-gallery .gallery-like > svg{fill:'+like_fill+';}\n';
galleryStyle += gframe+'.blueimp-gallery .gallery-like.active > svg, '+gframe+'.blueimp-gallery .gallery-like.active > svg > path:first-child {fill:'+likeActive_fill+';}\n';
$('.gframeCss' + seq).text(galleryStyle);
}
var galleryFrame = function (id,autoplay,interval,bt_type) {
var bt_type = (bt_type) ? bt_type : 'gallery';
$('#gframe-' + id).remove();
var str = '\
\
\
\
\
\
\
/
\
\
\
\
\
\
\
\
\
';
$('.'+bt_type+'-frame').append(str);
}
var makeLinkUrl = function(link, one, view) {
var link_url = '',
link_val = '',
is_menu = ($.inArray(link.replace(/^\//g, '').replace(/ /g, '-'), property.MENULIST) > -1) ? true : false,
regex = /^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/,
regex2 = /^((http(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/;
if (one) {
link_url = (view) ? '/#' : '#';
link_url = (view && !property.PUBLISH) ? '/render/index#' : link_url;
if(is_menu) link_url = '/';
} else {
link_url = (property.URI=='/' || is_menu) ? '/' : property.URI + '/';
}
if (link) {
if (link.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark]
var bookmark_seq = link.replace(/^\@/g, '');
if (typeof property.SETTINGS.blockBookmarkList == 'undefined' || typeof property.SETTINGS.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') {
return '';
}
} else if (link.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink]
return link;
} else if ($.inArray(link.replace(/^\//g, '').replace(/ /g, '-'), property.MENULIST) > -1) { // link-type: link-menu ==> a[data-user-link]
link_val = link_url + link.replace(/ /g, '-');
} else { // link-type: link-out ==> a[attr-link]
if(checkBase64Encode(decodeURIComponent(link))) link = Base64.decode(decodeURIComponent(link));
else if (checkBase64Encode(link)) link = Base64.decode(link);
if(!regex2.test(link) && regex.test(link)) link_val = '//' + link;
}
if(link_val == '') link_val = link;
}
return link_val;
}
var checkError = function(data) {
if(typeof data.error != 'undefined' && data.error) {
alert(data.error);
if(data.error=='No user data') {
location.href='/member/login';
}
return true;
}
return false;
}
var funcCallback = function(func,callback) {
func();
if(typeof callback=='function') {
callback();
}
}
var cssSidebar = function(onoff) {
var width = (onoff == 'on') ? '260px' : '',
dsgn_css = CSSJSON.toJSON($('#dsgn-body').text());
if(width) {
if(typeof dsgn_css['children']['.dsgn-body.sidebar'] == 'undefined') {
dsgn_css['children']['.dsgn-body.sidebar'] = {'children' : {}, 'attributes' : { 'padding-left' : width, 'padding-top': '0px' }};
}
} else {
if(typeof dsgn_css['children']['.dsgn-body.sidebar'] != 'undefined') {
delete dsgn_css['children']['.dsgn-body.sidebar'];
}
}
$('#dsgn-body').text(CSSJSON.toCSS(dsgn_css));
}
var getScreen = function() {
var wid = window.innerWidth;
var screen_size = 0;
if (0 < wid && wid < 480) {
screen_size = 320;
} else if(wid <= 480 && wid <768) {
screen_size = 480;
} else if (768 <= wid && wid < 992) {
screen_size = 768;
} else if (992 <= wid && wid < 1200 ) {
screen_size = 992;
} else if (wid >= 1200) {
screen_size = 1200;
}
return screen_size;
}
var getScreenIndex = function() {
var idx = 0;
switch(SCREEN) {
case 320:
case 480:
idx = 2;
break;
case 769:
idx = 1;
break;
case 992:
case 1200:
idx = 0;
break;
default : idx = 0; break;
}
return idx;
}
var moveGallery = function(element) {
var header_fixed = $('header.navbar').height(),
offset = ($('.dsgn-body').hasClass('sidebar')) ? 0 : -header_fixed,
item = $('.gallery-item[data-seq="'+element+'"]');
if($('header.navbar').hasClass('disableOffset') && !$('.'+link).hasClass('el_0')) offset = 0;
if(item.length==0) {
if($('.element[data-id="'+element+'"]').length > 0) item = $('.element[data-id="'+element+'"]');
else return;
}
var sTop = item.offset().top + offset;
$('html, body').animate({
scrollTop: sTop
}, 500, 'easeInOutQuart');
$.removeCookie('gallery', { path: '/' });
$.removeCookie('gallery-item', { path : '/' });
}
var scrollToBlock = function(el,interval) {
if(typeof interval == 'undefined') interval = 1200;
if(typeof el == 'undefined' || !el || $(el).length == 0) return;
var header_fixed = $('header.navbar').outerHeight(),
offset = $('.dsgn-body').scrollTop();
if(!$('.dsgn-body').hasClass('sidebar') && !$('header.navbar').hasClass('disableOffset')) offset -= header_fixed;
var sTop = $(el).offset().top + offset;
$('html, body').animate({ scrollTop: sTop }, interval, 'easeInOutQuart');
}
var clearDsgnbody = function() {
$('.element[data-id="all_products"]').remove();
$('.psearch-view').remove();
$('.menu-lock-block').remove();
$('.site-lock-block').remove();
$('.config-image-view').hide();
$('.forum-view').remove();
$('.page-comments').remove();
$('.page-bottomlist').remove();
$('.tpl-page-footer').remove();
$('.el-footer').hide();
var element = $('div.element[class*="el_"]:not([class*=el__]):not(.el-footer)'),
css = $('style[id^="el_"]:not([id*=el__])'),
js = $('script[id^="js_"]:not([id*=el__])');
element.remove();
css.remove();
js.remove();
// $.each(element, function(i,v) {
// $('.el_' + (i+1)).remove();
// $('#el_' + (i+1) + 'css').remove();
// $('#js_' + (i+1)).remove();
// });
}
var golink = function(_this,link) {
var wloc = window.location,
local_link = (wloc.hostname == link.hostname) ? true : false,
local_arr = ['/_register', '/_login'];
if(local_link && $.inArray(link.pathname,local_arr) == -1) {
var loc = link.pathname,
uri = (_this.b.PUBLISH) ? loc : loc.replace('/render/','');
if((uri == '/render' || uri == '/') && !_this.b.ONE) {
uri = '';
$.each(_this.b.SMENU,function(i,v) {
var menu_name = (v.name).replace(' ','-');
var checkMenuName = (uri == menu_name) ? true : false,
checkMenuLink = (typeof v.link != 'undefined' && v.link) ? true : false;
if(checkMenuName && checkMenuLink) {
uri = (v.link).replace(' ','-');
}
});
}
var go = (_this.b.PUBLISH) ? '/' + uri + link.hash: '/render/' + uri + link.hash;
// 명품 쇼핑 검색 파라미터 처리
if((link.search).length) go = go + link.search;
_this.history.pushState(null,_this.b.TITLE,go);
if(typeof $.cookie('forum-item') != 'undefined') {
// console.log('fm_view', $.cookie('forum_content_view'));
setTimeout(function() {
if(typeof $.cookie('forum_content_view') != 'undefined'){
var fm_view = $.cookie('forum_content_view');
var fv = (fm_view !== undefined && fm_view)? fm_view.split('&'):array();
var pid = (fv)? fv[0]:'';
var row_id = (fv)? fv[1]:'';
scrollToBlock('.element[data-id="' + $.cookie('forum-item') + '"] .tpl-forum-list-title[data-id="'+row_id+'"]', 1000);
$.removeCookie('forum-item', { path : '/' });
$('.element[data-id="' + pid + '"] .tpl-forum-list-title[data-id="'+row_id+'"]').click();
// $.removeCookie('forum_content_view', { path: '/', expires: 12 * 60 * 60 * 1000 });
} else {
scrollToBlock('.element[data-id="' + $.cookie('forum-item') + '"]', 1000);
$.removeCookie('forum-item', { path : '/' });
}
}, 300);
}
} else {
location.href = link.href;
}
}
var allProductSortNav = function(elsettings, total) {
var settings = elsettings;
var orderby = (typeof settings.orderby !== 'undefined') ? settings.orderby.split('||') : ['true', 'false', 'false', 'false', 'false', 'false'];
var orderby_val = (typeof settings.orderby_val !== 'undefined') ? settings.orderby_val :
{'recent':'최신등록순',
'lowprice':'낮은가격순',
'review_cnt':'리뷰많은순',
'high_score':'평점높은순',
'sales':'누적판매순',
'hits':'조회순'};
var cookie_allproducts_orderby = $.cookie('gallery-category-all_products');
var allproducts_sort_list = '';
var i = 0;
$.each(orderby_val, function(k, v){
if (orderby[i] == 'true') {
var active = (cookie_allproducts_orderby == k)? 'active':'';
allproducts_sort_list += ''+v+'';
}
i++;
});
var html = '\
\
\
\
' + allproducts_sort_list +
'- 총 '+ total +'개
\
\
';
return html;
}
var loadAllproductSort = function(el, elsettings, total) {
var $el = el,
margin_val = $el.find('[data-loop="true"]').css('margin-left'),
padding_val = $el.find('.grid').first().css('padding-left');
var checkMsny = ($el.is('[data-msny="true"]')) ? true : false,
checkPremium = ($el.is('[data-type2="premium"]')) ? true : false,
checkGalleryCate = ( (checkMsny && $el.children('.allProducts-sort-wrap').length > 0) ||
(!checkMsny && $el.find('.container .allProducts-sort-wrap').length > 0)
) ? true : false,
allproducts_sort_html = allProductSortNav(elsettings, total);
if(checkGalleryCate) {
$el.find('.allProducts-sort-wrap').replaceWith(allproducts_sort_html);
} else {
if($el.find('.allProducts-sort-wrap').length > 0) $el.find('.allProducts-sort-wrap').remove();
if(checkMsny) {
if($el.find('.goption').length > 0) $el.find('.goption').after(allproducts_sort_html);
else $el.prepend(allproducts_sort_html);
} else if(checkPremium) {
var gcate_position = (typeof getGalleryCateNavPosition == 'function') ? getGalleryCateNavPosition($el) : '';
if(gcate_position) $el.find(gcate_position).before(allproducts_sort_html);
} else {
$el.find('[data-loop="true"]').before(allproducts_sort_html);
}
}
if($el.find('[data-loop="true"]').find('.emptyGalleryItem').length > 0 && $el.find('.allProducts-sort-list .active').index() == 0) $el.find('.allProducts-sort-list').addClass('empty');
}
var setAllProductsCurrentCat = function(elsettings) {
var orderby = (typeof elsettings.orderby !== 'undefined')? elsettings.orderby.split('||') : ['true', 'false', 'false', 'false', 'false', 'false'];
var orderby_val = (typeof elsettings.orderby_val !== 'undefined')? elsettings.orderby_val :
{'recent':'최신등록순',
'lowprice':'낮은가격순',
'review_cnt':'리뷰많은순',
'high_score':'평점높은순',
'sales':'누적판매순',
'hits':'조회순'};
var orderby_key = new Array();
var i = 0;
$.each(Object.keys(orderby_val), function(idx, v){
if(orderby[idx] == 'true') {
orderby_key[i] = v;
i++;
}
});
var first_sort = orderby_key[0];
var cookie_gallery_category = (typeof $.cookie('gallery-category-all_products') !== 'undefined' && $.cookie('gallery-category-all_products') != '')? $.cookie('gallery-category-all_products'):first_sort;
if(orderby_key.indexOf(cookie_gallery_category) == -1) {
cookie_gallery_category = first_sort;
$.cookie('gallery-category-all_products', first_sort, { path: '/', expires: 12 * 60 * 60 * 1000 });
}
return first_sort;
}
function isMenuLock(callback) {
var deferred = $.Deferred();
var is_lock_block = 'active', r;
var display_target = (property.VIEW) ? '.cl-s-product-detail, .lux-product-block, .cl-s-product-review, .cl-s-product-qna, .tpl-page-footer, .tpl-page-toolbar, .page-comments, .page-bottomlist' : '';
if(property.ISLOCK == 'true') {
r = $.post('/template/menuLockController/type/lock_check', {s: property.SMENU, sid: property.SID, page: property.PAGE, publish : property.PUBLISH}, function(data) {
var lock_type = data.lock_type,
lock_error_type = (typeof data.error_data != 'undefined' && data.error_data.type) ? '.' + data.error_data.type : '';
if(!data.error && data.result) {
property.ISLOCK = 'false';
} else {
// var checkGotoURL = '';
// if((property.SITEUM == '1' || property.SITEUM == '2') && lock_error_type == '') checkGotoURL = '/_login';
// else if(property.SITEUM == '2'&& $.inArray(lock_error_type,['.unlikesite','.creatorlink']) > -1) checkGotoURL = '/_register';
// if(checkGotoURL) {
// location.href = checkGotoURL;
// return false;
// }
var text = $.lang[LANG]['render.menu-lock.' + lock_type + '.text'];
if (typeof data.menuLockMsg !== 'undefined' && data.menuLockMsg) {
text = data.menuLockMsg;
}
if (lock_type=='umlevel') {
if(lock_error_type == '' && property.SITEUM == '1') lock_error_type = '.onlylogin';
text = $.lang[LANG]['render.menu-lock.' + lock_type + '.text' + lock_error_type ];
if(lock_error_type == '.lowerlevel') text = text.replace(/\#/gi, data.error_data.umlevel);
}
var str = '\
\
';
$('.header.el-menu').after(htmlspecialchars_decode(str));
$('#page-loading-css').remove();
}
if(typeof callback == 'function') {
callback();
if(display_target) {
setTimeout(function() {
if(property.ISLOCK == 'true') $(display_target).addClass('hide');
else $(display_target).removeClass('hide');
},20);
}
}
},'json');
} else {
if(typeof callback == 'function') {
callback();
setTimeout(function() {
if(display_target) $(display_target).removeClass('hide');
},20);
}
}
deferred.resolve();
return deferred.promise();
}
function isSitePasswordLock() {
var deferred = $.Deferred();
if(property.SETTINGS.passwordUse == undefined) {
property.SETTINGS.passwordUse = false;
}
if(property.SETTINGS.passwordUse === true && property.SITELOCK == 'true') {
r = $.post('/template/siteLockController/type/lock_check', {sid: property.SID, publish : property.PUBLISH}, function(data) {
var lock_error_type = (typeof data.error_data != 'undefined' && data.error_data.type) ? '.' + data.error_data.type : '';
// console.log(data);
if(!data.error && data.result) {
property.SETTINGS.passwordUse = false;
} else {
var str = '\
\
';
$('.header.el-menu').after(htmlspecialchars_decode(str));
}
}, 'json');
}
deferred.resolve();
return deferred.promise();
}
function isUserCertified(history) {
var referrer = (document.referrer !== undefined)? document.referrer.replace(/^https?:\/\//, ''):'';
var seg = referrer.split('/');
if(property.CERT_USE == 'A' && property.VALIDTYPE != 'BN' && property.VALIDTYPE != 'SM') { //요금제 만료
var str = '\
\
';
$('.header.el-menu').after(htmlspecialchars_decode(str));
return false;
}
r = $.post('/template/isUserCertified', {sid: property.SID, publish : property.PUBLISH}, function(data) {
var cert_form = '';
if((property.CERT_USE == 'Y' && data.cert!='Y') || (property.CERT_USE == 'A' && data.cert_adult!='Y')) {
var cert_conf = data.cert_conf;
var ordr_idxx = init_orderid();
cert_form = '\
\
\
\
';
if(property.CERT_USE == 'Y'){
if($.inArray(property.PAGE, ['_register', '_login', '_forgot', '_mypost', '_myinfo']) == -1 && seg[1] == '_login') {
var cert_popup = $.cookie('cert_popup');
var modal_content = $.lang[LANG]['siteum.cert.identify.verification.txt.1'] + '\
\
' + $.lang[LANG]['siteum.cert.identify.verification.txt.2'] + '\
';
if(typeof cert_popup !== 'undefined' && cert_popup == 'true' && data.cert == 'N') {
modal_content += cert_form;
$(this).showModalFlat($.lang[LANG]['siteum.cert.identify.verification'], modal_content, true, true, function() {
auth_type_check(true);
}, $.lang[LANG]['siteum.cert.identify.colse.btn'], $.lang[LANG]['siteum.cert.identify.verification.btn'],'modal-dialog cl-cmmodal cl-s-btn w560 cl-p70 cl-modal cl-close-btn user-not-cert-modal', false, function(){
$.removeCookie('cert_popup', true, { path: '/', expires: 12 * 60 * 60 * 1000 });
});
}
}
} else if(property.CERT_USE == 'A') {
if(!data.userid){
if(property.ONE && !property.VIEW) { //onepage site
var onpage_seq = property.pageContent.index[0]['seq'];
if(onpage_seq!='login' && onpage_seq!='register' && onpage_seq!='forgot'){
location.href='/_login';
}
} else {
if(property.PAGE!='_login' && property.PAGE!='_register' && property.PAGE!='_forgot') {
location.href='/_login';
}
}
} else {
var str = '\
\
';
$('.header.el-menu').after(htmlspecialchars_decode(str));
$(document).on('click', '.btn.logout', function(e){
e.preventDefault();
$.getJSON('/umember/login/out', function(r) {
if($.cookie('cert_popup') !== undefined) {
$.removeCookie('cert_popup', true, { path: '/', expires: 12 * 60 * 60 * 1000 });
}
location.reload();
},'json');
});
}
}
}
}, 'json');
}
function call_auth_data(frm) {
auth_data(frm);
}
var fonts_ko = ["@Korean", "KoPub Batang", "Black Han Sans", "Gmarket Sans", "Godo", "Kukdetopokki", "Nanum Gothic", "Nanum Gothic Coding", "Nanum Myeongjo", "Nanum Barun Gothic", "Nanum Pen Script", "Nanum Barun Pen", "Nanum Brush Script", "Nanum Square", "Nanum Square Round", "Daraehand", "Dohyeon", "Monsori", "Noto Sans KR", "Noto Serif CJK KR", "BB Tree Gothic","BB Tree Namu", "BB Tree Hand", "SangSangTitle", "Seoul Namsan", "Seoul Hangang", "Suit", "Spoqa Han Sans", "S CoreDream", "Yeonsung", "Oseong and HanEum", "Iropke Batang", "Jalnan", "Jeju Gothic", "Jeju Myeongjo", "Jeju Hallasan", "Jua", "Youth", "Pretendard", "Hangyule", "Hanna"],
fonts_en = ["@English", "Abel", "Abril Fatface", "Alegreya", "Aliquam", "Arial", "Cardo", "Cookie", "Dancing Script", "Dosis", "Droid Sans", "Droid Serif", "Fredoka One", "Georgia", "Great Vibes", "Ibarra Real Nova", "Inter", "Jost", "Krona One", "Lato", "League Spartan", "Libre Baskerville", "Lora", "Montserrat", "Muli", "Nixie One", "Noto Sans", "Open sans", "Oswald", "Parisienne", "Playball", "Playfair Display", "Poppins", "PT Sans", "PT Serif", "Questrial", "Quicksand", "Raleway", "Roboto", "Staatliches", "Stalemate", "Titillium Web", "Times New Roman", "Trench"],
fonts_ja = ["@Japanese", "Hannari", "Hokkori", "IoEI", "JKG", "MS Gothic", "MS Mincho", "Noto Sans JP", "Noto Serif JP"],
fonts_th = ["@Thai", "Cyclin", "Hai Heritage Pro", "HFF Thai Dye", "Owah Tagu Siam NF"],
fonts_ar = ["@Arabic", "Aceh Darusalam", "Amiri", "ArabDances", "Boecklins Universe", "Catharsis Bedouin", "Himchuli", "Kanisah", "Satyajit"],
fonts_cr = ["@Cyrillic", "20db", "Alpha Echo", "Anonymous Pro", "Arsenal", "Bebas Neue", "Bitter", "Charis SIL", "Fira Mono", "Lato CR"],
fonts_he = ["@Hebrew", "Alef", "Ezra SIL", "MendelSiddurMW"],
fonts_ch = ["@Chinese", "cwTeXHei", "cwTeXKai", "cwTeXMing", "cwTeXYen", "Noto Sans SC", "Noto Serif SC"],
fonts_vi = ["@Vietnamese", "Han Nom Gothic"];
FONTS = [];
for(i=0; i