fairnet/src/main/webapp/js/seed/seed.app.js

1080 lines
30 KiB
JavaScript

window.seedApp = window.seedApp || (function( $ ){
var init = function(){
/* ******************************************************************************************************
old
****************************************************************************************************** */
$.tailFlag = false;
$('a[href="#"], a[href="#none"]').on('click.DefaultClick', false);
$.fn.noop = function(){
return this;
}
/* *
* 메뉴 이동시 실행할 스크립트
* if( $('.pagination').length ){ ... } 와 같이 먼저 스크립트를 적용 할 대상이 있는지 체크 후에 실행
* */
$('.rolling').show();
var createRefreshIcon = (function(){
var pageTitle = $('.page-title-wrap');
$('.page-refresh').remove();
pageTitle.prepend(
$('<div class="page-refresh"></div>')
.addClass(function(){
var returnVal = 'page-refresh';
if( pageTitle.find('.sch-content-wrap').length ){
returnVal += ' static';
}
return returnVal;
})
.append(
$('<button type="button"><img src="/img/seed/page_refresh_big.png" width="15" height="20" alt="새로고침" title="새로고침" /></button>')
.click(function(){
location.reload();
})
)
);
}());
// 게시판 페이징
var pagination = $('.pagination');
if( pagination.length ){
pagination.each(function( index, el ){
var paginations = $(el);
var itemW = paginations.find('a').eq( 0 ).outerWidth();
var bxOpts = {
'desktop' : {
controls : false,
minSlides: 3,
// 10개
maxSlides: Math.floor( (itemW * 10) / itemW ),
slideWidth: itemW,
slideMargin: 0,
infiniteLoop: false,
adaptiveHeight: true,
pager: false
},
'mobile640' : {
controls : false,
minSlides: 3,
// 5개
maxSlides: Math.floor( (itemW * 5) / itemW ),
slideWidth: itemW,
slideMargin: 0,
infiniteLoop: false,
adaptiveHeight: true,
pager: false
}
};
$(window).on('resize', function(){
var currentWidth = $(window).width();
var currentDivice = currentWidth > 640 ? 'desktop' : 'mobile640';
if( !!paginations.destroySlider ){
paginations.destroySlider();
}
paginations.bxSlider( bxOpts[currentDivice] );
}).resize();
});
}
$('.editor iframe').hide();
if( $('iframe').length ){
function isFullScreen(){
return $('.layout-content').hasClass('siteLayOutSet');
}
// F11 key event
function jf_eventF11( isreload ){
var header = $('.header');
var layoutContent = $('.layout-content').addClass('siteLayOutSet');
var iframe = $('iframe');
// resize event
if( !isreload ){
$(window)
.on('resize.siteLayOutSet', function(){
var iframeH = $(window).height() - (header.height() + layoutContent.find('.layout-title').height() + $('.btn-area').height() + 30);
iframe.height( iframeH );
}).resize();
}
// 현재보이는 아이프레임 외에 나머지 아이프레임에 height 지정
iframe.contents().find('.CodeMirror').addClass('CodeMirror-fullscreen').css('height', 'auto');
}
// ESC key event
function jf_eventEsc(siteLayOutPosition){
var layoutContent = $('.layout-content').removeClass('siteLayOutSet');
var iframe = $('iframe');
// 아이프레임 height 지정 540이 스타일 기본값으로 잡혀있었음..
iframe.height(540);
// 현재보이는 아이프레임 외에 나머지 아이프레임 height 지정
iframe.contents().find('.CodeMirror').removeClass('CodeMirror-fullscreen').removeAttr('style');
// resize event off
$(window).off('resize.siteLayOutSet');
}
window.jf_eventF11 = jf_eventF11;
window.jf_eventEsc = jf_eventEsc;
window.isFullScreen = isFullScreen;
var $firstIframe = $('.editor iframe').first();
if( !$.browser.msie ){
$('.editor').iframeLoaded().done(function(){
$firstIframe.fadeIn(function(){
$('.rolling').hide();
});
});
}else{
$('.rolling').remove();
$firstIframe.show();
}
}
if( $('.bookmark-list-pc > ul > li').length ){
if( $(window).width() > 1024 ){
$('.bookmark-list-pc > ul > li, .sub-category li').css({
'transition':'none',
'-webkit-transition':'none'
});
$('.bookmark-list-pc button').addClass('on');
$('.bookmark-list-pc > ul').addClass('open');
$('.bookmark-list-pc .sub-category ul').addClass('sub-open');
$('.bookmark-list-pc .line01').css('opacity','1');
if( $('.bookmark-list-pc').hasClass('downNupType01') ){ //아래에서 위로 한줄
for( var i = 0; i < $('.downNupType01 > ul > li').length; i++ ){
var top = (Math.floor(i/2)+1)*64;
$('.downNupType01 > ul > li').eq(i).css('top',-top);
}
}else if( $('.bookmark-list-pc').hasClass('downNupType02') ){//아래에서 위로 두줄
for( var i = 0; i < $('.downNupType02 > ul > li').length; i++ ){
var top = (Math.floor(i/2)+1)*64;
if( i%2 == 0 ){
$('.downNupType02 > ul > li').eq(i).css('right',0);
}else{
$('.downNupType02 > ul > li').eq(i).css('right',64);
}
$('.downNupType02 > ul > li').eq(i).css('top',-top);
$('.downNupType02 > .category > li').css('top',-340);
}
}else{
//레이아웃 속성관리
for( var i = 0; i < $('.li-pos > ul > li').length; i++ ){
var top = (Math.floor(i/2)+1)*64;
if( i%2 == 0 ){
$('.li-pos > ul > li').eq(i).css('right',0);
}else{
$('.li-pos > ul > li').eq(i).css('right',64);
}
$('.li-pos > ul > li').eq(i).css('top',top);
}
}
}
}
$(".engNumOnly").css('imeMode', 'disabled');
$(".numOnly").css('imeMode', 'disabled');
$(".engOnly").css('imeMode', 'disabled');
/* 1024이하 */
var currentWidth = $(window).width();
$(window).on('resize.bookmark', function(){
var resizeWidth = $(window).width();
if( currentWidth !== resizeWidth ){
$('.bookmark-list-pc ul li').removeAttr('style');
$('.overlay').removeClass('open');
$('.editor-full-btn').css('display','none');
$('.bookmark-list-pc button').removeClass('on');
$('.bookmark-list-pc > ul').removeClass('open');
$('.bookmark-list-pc > ul').removeClass('open');
$('.bookmark-list-pc .line01').css('opacity','0');
if( resizeWidth >= 1024 ){
$('.editor-full-btn').css('display','block');
}
}
currentWidth = resizeWidth;
});
var colummIdxSaveData = {};
var moreBtnIdx = 0;
$('.more-table-item').off('click').on('click', function( ev ){
moreBtnIdx = $('body .more-table-item').index( this );
if( typeof colummIdxSaveData[moreBtnIdx] !== 'object' ){
colummIdxSaveData[moreBtnIdx] = {};
}
if( $('.colummListBox').length ){
$('.colummListBox').remove();
}
ev.stopPropagation();
var selector = '';
if( $(window).width() <= 1024 && $(window).width() > 640 ){
selector = 'thead .item-tablet-hidden';
}
else if( $(window).width() <= 640 ){
selector = 'thead .item-mobile-hidden, thead .item-tablet-hidden';
}
var $this = $(this),
// 테이블 전체 박스
tableLayout = $this.parents('.more-btn-box').siblings('.table-layout').length ? $this.parents('.more-btn-box').siblings('.table-layout') : $this.parents('.more-btn-box').siblings('.form-wrap').find('.table-layout'),
// 테이블
table = tableLayout.find('table'),
// 저장용
saveData = [],
// 히든 되는 요소 인덱스 저장용
colummIdx = [],
// thead > th
theadTh = table.find( selector ),
// tbody > tr
tbodyTr = table.find('tbody tr'),
// 동적생성될 전체 박스
colummListBox = $('<div></div>',{'class' : 'colummListBox'}).click(function( ev ){
ev.stopPropagation();
});
// 제목,인덱스 저장
theadTh.each(function( index, elem ){
elem = $(elem);
saveData.push({ title : elem.contents().get(0).nodeValue, colummIdx : elem.index() });
});
if( !tableLayout.find('.colummListBox').length ){
colummListBox.append(
$('<ul></ul>').append(function(){
var fragment = $(document.createDocumentFragment());
for( var i = 0; i < saveData.length; i++ ){
fragment.append(
$('<li></li>')
.append(function(){
var flag = colummIdxSaveData[moreBtnIdx][saveData[i].colummIdx];
console.log(colummIdxSaveData, moreBtnIdx, saveData[i].colummIdx)
return $('<input />',{
'type' : 'checkbox',
'id' : 'colummIdx-' + saveData[i].colummIdx,
'class' : flag ? 'checkbox width-none checked' : 'checkbox width-none'
}).prop('checked', flag);
})
.append(
$('<label></label>',{
'for' : 'colummIdx-' + saveData[i].colummIdx,
'text' : saveData[i].title
})
)
);
}
return fragment;
})
);
$this.parent().append( colummListBox );
}
else {
$this.parent().find('.colummListBox').remove();
}
});
$(document).on('change', '.colummListBox input[type="checkbox"]', function(){
if( typeof colummIdxSaveData[moreBtnIdx] !== 'object' ){
colummIdxSaveData[moreBtnIdx] = {};
}
var $this = $(this),
// 해당 컬럼 인덱스
colummIdx = $this.attr('id').split('-')[1];
// 테이블 전체 박스
tableLayout = $this.parents('.more-btn-box').siblings('.table-layout').length ? $this.parents('.more-btn-box').siblings('.table-layout') : $this.parents('.more-btn-box').siblings('.form-wrap').find('.table-layout'),
// 테이블
table = tableLayout.find('table'),
isShowHide = '',
flag = !!colummIdxSaveData[moreBtnIdx][colummIdx];
if( flag ){
isShowHide = 'hide';
// 체크된 데이타 제거
delete colummIdxSaveData[moreBtnIdx][colummIdx];
var size = 0;
for (var key in colummIdxSaveData[moreBtnIdx]) {
if (colummIdxSaveData[moreBtnIdx].hasOwnProperty( key )) {
size++;
}
}
if( !size ){
tableLayout.removeClass('table-fixed');
table.find('th,td,col').removeAttr('style');
table.prepend( $this.parents('.more-btn-box').data('colgroup') );
$this.parents('.more-btn-box').data('colgroup', false);
}
}
else {
tableLayout.addClass('table-fixed');
table.find('th').each(function( i ){
var col = table.find('colgroup').length ? table.find('col').eq( i ) : $this.parents('.more-btn-box').data('colgroup').find('col').eq( i ) ;
var outerW = $(this).outerWidth();
if( !col.hasClass('checkbox') && !col.hasClass('title') ){
if( !$(this).attr('style') ){
outerW += outerW;
}
}
$(this).outerWidth( outerW );
});
if( !$this.parents('.more-btn-box').data('colgroup') ){
$this.parents('.more-btn-box').data('colgroup', table.find('colgroup').detach() );
}
isShowHide = 'show';
// 체크된 데이타 저장
colummIdxSaveData[moreBtnIdx][colummIdx] = $this.prop('checked');
$(window).off('resize.tableFixed').on('resize.tableFixed', function(){
if( $(window).width() >= 1024 ){
tableLayout.removeClass('table-fixed');
table.find('th,td,col').removeAttr('style');
if( $this.parents('.more-btn-box').data('colgroup') ){
table.prepend( $this.parents('.more-btn-box').data('colgroup') );
$this.parents('.more-btn-box').data('colgroup', false);
}
$('.colummListBox').hide();
colummIdxSaveData[moreBtnIdx] = {};
}
});
}
// show and hide
table.find('col').eq( colummIdx )[isShowHide]();
table.find('thead th').eq( colummIdx )[isShowHide]();
table.find('tbody tr').each(function( index, elem ){
elem = $(elem);
elem.find('td').eq( colummIdx )[isShowHide]();
});
$(window).trigger('resize.colspan');
});
$(document).on('click', function(){
$('.colummListBox').hide();
});
//colspan 조절
$(window).on('resize.colspan',function(){
$(".table-layout, .data-table").each(function(){
var colspanLen = $(this).find('th:visible').length;
$(this).find('.no-data-colspan').attr('colspan', colspanLen );
});
}).resize();
$('.item-box input[type="file"]').on('change', function( e ){
if( $(this).attr('data-replacename') ){
return;
}
var label = $(this).next('label'),
labelVal = label.html();
if( !label.length ){
return;
}
var fileName = e.target.value.split( '\\' ).pop();
if( fileName )
label.text( fileName );
else
label.text( labelVal );
});
// input file [?] 버튼
$('.file-info').on('mouseenter', function(){
var parent = $(this).parent();
var position = parent.css('position');
parent
.css('position', /(absolute|fixed)/.test(position) ? position : 'relative')
.append(
$('<div></div>')
.addClass('file-info-txt')
.text( $(this).text() )
)
;
$('.file-info-txt').css({
left : $(this)[0].offsetLeft - $('.file-info-txt').outerWidth() / 2 + 9,
top : -($('.file-info-txt').outerHeight() + 5)
});
}).on('mouseleave', function(){
var parent = $(this).parent();
parent.find('.file-info-txt').remove();
});
/* ******************************************************************************************************
old
****************************************************************************************************** */
/* ******************************************************************************************************
new
****************************************************************************************************** */
/**
* from https://davidwalsh.name/javascript-debounce-function
*/
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
function browserW(){
return $(window).width() + $.scrollbarWidth();
}
$.fn.noop = function(){
return this;
}
// http://stackoverflow.com/questions/2465158/is-it-possible-to-remove-inline-styles-with-jquery
$.fn.removeStyle=function(style){var search = new RegExp(style + '[^;]+;?', 'g');return this.each(function(){$(this).attr('style', function(i, style){if( !style ) return;return style.replace(search, '');});});};
var TableSet = function(){
var TableCount = 0;
/**
* col엘리먼트에 들어간 "t-hide", "m-hide"클래스를 같은 라인(?)에 있는 th,td에 동일하게 클래스를 넣어줌
*/
;(function(){
;(function setColspan( dataTable ){
dataTable = dataTable || $('.data-table table');
dataTable.each(function( index, elem ){
var noDataCol = $(elem).find('.no-data-colspan');
// continue
if( !noDataCol.length )
{
return true;
}
var colCount = $(elem).find('thead th:visible').length;
noDataCol
.attr('colspan', colCount)
;
})
}());
$('.data-table table')
.each(function(){
var dataTable = $(this),
points = {},
colClass = ['ds-hide', 'm-hide', 't-hide', 'al', 'ac', 'ar', 'nowrap', 'dot'],
isReturn = function(){
var flag = false;
$.each(colClass, function( i, val ){
if( dataTable.find('.'+val).length )
{
flag = true;
}
});
return flag
}
if( !isReturn() || dataTable.find('.no-data-colspan').length ){
return true;
}
// 반복문 도는 김에 columm-box생성 ㅋ.
if( (dataTable.find('col.m-hide').length || dataTable.find('col.t-hide').length) && !dataTable.prev().hasClass('.columm-box') )
{
dataTable
.parent()
.before([
'<div class="columm-box">',
'<button type="button" class="columm-btn">칼럼 더보기</button>',
'</div>'
].join(''))
;
}
dataTable
.find('col')
.each(function( index, elem ){
var sp = ($(elem).attr('class') || "").split(' ');
points[index] = "";
// continue
if( !sp[0] )
{
return true;
}
$.each(colClass, function( i, val ){
if( sp.indexOf(val) > -1 ){
points[index] += ' ' + val;
}
})
})
;
dataTable
.find('tr')
.each(function( index, elem ){
$(elem)
.children()
.each(function( index, elem ){
var property = points[index];
if( !property ) return true;
$.each(property.split(' '), function( i, val ){
$(elem)
[ property ? 'addClass' : 'noop' ]( val )
;
})
})
;
})
;
dataTable
.parent()
.prev()
.children()
.data('colummData', points)
;
})
;
}());
/**
* 데이타테이블 위에 +버튼!
*/
;(function(){
function createColummList(){
var colummBtn = $(this),
colummBox = colummBtn.parent(),
dataTable = colummBox.next(),
// 유사배열입니다.
colummData = colummBtn.data('colummData');
if( !colummBox.children('ul').length )
{
colummBox
.append(function(){
var ul = $('<ul></ul>').addClass('columm-list');
$.each(colummData, function( key, val ){
// continue
if( !val ) return true;
val = $.trim(val);
var sp = val.split('-');
if( sp.length <= 1 ) return true;
var ID = 'columm-' + TableCount + '-' + key;
ul.append(
$('<li></li>')
.addClass( val.split('-')[0] + '-show' )
.append(
$('<input />', {
'type': 'checkbox',
'class': 'form-checkbox',
'id': ID
})
.change( colExpanded )
.data( 'index', key )
)
.append(
$('<label for="'+ ID +'"></label>')
.text( dataTable.find('thead th').eq( key ).text() )
)
);
});
return ul;
})
;
TableCount++;
}
else
{
colummBox
.children('ul')
.toggle()
;
}
}
function colExpanded(){
var inp = $(this),
idx = inp.data('index'),
colummBox = inp.parents('.columm-box'),
dataTable = colummBox.next().find('table');
dataTable
.find('thead tr')
.each(function(){
$(this)
.children()
[ !colummBox.find('input:checked').length ? 'removeStyle' : 'noop' ]('display')
.eq( idx )
.toggle()
;
})
;
dataTable
.find('tbody tr')
.each(function(){
$(this)
.children()
.eq( idx )
.toggle()
;
})
;
dataTable
.find('colgroup')
.each(function(){
$(this)
.find('col')
.eq( idx )
.toggle()
;
})
;
dataTable
.find('col, th, td')
[ !colummBox.find('input:checked').length ? 'removeStyle' : 'noop' ]('display')
;
dataTable
.parent()
[ colummBox.find('input:checked').length ? 'addClass' : 'removeClass' ]('scroll-x')
;
}
$('.columm-btn')
.on('click', createColummList)
;
}());
}
TableSet();
/* ******************************************************************************************************
new
****************************************************************************************************** */
}; // init end
return {
init : init
};
}( jQuery ));
$(document).ready(function(){
seedApp.init();
var $document = $(document);
$document
//$(".engNumOnly").css('imeMode', 'disabled');
//$(".numOnly").css('imeMode', 'disabled');
//$(".engOnly").css('imeMode', 'disabled');
.on('keyup', '.engNumOnly', function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[^a-z0-9]/gi,''));
}
})
.on('keyup', '.numOnly', function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[^0-9]/gi,''));
}
})
.on('keyup', '.engOnly', function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[^a-z]/gi,''));
}
})
.on('keyup', '.korOnly', function(event){
if (!(event.keyCode >=37 && event.keyCode<=40)) {
var inputVal = $(this).val();
$(this).val(inputVal.replace(/[a-z0-9]/gi,''));
}
})
.on('blur', '.numComma', function(){
$(this).val($.number($(this).val()));
})
.on('change', '.checkbox', function(){
if( $(this).prop('checked') ){
$(this).addClass('checked');
$(this).parents('tr').addClass('on');
}else{
$(this).removeClass('checked');
$(this).parents('tr').removeClass('on');
$(".check-all").prop('checked',false);
$(".check-all").removeClass('checked');
}
})
.on('change', '.check-all', function(){
var tableCheckbox = $(this).parents('table, .item-box').find('.checkbox');
if( $(this).prop('checked') ){
tableCheckbox.addClass('checked');
tableCheckbox.prop('checked',true);
tableCheckbox.parents('tr').addClass('on');
}else{
tableCheckbox.removeClass('checked');
tableCheckbox.prop('checked',false);
tableCheckbox.parents('tr').removeClass('on');
}
})
.on('cheange', '.AllCheck', function(){
})
.on('change', '.radio', function(){
$(this).addClass('checked');
$(this).siblings('input[type="radio"]').removeClass('checked');
})
.on('mouseenter', '.bookmark-list-pc > ul > li > a', function(){
$.SeedModal.options.title = $(this).text();
})
.on('mouseleave', '.bookmark-list-pc > ul > li > a', function(){
$.SeedModal.options.title = 'SEED 3.0';
})
.on('click', '.bookmark-list-pc button', function(){
var winWidth = $(window).width();
if( winWidth <= 1024 ){
if( $('.overlay').hasClass('open') ){
$('body').off('touchmove');
$('.overlay').removeClass('open');
$('.bookmark-list-pc button').removeClass('on');
$('.bookmark-list-pc > ul').removeClass('open');
$('.btn-area').css('z-index',25);
}else{
$('.overlay').addClass('open');
$('.bookmark-list-pc button').addClass('on');
$('.bookmark-list-pc > ul').addClass('open');
// $('.bookmark-list-pc').find(' > button, > ul').addClass('open');
$('.bookmark-list-pc .sub-category ul').addClass('sub-open');
//$('.bookmark-list-pc .line01').css('display','none');
$('.btn-area').css('z-index',0);
$('body').on('touchmove',function(e){
e.preventDefault();
},false);
}
}else{
if( $('.bookmark-list-pc button').attr('class') == 'on' ){
$('.bookmark-list-pc button').removeClass('on');
$('.bookmark-list-pc > ul').removeClass('open');
$('.bookmark-list-pc ul li').removeAttr('style');
$('.bookmark-list-pc .line01').css('opacity','0');
}else{
$('.bookmark-list-pc button').addClass('on');
$('.bookmark-list-pc > ul').addClass('open');
$('.bookmark-list-pc .line01').css('opacity','1');
if( $('.bookmark-list-pc').hasClass('downNupType01') ){ //아래에서 위로 한줄
for( var i = 0; i < $('.downNupType01 > ul > li').length; i++ ){
var top = (Math.floor(i/2)+1)*64;
$('.downNupType01 > ul > li').eq(i).css('top',-top);
}
}else if( $('.bookmark-list-pc').hasClass('downNupType02') ){ //아래에서 위로 두줄
for( var i = 0; i < $('.downNupType02 > ul > li').length; i++ ){
var top = (Math.floor(i/2)+1)*64;
if( i%2 == 0 ){
$('.downNupType02 > ul > li').eq(i).css('right',0);
}else{
$('.downNupType02 > ul > li').eq(i).css('right',64);
}
$('.downNupType02 > ul > li').eq(i).css('top',-top);
$('.downNupType02 > .category > li').css('top',-340);
}
}else{ //레이아웃 속성관리
for( var i = 0; i < $('.li-pos > ul > li').length; i++ ){
var top = (Math.floor(i/2)+1)*64;
if( i%2 == 0 ){
$('.li-pos > ul > li').eq(i).css('right',0);
}else{
$('.li-pos > ul > li').eq(i).css('right',64);
}
$('.li-pos > ul > li').eq(i).css('top',top);
}
}
}
//$('.bookmark-list-pc .line01').css('display','block');
}
})
.on('click', '.overlay', function(){
$('body').off('touchmove');
$('.overlay').removeClass('open');
$('.bookmark-list-pc button').removeClass('on');
$('.bookmark-list-pc > ul').removeClass('open');
$('.btn-area').css('z-index',25);
})
.on('keypress', '.specialKeyNot', function(event){
if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65)
|| (event.keyCode > 90 && event.keyCode < 97)){
event.preventDefault();
}
})
.on('click', '.editor-full-btn', function(){
/* var winWidth = $(window).width();*/
if( $('.layout-content').hasClass('siteLayOutSet') ){
jf_eventEsc();
$('#indicator').after( $('.overlay') );
/* if( winWidth <= 1024 ){
$('.header').removeClass('set-fixed')
}*/
}else{
jf_eventF11();
$('.layout-content').append( $('.overlay') );
$('.menu-manage').append( $('.overlay') );
/* if( winWidth <= 1024 ){
$('.header').addClass('set-fixed')
}*/
}
})
//툴팁
.on('click', '.page-tip', function(){
var _this = $(this);
var pageTip = $('.page-tip');
var index = pageTip.index( this );
var pageWrap = _this.parents('.page-title-wrap').parent();
var text = pageWrap.find('caption')[pageTip.length > 1 ? 'eq' : 'noop' ](index).first().text() || pageWrap.find('legend')[pageTip.length > 1 ? 'eq' : 'noop' ](index).first().text();
_this.siblings().toggleClass('active').find('p')[text ? 'text' : 'noop']( text );
})
.on('click', '.tooltipBox', function(){
return false;
})
.on('click', function(){
$('.tooltipText').removeClass('active');
})
//사이트메뉴목록
.on('click', '.table-layout.inner-br-none tbody tr' ,function(){
$(this).addClass('active').siblings().removeClass('active').find('.menu-barogagi img').attr('src','/img/icon-go.png');
$(this).find('.menu-barogagi img').attr('src','/img/icon-go-over.png');
});
if( $('.datepicker').length ){
$('.datepicker').pickadate({
monthsFull: [ '01월', '02월', '03월', '04월', '05월', '06월', '07월', '08월', '09월', '10월', '11월', '12월' ],
monthsShort: [ '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12' ],
weekdaysShort: [ '일', '월', '화', '수', '목', '금', '토' ],
today: '오늘',
clear: '지우기',
close: '닫기',
format: 'yyyy-mm-dd',
formatSubmit: 'yyyy-mm-dd'
});
}
$('#siteAdmin').on('click', function(){
$.SeedModal({url:"/gta/siteList.do", 'title' : $(this).text() });
})
});
function jf_GETCODEList(siteIdx, menuCode, pageType){
$.SeedModal({url:"/common/getCodeList/"+siteIdx+"/"+menuCode+".do?pageType="+pageType });
}
function jf_GETCODE(siteIdx, getUrl, pageType){
if(pageType == "history"){
$.SeedModal({url: getUrl});
}else if(pageType == "gta" || pageType == "gtm" || pageType == "gte"){
$.SeedModal({url: "/common/getCode/"+siteIdx+".do?getUrl="+Base64.encode(getUrl)+"&pageType="+pageType});
}else{
$.SeedModal({url: getUrl});
}
}
/**************************************/
/* validation Check
/*
/* param:
/* ob : 해당 객체 셀렉조건
/* msg : 커스텀콜백 사용안할시 얼럿 메시지
/* customOptions : max(최대), min(최소), password(비번스타일), consecutively(연속문자체크), consecutivelyNum(연속문자수), number(숫자형)
/* customCallback : 첫번째 파라미터로 에러처리
/* 0 : 길이 체크 에러
/* 1 : 특수문자 체크 에러 (password시)
/* 2 : 숫자 체크 에러 (password시)
/* 3 : 연속된 문자 체크에러 (consecutivelyNum시)
/* 4 : 숫자형일때 체크에러 (number 시)
/*
/**************************************/
function validation(ob, msg, customOptions, customCallback){
var options = {
max : 16, // 최대 글자수
min : 9, // 최소 글자수
password : true, // 비밀번호 패턴 특수문자, 숫자 포함하기
consecutively : true, // 연속된 문자 방지하기
consecutivelyNum : 3 // 연속된 문자 제한수
};
$.extend(options, customOptions);
var callback = function(i,e){
if( typeof customCallback == "function" ){
customCallback.prototype = {id:ob};
new customCallback(i);
}else{
alert(msg);
$(ob).focus();
}
};
var value = $(ob).val();
//최소, 최대값 체크하기. (빈값체크)
if( value.length < options.min || value.length > options.max ){
callback(0,"Error 최소 최대값 체크" + options.min + " < " + value.length + " < "+ options.max);
return false;
}
//패스워드 스타일 체크 특수문자, 숫자 필수
if(options.password){
var special_pattern = /[`~!@+_#$%^&*|\\\'\";:\/?]/gi;
if( special_pattern.test(value) == false ){
callback(1,"Error 특수문자가 없을 때 " +value);
return false;
}
special_pattern = /[0-9]/gi;
if( special_pattern.test(value) == false ){
callback(2,"Error 숫자가 없을 때 "+value);
return false;
}
}
//연속된 문자 체크
if(options.consecutively){
var t = "";
var c = 0;
for(var i=0; i<value.length; i++){
var v = value.charAt(i);
if( t == v ){
c++;
}else{
c = 0;
}
t = v;
if(c >= options.consecutivelyNum-1){
callback(3,"Error 연속된 문자 이상 "+value );
return false;
break;
}
}
}
return true;
}