$(function() { $("td a").css({"text-decoration":"underline"}); $("[class^=explanation_area]").css("margin-top", "30px"); //기능버튼영역 fn_showFButtonArea(); $(".fButtonDropDown").toggle( function() { $(this).removeClass("btn_dw02"); $(this).addClass("btn_up02"); }, function() { $(this).removeClass("btn_up02"); $(this).addClass("btn_dw02"); } ); // 컬럼 감추기 $(".listArea > table[class^=boardList0]").hideCols(); }); /********************************************************************* * 함 수 명 : tdNumberFormat * 함수설명 : 콤마 찍어줌, 클릭시 텍스트만, 다른데 클릭하면 다시 콤마찍어줌 *********************************************************************/ $.fn.tdNumberFormat = function() { return $(this).each(function() { $(this).text($(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")).attr("align", "right"); }).focusin(function() { $(this).text(replaceAll($(this).text(), ",")); }).focusout(function() { $(this).text($(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")); }); }; /********************************************************************* * 함 수 명 : tdSetComma * 함수설명 : 콤마 찍어줌 *********************************************************************/ $.fn.tdSetComma = function() { return $(this).each(function() { $(this).text($(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")).attr("align", "right"); }); }; /********************************************************************* * 함 수 명 : inputNumberFormat * 함수설명 : 인풋박스용 콤마 찍어줌, 클릭시 텍스트만, 다른데 클릭하면 다시 콤마찍어줌 *********************************************************************/ $.fn.inputNumberFormat = function() { return this.each(function() { $(this).keydown(function(e) { var key = e.charCode || e.keyCode || 0; return (key == 8 ||key == 9 ||key == 46 ||key == 17 ||key == 67 ||key == 86 ||key == 109|| (key >= 37 && key <= 40) ||(key >= 48 && key <= 57) ||(key >= 96 && key <= 105)); }) .keyup(function() { $(this).val($(this).val().replace(/[^-\.0-9]/gi, "")); $(this).val($(this).val().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")); }) .val(function() { $(this).val($(this).val().replace(/[^-\.0-9]/gi, "")); return $(this).val().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); }); /* .focusin(function() { $(this).val(replaceAll($(this).val(), ",")); }).focusout(function() { $(this).val($(this).val().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")); }); */ }); }; /********************************************************************* * 함 수 명 : isNumber * 함수설명 : 입력값에 숫자만 있는지 체크 * 입 력 : value - 대상 문자열 ('12345') * 결 과 : Boolean (true, false) *********************************************************************/ function isNumber(value) { var chars = "0123456789"; return containsCharsOnly(value, chars); } /********************************************************************* * 함 수 명 : containsCharsOnly * 함수설명 : 입력값이 특정 문자(chars)만으로 되어있는지 체크 * 입 력 : value - 대상 문자열 * chars - 특정문자 * 결 과 : Boolean *********************************************************************/ function containsCharsOnly(value, chars) { for ( var inx = 0; inx < value.length; inx++) { if (chars.indexOf(value.charAt(inx)) == -1) return false; } return true; } /********************************************************************* * 함 수 명 : containsChars * 함수설명 : 입력값에 특정 문자(chars)가 있는지 체크, 특정 문자를 허용하지 않으려 할 때 사용 * 입 력 : input - 대상 오브젝트 * chars - 특정문자 ** (ex. if (containsChars(form.name,"!,*&^%$#@~;")) { * alert("이름 필드에는 특수 문자를 사용할 수 없습니다."); * } * ) * 결 과 : Boolean *********************************************************************/ function containsChars(input, chars) { for (var inx = 0; inx < input.value.length; inx++) { if (chars.indexOf(input.value.charAt(inx)) != -1) return true; } return false; } /********************************************************************* * 함 수 명 : setQueryStringByObj * 함수설명 : 쿼리스트링 만들어줌 * 입 력 : p_index - p_objParamSet에 오브젝트를 넘길 경우 해당 오브젝트의 index에 해당하는 value를 가져오기 위함 * p_objParamSet - n개의 넘길 파라메터 name & value(값 또는 오브젝트) * (ex. * var objParamSet = { * depoSeq : $("[name='hdn_updDepoSeq']"), //오브젝트 (p_index로 값 세팅) * vacctNo : $("[name='hdn_updVacctNo']"), * startNum : "0", //값 * pageStat : "edit" * }; * ) * 결 과 : 쿼리스트링 (ex. depoSeq=12522&vacctNo=1526325869&startNum=0&pageState=edit) *********************************************************************/ function setQueryStringByObj(p_objParamSet) { var queryString = ""; var i = 0; $.each(p_objParamSet, function(paramName, paramValue) { queryString = queryString + (i++ == 0? "": "&") + paramName + "=" + paramValue; }); return queryString; } /********************************************************************* * 함 수 명 : combo() * 함수설명 : 자동완선검색(콤보박스용) jQuery 메소드 *********************************************************************/ /* (function( $ ) { $.widget( "ui.combobox", { _create: function() { var self = this, select = this.element.hide(), selected = select.children( ":selected" ), value = selected.val() ? selected.text() : ""; var input = this.input = $( "" ) .insertAfter( select ) .val( value ) .autocomplete({ // autoFocus: false , open: function() { $(".liTheaList").each(function() { var flag = true; while (flag) { for(var i = 0; i< theaObjList.length; i++) { var val = replaceAll(theaObjList[i].inputText.toLowerCase(), " "); var inputVal = $(this).find("a").text(); if(val.indexOf(inputVal) >= 0 ) { $(this).attr("title", inputVal); flag = false; }; } } }); }, delay: 0, minLength: 0, source: function( request, response ) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); var select_el = select.get(0); // get dom element var rep = new Array(); // response array // simple loop for the options for (var i = 0; i < select_el.length; i++) { var text = select_el.options[i].text; if ( select_el.options[i].value && ( !request.term || matcher.test(text) ) ){ // add element to result array rep.push({ label: text, // no more bold value: text, option: select_el.options[i] }); } } // send response response( rep ); }, select: function( event, ui ) { ui.item.option.selected = true; self._trigger( "selected", event, { item: ui.item.option }); }, change: function( event, ui ) { if ( !ui.item ) { var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ), valid = false; select.children( "option" ).each(function() { if ( $( this ).text().match( matcher ) ) { this.selected = valid = true; return false; } }); if ( !valid ) { // remove invalid value, as it didn't match anything $( this ).val( "" ); select.val( "" ); input.data( "autocomplete" ).term = ""; return false; } } } }) .addClass( "ui-widget ui-widget-content " ); input.data( "autocomplete" )._renderItem = function( ul, item ) { return $( "
" ) .data( "item.autocomplete", item ) .append( "" + item.label + "" ) .appendTo( ul ); }; this.button = $( "" ) .attr( "tabIndex", -1 ) .attr( "title", "Show All Items" ) .insertAfter( input ) .removeClass( "ui-corner-all" ) .addClass( " " ) .click(function() { // close if already visible if ( input.autocomplete( "widget" ).is( ":visible" ) ) { input.autocomplete( "close" ); return; } // work around a bug (likely same cause as #5265) $( this ).blur(); // pass empty string as value to search for, displaying all results input.autocomplete( "search", "" ); input.focus(); }); }, destroy: function() { this.input.remove(); this.button.remove(); this.element.show(); $.Widget.prototype.destroy.call( this ); } }); })( jQuery ); */ $.widget( "custom.combobox", { _create: function() { this.wrapper = $( "" ) .addClass( "custom-combobox" ) .insertAfter( this.element ); this.element.hide(); this._createAutocomplete(); this._createShowAllButton(); }, _createAutocomplete: function() { var selected = this.element.children( ":selected" ), value = selected.val() ? selected.text() : ""; this.input = $( "" ) .appendTo( this.wrapper ) .val( value ) .attr( "title", "" ) .autocomplete({ delay: 100, minLength: 0, source: $.proxy( this, "_source" ) }) ; this._on( this.input, { autocompleteselect: function( event, ui ) { ui.item.option.selected = true; this._trigger( "select", event, { item: ui.item.option }); }, autocompletechange: "_removeIfInvalid" }); }, _createShowAllButton: function() { var input = this.input, wasOpen = false; $( "" ) .attr( "tabIndex", -1 ) .attr( "title", "Show All Items" ) .tooltip() .appendTo( this.wrapper ) .button({ icons: { primary: "ui-icon-triangle-1-s" }, text: false }) .removeClass( "ui-corner-all" ) .addClass( "custom-combobox-toggle ui-corner-right" ) .on( "mousedown", function() { wasOpen = input.autocomplete( "widget" ).is( ":visible" ); }) .on( "click", function() { input.trigger( "focus" ); // Close if already visible if ( wasOpen ) { return; } // Pass empty string as value to search for, displaying all results input.autocomplete( "search", "" ); }); }, _source: function( request, response ) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); response( this.element.children( "option" ).map(function() { var text = $( this ).text(); if ( this.value && ( !request.term || matcher.test(text) ) ) return { label: text, value: text, option: this }; }) ); }, _removeIfInvalid: function( event, ui ) { // Selected an item, nothing to do if ( ui.item ) { return; } // Search for a match (case-insensitive) var value = this.input.val(), // valueLowerCase = value.toLowerCase(), valid = false; this.element.children( "option" ).each(function() { if ( $( this ).text().toLowerCase() === valueLowerCase ) { this.selected = valid = true; return false; } }); // Found a match, nothing to do if ( valid ) { return; } // Remove invalid value this.input .val( "" ); this.element.val( "" ); this.input.autocomplete( "instance" ).term = ""; }, _destroy: function() { this.wrapper.remove(); this.element.show(); } }); function fn_searchInit(p_obj, p_targetObj, p_queryObj) { //$(p_obj).combobox();///.next("input").removeClass().next("button").removeClass(); /* 스타일 적용 */ $("[class^=ui-autocomplete]").css({ "color" : "#666666", "background": "#ffffff", "border":"1px solid #ccc" }); $("[class^=ui-autocomplete]").find(".ui-widget-content .ui-state-hover").css({ "background":"#cacbff", "color":"#000" }); if($(p_obj).attr("name") == "sVacctNo") { $(".ui-autocomplete-input").css({ "width":"200px", "height":"18px" }); } $.ajax({ type: "post", url : "/kobis/business/fund/levy/findTheaList.do", data: p_queryObj, success:function(msg){ $(p_targetObj).after(msg); //스타일 적용 $(".ui-autocomplete").css({ "min-width" : "350px", "max-height": "200px", "overflow-y": "auto", "overflow-x": "hidden", "padding-right": "20px", "position": "absolute", "cursor":"default" }); $("[class^=ui-autocomplete]").css({ "color" : "#666666", "background": "#ffffff", "border":"1px solid #ccc" }); $("[class^=ui-autocomplete]").find(".ui-widget-content .ui-state-hover").css({ "background":"#cacbff", "color":"#000" }); $(".textbox.combo").width('360px'); $("#sDivVacctNo").next($(".textbox.combo")).width(150); } }); } //영화상영관상세정보레이어 function fn_detailTheaInfoLayer(p_event, p_btn, p_vacctNo, p_theaNm) { $("#wrap").find("#div_theaInfo").remove(); var p_obj = $('', { id: "div_theaInfo", name: "div_theaInfo" }); var winHeight = $(window).height(); var winWidth = $(window).width()/2; $("#wrap").append(p_obj); var y_pos = p_event.clientY + 450 > $(window).height() ? $(window).height() - 480 : p_event.clientY; var p_opt = {position: [parseInt($(p_btn).offset().left) + parseInt($(p_btn).width()) + 10, y_pos], width:"540", height:"340"}; if($(p_btn).attr("name") == "rcvTheaFullNm") { p_opt = {position: [$(p_btn).offset().left-550, p_event.clientY], width:"540", height:"340"}; } $.ajax({ url : "/kobis/business/fund/levy/searchTheaInfo.do", data : "sVacctNo="+p_vacctNo, dataType : "html", success : function(msg) { $("#wrap").append(msg); //$(p_obj).dialog($.extend({}, p_opt)); $('.layer').css({'top':$('html, body').scrollTop()+130}); $('.layer').css({'left':winWidth-300}); fn_popStyle(p_obj, "영화상영관상세정보-" + p_theaNm); } }); } /* 광역단체 클릭 시 기초단체 리스트업 */ function fn_makeCodeList(p_keyCode, p_target, p_obj) { $.ajax({ url: "/kobis/business/fund/levy/searchCodeMapping.do", data: {keyCode: p_keyCode, target: p_target}, dataType : "json", success: function(data) { //console.log(data); $(p_obj).find("option:not(:first-child)").remove(); var optVal = ""; $.each(data, function(key, value){ $(p_obj).append(""); }); } }); } /* 검색 초기화 */ function fn_searchReset() { var $frm = $("#frm_search"); var sYearFrom = ""; var sMonthFrom = ""; var sYearTo = ""; var sMonthTo = ""; var sTrIlFrom = ""; var sTrIlTo = ""; if($frm.find("select").length != 0) { $frm.find("select").val(""); } $.ajax({ url: "/kobis/business/fund/levy/searchFundYymm.do", dataType : "json", success: function(data) { var optVal = ""; $.each(data, function(key, value){ sYearFrom = this["sYearFrom"]; sMonthFrom = this["sMonthFrom"]; sYearTo = this["sYearTo"]; sMonthTo = this["sMonthTo"]; sTrIlFrom = this["sTrIlFrom"]; sTrIlTo = this["sTrIlTo"]; }); if($frm.find("#sYearFrom").length != 0) { $frm.find("#sYearFrom").val(sYearFrom).attr("selected", "selected"); } if($frm.find("#sMonthFrom").length != 0) { $frm.find("#sMonthFrom").val(sMonthFrom).attr("selected", "selected"); } if($frm.find("#sYearTo").length != 0) { $frm.find("#sYearTo").val(sYearTo).attr("selected", "selected"); } if($frm.find("#sMonthTo").length != 0) { $frm.find("#sMonthTo").val(sMonthTo).attr("selected", "selected"); } if($frm.find("#sTrIlFrom").length != 0) { $frm.find("#sTrIlFrom").val(sTrIlFrom).attr("selected", "selected"); } if($frm.find("#sTrIlTo").length != 0) { $frm.find("#sTrIlTo").val(sTrIlTo).attr("selected", "selected"); } $frm.find("select").each(function(){ if($(this).val()==""){ $(this).next().find(".slt_coverInner").text("--전체--"); }else{ $(this).next().find(".slt_coverInner").text($(this).val()); } }); }, complete:function(){ $('#sDivStat').find('option:first').attr('selected', 'selected'); $('#sDivStat').next().find(".slt_coverInner").text('--전체--'); $('[name=sVacctNo]').val(''); } }); if($frm.find("input[type=text]").length != 0) { $frm.find("input[type=text]").val(""); } if($frm.find(".ui-autocomplete-input").length != 0) { $frm.find(".ui-autocomplete-input").val("").change(); } } /* 팝업 스타일 변경 */ function fn_popStyle(p_obj, p_title, p_type) { var par_obj = $(p_obj).parent(".ui-dialog"); $(p_obj).find("div .title").remove(); /* dialog 자동 스크롤 생김 방지 */ $(par_obj).find(".ui-widget-overlay").css({ "position": "fixed", "top": "0", "left": "0", "width": "100%", "height": "100%" }); if($(p_obj).attr("id") == "div_appealInfo") { $(par_obj).find(".layer_content02").css({ "border":"1px" }); } else { $(par_obj).find(".layer_content02").css({ "border":"1px", "width":"0px", "height":"0px" }); $(par_obj).find(".layer_content02").find(".content").css ({ "height":"0px" }); } $(par_obj).css({ "background":"black" }); $(par_obj).find(".ui-dialog-content").css({ "background":"white" }); $(par_obj).find(".ui-widget-header").css({ "border":"black" }); $(par_obj).find(".ui-dialog-titlebar").css({ "background":"url('/kobis/web/comm/images/common/bg_levy.gif') repeat-x scroll 0 0 transparent", "width":"auto", "height":"20px" }).html("