File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
/*
Author : hyojeong yang
Date : 2023-05-17
Project : cms
*/
var ie = /MSIE/.test(navigator.userAgent);
ieVer = ie ? parseInt(navigator.userAgent.split('MSIE')[1].split(';')[0]) : false;
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
/**
* @param opt {
* obj : 토글 클래스가 붙을 오브젝트,
* className : 토글시 클래스명,
* hasClass : 요소가 클래스를 가지고 있을 때 함수를 실행한다,
* noneClass : 요소가 클래스를 가지고 있지 않을 때 함수를 실행한다,
* }
*/
var toggleCommonFunc = function (opt) {
opt.obj = opt.obj;
$(opt.obj).toggleClass(opt.className);
if ($(opt.obj).hasClass(opt.className)) {
opt.hasClass()
} else {
opt.noneClass();
}
}
/**
*
* @param opt {
* pc : function
* mo : function
* ta : fucntion
* }
*/
var ssmFunc = function (opt) {
var ssmPc = (opt.hasOwnProperty('pc') && opt.pc) ? true : false;
var ssmTa = (opt.hasOwnProperty('ta') && opt.ta) ? true : false;
var ssmMo = (opt.hasOwnProperty('mo') && opt.mo) ? true : false;
if (ssmPc) {
ssm.addState({
id: 'pc',
query: '(min-width: 1280px)',
onEnter: function () {
opt.pc();
},
});
}
if (ssmTa) {
ssm.addState({
id: 'ta',
query: '(min-width: 768px) and (max-width: 1279px)',
onEnter: function () {
opt.ta();
},
});
}
if (ssmMo) {
ssm.addState({
id: 'mo',
query: '(max-width: 767px)',
onEnter: function () {
opt.mo();
},
});
}
};
//popup open
var popupOpen = function (target) {
var $pop = $('[data-popup="' + target + '"]');
$pop.css({
'display': 'flex'
});
TweenMax.fromTo($pop, .3, { css: { 'opacity': '0', 'margin-top': '5%' } }, { css: { 'opacity': '1', 'margin-top': '0' } })
$('.layer').hide();
$('.dim').show();
$('body').css({ 'overflow-y': 'hidden' });
}
//popup close
var popupClose = function (target) {
var $pop = $('[data-popup="' + target + '"]');
TweenMax.fromTo($pop, .3, { css: { 'opacity': '1', 'margin-top': '0' } }, { css: { 'opacity': '0', 'margin-top': '5%' } })
$pop.fadeOut(200);
$('.dim, .layer').fadeOut(200);
$('body').css({ 'overflow-y': 'auto' });
}
//layer open
var layerOpen = function (target, el) {
var $layer = $('[data-layer="' + target + '"]'),
$el = $(el),
offsetTop = $el.offset().top + ($el.height() / 2 - 20),
offsetLeft = $el.offset().left + ($el.width() + 20);
$layer.css({ "top": offsetTop, "left": offsetLeft }).fadeIn(200);
}
//layer close
var layerClose = function (target) {
var $layer = $('[data-layer="' + target + '"]');
$layer.fadeOut(200);
}
if (jQuery) (function ($) {
//common
//$.extend($.fn, {
// Func: function () {
// var init = function (obj) {
// };
// $(this).each(function () {
// init(this);
// });
// return $(this);
// }
//});
//component
//popup
$.extend($.fn, {
popupFunc: function () {
var init = function (obj) {
var $btn = $('.popup .pop-close, .popup-zoom .pop-close');
$(document).on('click', $btn, function (e) {
var $target = $(e.target);
if ($target.is($btn)) {
$pop = $target.closest('.popup, .popup-zoom');
$pop.fadeOut(200);
TweenMax.fromTo($pop, .3, { css: { 'opacity': '1', 'margin-top': '0' } }, { css: { 'opacity': '0', 'margin-top': '5%' } })
$('.dim').fadeOut(200);
$('body').css({ 'overflow-y': 'auto' });
}
});
$('.dim').on('click', function (e) {
$pop = $('[data-popup]');
$pop.fadeOut(200);
TweenMax.fromTo($pop, .3, { css: { 'opacity': '1', 'margin-top': '0' } }, { css: { 'opacity': '0', 'margin-top': '5%' } });
$('body').css({ 'overflow-y': 'auto' });
$(this).hide();
});
};
init(this);
return $(this);
}
});
//accordion
$.extend($.fn, {
accordionFunc: function () {
var init = function (obj) {
var $btn = $(obj).find('li').find('.btn-accordion-toggle');
$(document).on('click', $btn, function (e) {
var $target = $(e.target);
if ($target.is($btn)) {
$target.closest('li').siblings('li').removeClass('is-active');
toggleCommonFunc({
obj: $target.closest('li'),
className: 'is-active',
hasClass: function (obj) {
//$(obj).removeClass('is-active');
TweenMax.fromTo('.accordion-txt-area', .5, { opacity: 0 }, { opacity: 1 });
$btn.html('열기');
$target.html('닫기');
},
noneClass: function (obj) {
TweenMax.fromTo('.accordion-txt-area', .5, { opacity: 1 }, { opacity: 0 });
$btn.html('열기');
}
});
}
});
};
init(this);
return $(this);
}
});
//tabs-noraml
$.extend($.fn, {
tabsNormalFunc: function () {
var init = function (obj) {
// var $currentTab = $(obj).find("[class^='tabs-nav']").find('a.is-active').attr('href');
// $($currentTab).show();
// $(obj).find("[class^='tabs-nav']").find('a').on('click', function () {
// //var $li = $(this).parent('li');
// if ($(this).hasClass("is-active") == false) {
// $(obj).find("[class^='tabs-nav']").find('a').removeClass("is-active");
// $(this).addClass("is-active");
// }
// $(obj).find('.tabs-cont').hide();
// var $activeTab = $(this).attr('href');
// $($activeTab).show();
// return false;
// });
var $currentTab = $(obj).find("[class^='tabs-nav']").find('a.is-active').attr('href');
$($currentTab).show();
$(document).on('click', ".tabs-nav a", function (e) {
$area = $(this).closest('.tabs-normal');
if ($(this).hasClass("is-active") == false) {
$area.find("[class^='tabs-nav']").find('a').removeClass("is-active");
$(this).addClass("is-active");
}
$area.find('.tabs-cont').hide();
var $activeTab = $(this).attr('href');
$($activeTab).show();
return false;
});
// $(obj).find("[class^='tabs-nav']").find('a').on('click', function () {
// //var $li = $(this).parent('li');
// if ($(this).hasClass("is-active") == false) {
// $(obj).find("[class^='tabs-nav']").find('a').removeClass("is-active");
// $(this).addClass("is-active");
// }
// $(obj).find('.tabs-cont').hide();
// var $activeTab = $(this).attr('href');
// $($activeTab).show();
// return false;
// });
};
$(this).each(function () {
init(this);
});
return $(this);
}
});
//toggleFunc
$.extend($.fn, {
toggleFunc: function () {
var init = function (obj) {
$(document).on('click', '[data-toggle]', function (e) {
val = $(this).data('toggle');
$el = $('[data-toggleobj="' + val + '"]');
$btn = $('[data-toggle="' + val + '"]');
toggleCommonFunc({
obj: $btn,
className: 'is-active',
hasClass: function (obj) {
$el.css({ 'display': 'flex' });
TweenMax.fromTo($el, .5, { opacity: 0 }, { opacity: 1 });
},
noneClass: function (obj) {
TweenMax.fromTo($el, .5, { opacity: 1 }, { opacity: 0 });
$el.css({ 'display': 'none' });
}
});
});
};
init(this);
return $(this);
}
});
//layout
//lnb
$.extend($.fn, {
lnbFunc: function () {
var init = function (obj) {
$(document).on('click', '.lnb .depth1 > li > a', function () {
$area = $(this).closest('li');
toggleCommonFunc({
obj: $area,
className: 'is-active',
hasClass: function (obj) {
$area.siblings('li').removeClass('is-active');
$(this).closest('li').addClass('is-active');
},
noneClass: function (obj) {
}
});
});
};
init(this);
return $(this);
}
});
$.datepicker.regional['ko'] = {
closeText: '닫기',
prevText: '이전달',
nextText: '다음달',
currentText: '오늘',
monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
monthNamesShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
dateFormat: 'yy/mm/dd',
firstDay: 0,
isRTL: false,
duration: 200,
showAnim: 'show',
showMonthAfterYear: true
// yearSuffix: '년'
};
$.datepicker.setDefaults($.datepicker.regional['ko']);
var datepickerExtensions = {
_oldAdjustDate: $.datepicker._adjustDate,
_adjustDate: function (id, offset, period) {
var target = $(id),
inst = this._getInst(target[0]);
var afterAdjustDate = this._get(inst, 'afterAdjustDate');
this._oldAdjustDate(id, offset, period);
if (afterAdjustDate && typeof afterAdjustDate === 'function') {
afterAdjustDate(id, offset, period);
}
},
_oldSelectDay: $.datepicker._selectDay,
_selectDay: function (id, month, year, td) {
var inst,
target = $(id);
inst = this._getInst(target[0]);
inst.selectedDay = inst.currentDay = $("a", td).html();
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
this._selectDate(id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear));
this._oldSelectDay(id, month, year, td);
var afterSelectDay = this._get(inst, 'afterSelectDay');
if (afterSelectDay && typeof afterSelectDay === 'function') {
afterSelectDay(id, month, year, td);
}
}
}
$.extend($.datepicker, datepickerExtensions);
})(jQuery);
$(document).ready(function () {
//jquery-ui
$('.datepicker').datepicker({
showOn: "both",
buttonImage: "../../../images/user/common/ico_cal.svg",
buttonText: "기간 선택",
// buttonImageOnly: true,
changeMonth: true,
changeYear: true
});
$(window).on('scroll', function () {
$('#ui-datepicker-div').hide();
});
//component
//accordionFunc
$('.accordion').accordionFunc();
$('.tabs-normal').tabsNormalFunc();
$('.popup').popupFunc();
$('[data-toggle]').toggleFunc();
$('.lnb-area').lnbFunc();
});