그누보드5 정식버전

This commit is contained in:
chicpro
2014-06-09 14:48:44 +09:00
parent 0243dabe20
commit 7983affa68
1174 changed files with 136960 additions and 0 deletions

103
js/autosave.js Normal file
View File

@ -0,0 +1,103 @@
// 임시 저장하는 시간을 초단위로 설정한다.
var AUTOSAVE_INTERVAL = 60; // 초
// 글의 제목과 내용을 바뀐 부분이 있는지 비교하기 위하여 저장해 놓는 변수
var save_wr_subject = null;
var save_wr_content = null;
function autosave() {
$("form#fwrite").each(function() {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
this.wr_content.value = CKEDITOR.instances.wr_content.getData();
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
this.wr_content.value = ed_wr_content.outputBodyHTML();
}
// 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함
if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) {
$.ajax({
url: g5_bbs_url+"/ajax.autosave.php",
data: {
"uid" : this.uid.value,
"subject": this.wr_subject.value,
"content": this.wr_content.value
},
type: "POST",
success: function(data){
if (data) {
$("#autosave_count").html(data);
}
}
});
save_wr_subject = this.wr_subject.value;
save_wr_content = this.wr_content.value;
}
});
}
$(function(){
if (g5_is_member) {
setInterval(autosave, AUTOSAVE_INTERVAL * 1000);
}
// 임시저장된 글목록을 가져옴
$("#btn_autosave").click(function(){
if ($("#autosave_pop").is(":hidden")) {
$.get(g5_bbs_url+"/ajax.autosavelist.php", function(data){
//alert(data);
//console.log( "Data: " + data);
$("#autosave_pop ul").empty();
if ($(data).find("list").find("item").length > 0) {
$(data).find("list").find("item").each(function(i) {
var id = $(this).find("id").text();
var uid = $(this).find("uid").text();
var subject = $(this).find("subject").text();
var datetime = $(this).find("datetime").text();
$("#autosave_pop ul").append('<li><a href="#none" class="autosave_load">'+subject+'</a><span>'+datetime+' <button type="button" class="autosave_del">삭제</button></span></li>');
$.data(document.body, "autosave_id"+i, id);
$.data(document.body, "autosave_uid"+i, uid);
});
}
}, "xml");
$("#autosave_pop").show();
} else {
$("#autosave_pop").hide();
}
});
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌
$(".autosave_load").live("click", function(){
var i = $(this).parents("li").index();
var as_id = $.data(document.body, "autosave_id"+i);
var as_uid = $.data(document.body, "autosave_uid"+i);
$("#fwrite input[name='uid']").val(as_uid);
$.get(g5_bbs_url+"/ajax.autosaveload.php", {"as_id":as_id}, function(data){
var subject = $(data).find("item").find("subject").text();
var content = $(data).find("item").find("content").text();
$("#wr_subject").val(subject);
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
CKEDITOR.instances.wr_content.setData(content);
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
ed_wr_content.putContents(content);
} else {
$("#fwrite #wr_content").val(content);
}
}, "xml");
$("#autosave_pop").hide();
});
$(".autosave_del").live("click", function(){
var i = $(this).parents("li").index();
var as_id = $.data(document.body, "autosave_id"+i);
$.get(g5_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){
if (data == -1) {
alert("임시 저장된글을 삭제중에 오류가 발생하였습니다.");
} else {
$("#autosave_count").html(data);
$("#autosave_pop ul > li").eq(i).remove();
}
});
});
$(".autosave_close").click(function(){ $("#autosave_pop").hide(); });
});

55
js/certify.js Normal file
View File

@ -0,0 +1,55 @@
// 본인확인 인증창 호출
function certify_win_open(type, url)
{
if(type == 'kcb-ipin')
{
var popupWindow = window.open( url, "kcbPop", "left=200, top=100, status=0, width=450, height=550" );
popupWindow.focus();
}
else if(type == 'kcb-hp')
{
var popupWindow = window.open( url, "auth_popup", "left=200, top=100, width=430, height=590, scrollbar=yes" );
popupWindow.focus();
}
else if(type == 'kcp-hp')
{
var return_gubun;
var width = 410;
var height = 500;
var leftpos = screen.width / 2 - ( width / 2 );
var toppos = screen.height / 2 - ( height / 2 );
var winopts = "width=" + width + ", height=" + height + ", toolbar=no,status=no,statusbar=no,menubar=no,scrollbars=no,resizable=no";
var position = ",left=" + leftpos + ", top=" + toppos;
var AUTH_POP = window.open(url,'auth_popup', winopts + position);
}
else if(type == 'lg-hp')
{
var popupWindow = window.open( url, "auth_popup", "left=200, top=100, width=400, height=400, scrollbar=yes" );
popupWindow.focus();
}
}
// 인증체크
function cert_confirm()
{
var type;
var val = document.fregisterform.cert_type.value
switch(val) {
case "ipin":
type = "아이핀";
break;
case "hp":
type = "휴대폰";
break;
default:
return true;
}
if(confirm("이미 "+type+"으로 본인확인을 완료하셨습니다.\n\n이전 인증을 취소하고 다시 인증하시겠습니까?"))
return true;
else
return false;
}

555
js/common.js Normal file
View File

@ -0,0 +1,555 @@
// 전역 변수
var errmsg = "";
var errfld = null;
// 필드 검사
function check_field(fld, msg)
{
if ((fld.value = trim(fld.value)) == "")
error_field(fld, msg);
else
clear_field(fld);
return;
}
// 필드 오류 표시
function error_field(fld, msg)
{
if (msg != "")
errmsg += msg + "\n";
if (!errfld) errfld = fld;
fld.style.background = "#BDDEF7";
}
// 필드를 깨끗하게
function clear_field(fld)
{
fld.style.background = "#FFFFFF";
}
function trim(s)
{
var t = "";
var from_pos = to_pos = 0;
for (i=0; i<s.length; i++)
{
if (s.charAt(i) == ' ')
continue;
else
{
from_pos = i;
break;
}
}
for (i=s.length; i>=0; i--)
{
if (s.charAt(i-1) == ' ')
continue;
else
{
to_pos = i;
break;
}
}
t = s.substring(from_pos, to_pos);
// alert(from_pos + ',' + to_pos + ',' + t+'.');
return t;
}
// 자바스크립트로 PHP의 number_format 흉내를 냄
// 숫자에 , 를 출력
function number_format(data)
{
var tmp = '';
var number = '';
var cutlen = 3;
var comma = ',';
var i;
var sign = data.match(/^[\+\-]/);
if(sign) {
data = data.replace(/^[\+\-]/, "");
}
len = data.length;
mod = (len % cutlen);
k = cutlen - mod;
for (i=0; i<data.length; i++)
{
number = number + data.charAt(i);
if (i < data.length - 1)
{
k++;
if ((k % cutlen) == 0)
{
number = number + comma;
k = 0;
}
}
}
if(sign != null)
number = sign+number;
return number;
}
// 새 창
function popup_window(url, winname, opt)
{
window.open(url, winname, opt);
}
// 폼메일 창
function popup_formmail(url)
{
opt = 'scrollbars=yes,width=417,height=385,top=10,left=20';
popup_window(url, "wformmail", opt);
}
// , 를 없앤다.
function no_comma(data)
{
var tmp = '';
var comma = ',';
var i;
for (i=0; i<data.length; i++)
{
if (data.charAt(i) != comma)
tmp += data.charAt(i);
}
return tmp;
}
// 삭제 검사 확인
function del(href)
{
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
document.location.href = encodeURI(href);
}
}
// 쿠키 입력
function set_cookie(name, value, expirehours, domain)
{
var today = new Date();
today.setTime(today.getTime() + (60*60*1000*expirehours));
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
if (domain) {
document.cookie += "domain=" + domain + ";";
}
}
// 쿠키 얻음
function get_cookie(name)
{
var find_sw = false;
var start, end;
var i = 0;
for (i=0; i<= document.cookie.length; i++)
{
start = i;
end = start + name.length;
if(document.cookie.substring(start, end) == name)
{
find_sw = true
break
}
}
if (find_sw == true)
{
start = end + 1;
end = document.cookie.indexOf(";", start);
if(end < start)
end = document.cookie.length;
return document.cookie.substring(start, end);
}
return "";
}
// 쿠키 지움
function delete_cookie(name)
{
var today = new Date();
today.setTime(today.getTime() - 1);
var value = get_cookie(name);
if(value != "")
document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
}
var last_id = null;
function menu(id)
{
if (id != last_id)
{
if (last_id != null)
document.getElementById(last_id).style.display = "none";
document.getElementById(id).style.display = "block";
last_id = id;
}
else
{
document.getElementById(id).style.display = "none";
last_id = null;
}
}
function textarea_decrease(id, row)
{
if (document.getElementById(id).rows - row > 0)
document.getElementById(id).rows -= row;
}
function textarea_original(id, row)
{
document.getElementById(id).rows = row;
}
function textarea_increase(id, row)
{
document.getElementById(id).rows += row;
}
// 글숫자 검사
function check_byte(content, target)
{
var i = 0;
var cnt = 0;
var ch = '';
var cont = document.getElementById(content).value;
for (i=0; i<cont.length; i++) {
ch = cont.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
// 숫자를 출력
document.getElementById(target).innerHTML = cnt;
return cnt;
}
// 브라우저에서 오브젝트의 왼쪽 좌표
function get_left_pos(obj)
{
var parentObj = null;
var clientObj = obj;
//var left = obj.offsetLeft + document.body.clientLeft;
var left = obj.offsetLeft;
while((parentObj=clientObj.offsetParent) != null)
{
left = left + parentObj.offsetLeft;
clientObj = parentObj;
}
return left;
}
// 브라우저에서 오브젝트의 상단 좌표
function get_top_pos(obj)
{
var parentObj = null;
var clientObj = obj;
//var top = obj.offsetTop + document.body.clientTop;
var top = obj.offsetTop;
while((parentObj=clientObj.offsetParent) != null)
{
top = top + parentObj.offsetTop;
clientObj = parentObj;
}
return top;
}
function flash_movie(src, ids, width, height, wmode)
{
var wh = "";
if (parseInt(width) && parseInt(height))
wh = " width='"+width+"' height='"+height+"' ";
return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+wh+" id="+ids+"><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' "+wh+"></embed></object>";
}
function obj_movie(src, ids, width, height, autostart)
{
var wh = "";
if (parseInt(width) && parseInt(height))
wh = " width='"+width+"' height='"+height+"' ";
if (!autostart) autostart = false;
return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>";
}
function doc_write(cont)
{
document.write(cont);
}
var win_password_lost = function(href) {
window.open(href, "win_password_lost", "left=50, top=50, width=617, height=330, scrollbars=1");
}
$(document).ready(function(){
$("#login_password_lost, #ol_password_lost").click(function(){
win_password_lost(this.href);
return false;
});
});
/**
* 포인트 창
**/
var win_point = function(href) {
var new_win = window.open(href, 'win_point', 'left=100,top=100,width=600, height=600, scrollbars=1');
new_win.focus();
}
/**
* 쪽지 창
**/
var win_memo = function(href) {
var new_win = window.open(href, 'win_memo', 'left=100,top=100,width=620,height=500,scrollbars=1');
new_win.focus();
}
/**
* 메일 창
**/
var win_email = function(href) {
var new_win = window.open(href, 'win_email', 'left=100,top=100,width=600,height=580,scrollbars=0');
new_win.focus();
}
/**
* 자기소개 창
**/
var win_profile = function(href) {
var new_win = window.open(href, 'win_profile', 'left=100,top=100,width=620,height=510,scrollbars=1');
new_win.focus();
}
/**
* 스크랩 창
**/
var win_scrap = function(href) {
var new_win = window.open(href, 'win_scrap', 'left=100,top=100,width=600,height=600,scrollbars=1');
new_win.focus();
}
/**
* 홈페이지 창
**/
var win_homepage = function(href) {
var new_win = window.open(href, 'win_homepage', '');
new_win.focus();
}
/**
* 우편번호 창
**/
var win_zip = function(href) {
var new_win = window.open(href, 'win_zip', 'width=616, height=760, scrollbars=1');
new_win.focus();
}
/**
* sms5 창
**/
var win_sms5 = function(href) {
var new_win = window.open(href, 'win_zip', 'width=474, height=560, scrollbars=1');
new_win.focus();
}
/**
* 새로운 비밀번호 분실 창 : 101123
**/
win_password_lost = function(href)
{
var new_win = window.open(href, 'win_password_lost', 'width=617, height=330, scrollbars=1');
new_win.focus();
}
/**
* 설문조사 결과
**/
var win_poll = function(href) {
var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1');
new_win.focus();
}
/**
* 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22
* alt 값만 갖는 그래픽 링크에 마우스오버 시 title 값 부여, 마우스아웃 시 title 값 제거
**/
$(function() {
$('a img').mouseover(function() {
$a_img_title = $(this).attr('alt');
$(this).attr('title', $a_img_title);
}).mouseout(function() {
$(this).attr('title', '');
});
});
/**
* 텍스트 리사이즈
**/
function font_resize(id, rmv_class, add_class)
{
var $el = $("#"+id);
$el.removeClass(rmv_class).addClass(add_class);
set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain);
set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain);
}
$(function(){
$(".win_point").click(function() {
win_point(this.href);
return false;
});
$(".win_memo").click(function() {
win_memo(this.href);
return false;
});
$(".win_email").click(function() {
win_email(this.ref);
return false;
});
$(".win_scrap").click(function() {
win_scrap(this.href);
return false;
});
$(".win_profile").click(function() {
win_profile(this.ref);
return false;
});
$(".win_homepage").click(function() {
win_homepage(this.ref);
return false;
});
$(".win_zip_find").click(function() {
win_zip(this.href);
return false;
});
$(".win_password_lost").click(function() {
win_password_lost(this.href);
return false;
});
$(".win_sms5").click(function() {
win_sms5(this.href);
return false;
});
/*
$(".win_poll").click(function() {
win_poll(this.href);
return false;
});
*/
// 사이드뷰
var sv_hide = false;
$(".sv_member, .sv_guest").click(function() {
$(".sv").removeClass("sv_on");
$(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
});
$(".sv, .sv_wrap").hover(
function() {
sv_hide = false;
},
function() {
sv_hide = true;
}
);
$(".sv_member, .sv_guest").focusin(function() {
sv_hide = false;
$(".sv").removeClass("sv_on");
$(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
});
$(".sv a").focusin(function() {
sv_hide = false;
});
$(".sv a").focusout(function() {
sv_hide = true;
});
// 셀렉트 ul
var sel_hide = false;
$('.sel_btn').click(function() {
$('.sel_ul').removeClass('sel_on');
$(this).siblings('.sel_ul').addClass('sel_on');
});
$(".sel_wrap").hover(
function() {
sel_hide = false;
},
function() {
sel_hide = true;
}
);
$('.sel_a').focusin(function() {
sel_hide = false;
});
$('.sel_a').focusout(function() {
sel_hide = true;
});
$(document).click(function() {
if(sv_hide) { // 사이드뷰 해제
$(".sv").removeClass("sv_on");
}
if (sel_hide) { // 셀렉트 ul 해제
$('.sel_ul').removeClass('sel_on');
}
});
$(document).focusin(function() {
if(sv_hide) { // 사이드뷰 해제
$(".sv").removeClass("sv_on");
}
if (sel_hide) { // 셀렉트 ul 해제
$('.sel_ul').removeClass('sel_on');
}
});
$("textarea#wr_content[maxlength]").live("keyup change", function() {
var str = $(this).val()
var mx = parseInt($(this).attr("maxlength"))
if (str.length > mx) {
$(this).val(str.substr(0, mx));
return false;
}
});
});

3
js/html5.js Normal file
View File

@ -0,0 +1,3 @@
/*! HTML5 Shiv vpre3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
Uncompressed source: https://github.com/aFarkas/html5shiv */
(function(a,b){function h(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createElement,f=a.createDocumentFragment,g=f();a.createElement=function(a){if(!l.shivMethods)return c(a);var f;return b[a]?f=b[a].cloneNode():e.test(a)?f=(b[a]=c(a)).cloneNode():f=c(a),f.canHaveChildren&&!d.test(a)?g.appendChild(f):f},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(a){return c(a),g.createElement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentShived?a:(l.shivCSS&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),g||(b=!j(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g;(function(){var c=b.createElement("a");c.innerHTML="<xyz></xyz>",f="hidden"in c,f&&typeof injectElementWithStyles=="function"&&injectElementWithStyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).display=="none"}),g=c.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:k};a.html5=l,k(b)})(this,document)

2
js/jquery-1.8.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

65
js/jquery.fancylist.js Normal file
View File

@ -0,0 +1,65 @@
(function($) {
$.fn.fancyList = function(element, clear)
{
var cfg = {
element: "li",
clear: "clear"
};
if(typeof element == "object")
cfg = $.extend( cfg, element );
else {
if(element)
cfg = $.extend( cfg, { element: element } );
if(clear)
cfg = $.extend( cfg, { clear: clear } );
}
var $element = this.find(cfg.element);
var $this = this;
if($element.size() < 1)
return;
function item_arrange()
{
var $el = $element.filter(":first");
var padding = 0;
if($el.data("padding-right") == undefined) {
padding = parseInt($el.css("padding-right"));
$el.data("padding-right", padding);
}
else
padding = $el.data("padding-right");
$element.css("padding-left", 0).css("padding-right", padding);
$element.filter("."+cfg.clear).removeClass(cfg.clear);
var wrap_width = parseInt($this.width());
var item_width = parseInt($el.outerWidth());
var line_count = parseInt((wrap_width + padding) / item_width);
if(line_count == 0)
return;
var space = parseInt(wrap_width % item_width);
if((space + padding) < item_width) {
space = wrap_width - ((item_width - padding) * line_count);
var new_padding = parseInt(space / (line_count * 2));
if(new_padding > padding)
$element.css("padding-left", new_padding+"px").css("padding-right", new_padding);
}
$element.filter(":nth-child("+line_count+"n)").css("padding-right", 0);
$element.filter(":nth-child("+line_count+"n+1)").addClass(cfg.clear);
}
item_arrange();
$(window).resize(function() {
item_arrange();
});
}
}(jQuery));

109
js/jquery.menu.js Normal file
View File

@ -0,0 +1,109 @@
$(function(){
var hide_menu = false;
var mouse_event = false;
var oldX = oldY = 0;
$(document).mousemove(function(e) {
if(oldX == 0) {
oldX = e.pageX;
oldY = e.pageY;
}
if(oldX != e.pageX || oldY != e.pageY) {
mouse_event = true;
}
});
// 주메뉴
var $gnb = $(".gnb_1dli > a");
$gnb.mouseover(function() {
if(mouse_event) {
$("#hd").addClass("hd_zindex");
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
$(this).parent().addClass("gnb_1dli_over gnb_1dli_on");
menu_rearrange($(this).parent());
hide_menu = false;
}
});
$gnb.mouseout(function() {
hide_menu = true;
});
$(".gnb_2dli").mouseover(function() {
hide_menu = false;
});
$(".gnb_2dli").mouseout(function() {
hide_menu = true;
});
$gnb.focusin(function() {
$("#hd").addClass("hd_zindex");
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
$(this).parent().addClass("gnb_1dli_over gnb_1dli_on");
menu_rearrange($(this).parent());
hide_menu = false;
});
$gnb.focusout(function() {
hide_menu = true;
});
$(".gnb_2da").focusin(function() {
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
var $gnb_li = $(this).closest(".gnb_1dli").addClass("gnb_1dli_over gnb_1dli_on");
menu_rearrange($(this).closest(".gnb_1dli"));
hide_menu = false;
});
$(".gnb_2da").focusout(function() {
hide_menu = true;
});
$('#gnb_1dul>li').bind('mouseleave',function(){
submenu_hide();
});
$(document).bind('click focusin',function(){
if(hide_menu) {
submenu_hide();
}
});
});
function submenu_hide() {
$("#hd").removeClass("hd_zindex");
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
}
function menu_rearrange(el)
{
var width = $("#gnb_1dul").width();
var left = w1 = w2 = 0;
var idx = $(".gnb_1dli").index(el);
var max_menu_count = 0;
var $gnb_1dli;
for(i=0; i<=idx; i++) {
$gnb_1dli = $(".gnb_1dli:eq("+i+")");
w1 = $gnb_1dli.outerWidth();
if($gnb_1dli.find(".gnb_2dul").size())
w2 = $gnb_1dli.find(".gnb_2dli > a").outerWidth(true);
else
w2 = w1;
if((left + w2) > width) {
if(max_menu_count == 0)
max_menu_count = i + 1;
}
if(max_menu_count > 0 && (idx + 1) % max_menu_count == 0) {
el.removeClass("gnb_1dli_over").addClass("gnb_1dli_over2");
left = 0;
} else {
left += w1;
}
}
}

View File

@ -0,0 +1,92 @@
var reg_mb_id_check = function() {
var result = "";
$.ajax({
type: "POST",
url: g5_bbs_url+"/ajax.mb_id.php",
data: {
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
},
cache: false,
async: false,
success: function(data) {
result = data;
}
});
return result;
}
// 추천인 검사
var reg_mb_recommend_check = function() {
var result = "";
$.ajax({
type: "POST",
url: g5_bbs_url+"/ajax.mb_recommend.php",
data: {
"reg_mb_recommend": encodeURIComponent($("#reg_mb_recommend").val())
},
cache: false,
async: false,
success: function(data) {
result = data;
}
});
return result;
}
var reg_mb_nick_check = function() {
var result = "";
$.ajax({
type: "POST",
url: g5_bbs_url+"/ajax.mb_nick.php",
data: {
"reg_mb_nick": ($("#reg_mb_nick").val()),
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
},
cache: false,
async: false,
success: function(data) {
result = data;
}
});
return result;
}
var reg_mb_email_check = function() {
var result = "";
$.ajax({
type: "POST",
url: g5_bbs_url+"/ajax.mb_email.php",
data: {
"reg_mb_email": $("#reg_mb_email").val(),
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
},
cache: false,
async: false,
success: function(data) {
result = data;
}
});
return result;
}
var reg_mb_hp_check = function() {
var result = "";
$.ajax({
type: "POST",
url: g5_bbs_url+"/ajax.mb_hp.php",
data: {
"reg_mb_hp": $("#reg_mb_hp").val(),
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
},
cache: false,
async: false,
success: function(data) {
result = data;
}
});
return result;
}

93
js/jquery.sms_paging.js Normal file
View File

@ -0,0 +1,93 @@
/**************************************************************************************
* jQuery Paging 0.1.7
* by composite (ukjinplant@msn.com)
* http://composite.tistory.com
* This project licensed under a MIT License.
**************************************************************************************/;
(function($){
//default properties.
var a=/a/i,defs={
liitem:'li', item:'a',next:'[&gt;{5}]',prev:'[{4}&lt;]',format:'[{0}]',
itemClass:'',appendhtml:'',sideClass:'paging-side',prevClass:'paging-side',
itemCurrent:'active',length:10,max:1,current:1,append:false
,href:'#{0}',event:true,first:'[1&lt;&lt;]',last:'[&gt;&gt;{6}]'
},InStr=function(strSearch, charSearchFor) {
return strSearch.indexOf(charSearchFor);
},format=function(str){
var arg=arguments;
return str.replace(/\{(\d+)\}/g,function(m,d){
if(+d<0) return m;
else return arg[+d+1]||"";
});
},item,make=function(op,page,cls,str){
var is_current = false;
if( InStr( cls , op.itemCurrent) > -1 ){
item=document.createElement("strong");
is_current = true;
} else {
item=document.createElement(op.item);
}
item.className=cls;
item.innerHTML=format(str,page,op.length,op.start,op.end,op.start-1,op.end+1,op.max);
if(a.test(op.item)) item.href=format(op.href,page);
if(op.event){
$(item).bind('click',function(e){
var fired=true;
if($.isFunction(op.onclick)) fired=op.onclick.call(item,e,page,op);
if(fired==undefined||fired)
op.origin.paging($.extend({},op,{current:page}));
return fired;
});
/*
$liitem= $(document.createElement(op.liitem));
$liitem.addClass(cls);
$liitem.append($(item));
*/
if(op.appendhtml){
$(item).append(op.appendhtml);
}
$(item).appendTo(op.origin);
if( is_current ){
$(item).prepend('<span class="sound_only">열린</span>');
} else {
(op.origin).append('\n');
}
//bind event for each elements.
var ev='on';
switch(str){
case op.prev:ev+='prev';break;
case op.next:ev+='next';break;
case op.first:ev+='first';break;
case op.last:ev+='last';break;
default:ev+='item';break;
}
if($.isFunction(op[ev])) op[ev].call(item,page,op);
}
return item;
};
$.fn.paging=function(op){
op=$.extend({origin:this},defs,op||{});this.html('');
if(op.max<1) op.max=1; if(op.current<1) op.current=1;
op.start=Math.floor((op.current-1)/op.length)*op.length+1;
op.end=op.start-1+op.length;
if(op.end>op.max) op.end=op.max;
if(!op.append) this.empty();
//prev button
if(op.current>op.length){
//if(op.first!==false) make(op,1,op.sideClass,op.first);
make(op,op.start-1,op.prevClass,op.prev);
}
//pages button
for(var i=op.start;i<=op.end;i++){
make(op,i,op.itemClass+(i==op.current?' '+op.itemCurrent:''),op.format);
}
//next button
if(op.current<=Math.floor(op.max/op.length)*op.length){
if(op.max > op.length && op.max > op.end ){ make(op,op.end+1,op.sideClass,op.next); }
//if(op.last!==false) make(op,op.max,op.sideClass,op.last);
}
//last button
};
})(jQuery);

165
js/md5.js Normal file
View File

@ -0,0 +1,165 @@
if (typeof(MD5_JS) == 'undefined') // 한번만 실행
{
var MD5_JS = true;
/* See http://pajhome.org.uk/crypt/md5 for more info */
var hexcase = 0;
var b64pad = "";
var chrsz = 8;
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
function core_md5(x, len)
{
x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878;
for(var i = 0; i < x.length; i += 16)
{
var olda = a; var oldb = b; var oldc = c; var oldd = d;
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}
function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); }
function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); }
function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); }
function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }
function core_hmac_md5(key, data) {
var bkey = str2binl(key);
if(bkey.length > 16)
bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
return core_md5(opad.concat(hash), 512 + 128);
}
function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); }
function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
function str2binl(str)
{
var bin = Array(); var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
return bin;
}
function binl2str(bin)
{
var str = ""; var mask = (1 << chrsz) - 1;
for(var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str;
}
function binl2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = "";
for(var i = 0; i < binarray.length * 4; i++)
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
return str;
}
function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
| ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32)
str += b64pad;
else
str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}
}

4
js/modernizr.custom.70111.js vendored Normal file
View File

@ -0,0 +1,4 @@
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-cssclasses-testallprops-css_overflow_scrolling
*/
;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e});for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),Modernizr.addTest("overflowscrolling",function(){return Modernizr.testAllProps("overflowScrolling")});

93
js/viewimageresize.js Normal file
View File

@ -0,0 +1,93 @@
(function($) {
$.fn.viewimageresize = function(selector)
{
var cfg = {
selector: "img"
};
if(typeof selector == "object") {
cfg = $.extend(cfg, selector);
} else {
if(selector) {
cfg = $.extend({ selector: selector });
}
}
var $img = this.find(cfg.selector);
var $this = this;
function image_resize()
{
var width = $this.width();
$img.each(function() {
if($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if($(this).data("width") > width) {
$(this).removeAttr("width")
.removeAttr("height")
.css("width","")
.css("height", "");
if($(this).data("width") > width) {
$(this).css("width", "100%");
}
} else {
$(this).attr("width", $(this).data("width"));
}
});
}
$(window).on("load", function() {
image_resize();
});
$(window).on("resize", function() {
image_resize();
});
}
$.fn.viewimageresize2 = function(selector)
{
var cfg = {
selector: "img"
};
if(typeof selector == "object") {
cfg = $.extend(cfg, selector);
} else {
if(selector) {
cfg = $.extend({ selector: selector });
}
}
var $img = this.find(cfg.selector);
var $this = this;
function image_resize()
{
var width = $this.width();
$img.each(function() {
$(this).removeAttr("width")
.removeAttr("height")
.css("width","")
.css("height", "");
if($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if($(this).data("width") > width) {
$(this).css("width", "100%");
}
});
}
$(window).on("resize", function() {
image_resize();
});
image_resize();
}
}(jQuery));

370
js/wrest.js Normal file
View File

@ -0,0 +1,370 @@
var wrestMsg = "";
var wrestFld = null;
var wrestFldDefaultColor = "";
//var wrestFldBackColor = "#ff3061";
// subject 속성값을 얻어 return, 없으면 tag의 name을 넘김
function wrestItemname(fld)
{
//return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name );
var id = fld.getAttribute("id");
var labels = document.getElementsByTagName("label");
var el = null;
for(i=0; i<labels.length; i++) {
if(id == labels[i].htmlFor) {
el = labels[i];
break;
}
}
if(el != null) {
var text = el.innerHTML.replace(/[<].*[>].*[<]\/+.*[>]/gi, "");
if(text == '') {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("placeholder") ? fld.getAttribute("placeholder") : fld.name );
} else {
return text;
}
} else {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("placeholder") ? fld.getAttribute("placeholder") : fld.name );
}
}
// 양쪽 공백 없애기
function wrestTrim(fld)
{
var pattern = /(^\s+)|(\s+$)/g; // \s 공백 문자
return fld.value.replace(pattern, "");
}
// 필수 입력 검사
function wrestRequired(fld)
{
if (wrestTrim(fld) == "") {
if (wrestFld == null) {
// 셀렉트박스일 경우에도 필수 선택 검사합니다.
wrestMsg = wrestItemname(fld) + " : 필수 "+(fld.type=="select-one"?"선택":"입력")+"입니다.\n";
wrestFld = fld;
}
}
}
// 김선용 2006.3 - 전화번호(휴대폰) 형식 검사 : 123-123(4)-5678
function wrestTelNum(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
if(!pattern.test(fld.value)){
if(wrestFld == null){
wrestMsg = wrestItemname(fld)+" : 전화번호 형식이 올바르지 않습니다.\n\n하이픈(-)을 포함하여 입력하세요.\n";
wrestFld = fld;
fld.select();
}
}
}
// 이메일주소 형식 검사
function wrestEmail(fld)
{
if (!wrestTrim(fld)) return;
//var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시
var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
if (!pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 이메일주소 형식이 아닙니다.\n";
wrestFld = fld;
}
}
}
// 한글인지 검사 (자음, 모음 조합된 한글만 가능)
function wrestHangul(fld)
{
if (!wrestTrim(fld)) return;
//var pattern = /([^가-힣\x20])/i;
var pattern = /([^가-힣\x20])/;
if (pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음 조합된 한글만 가능)\n';
wrestFld = fld;
}
}
}
// 한글인지 검사2 (자음, 모음만 있는 한글도 가능)
function wrestHangul2(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i;
//var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/;
if (pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다.\n';
wrestFld = fld;
}
}
}
// 한글,영문,숫자인지 검사3
function wrestHangulAlNum(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /([^가-힣\x20^a-z^A-Z^0-9])/i;
if (pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글, 영문, 숫자가 아닙니다.\n';
wrestFld = fld;
}
}
}
// 한글,영문 인지 검사
function wrestHangulAlpha(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /([^가-힣\x20^a-z^A-Z])/i;
if (pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글, 영문이 아닙니다.\n';
wrestFld = fld;
}
}
}
// 숫자인지검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24
function wrestNumeric(fld)
{
if (fld.value.length > 0) {
for (i = 0; i < fld.value.length; i++) {
if (fld.value.charAt(i) < '0' || fld.value.charAt(i) > '9') {
wrestMsg = wrestItemname(fld) + " : 숫자가 아닙니다.\n";
wrestFld = fld;
}
}
}
}
// 영문자 검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24
function wrestAlpha(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z]+$)/;
if (!pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 영문이 아닙니다.\n";
wrestFld = fld;
}
}
}
// 영문자와 숫자 검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-07-07
function wrestAlNum(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z0-9]+$)/;
if (!pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 영문 또는 숫자가 아닙니다.\n";
wrestFld = fld;
}
}
}
// 영문자와 숫자 그리고 _ 검사
function wrestAlNum_(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z0-9\_]+$)/;
if (!pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 영문, 숫자, _ 가 아닙니다.\n";
wrestFld = fld;
}
}
}
// 최소 길이 검사
function wrestMinLength(fld, css)
{
if (!wrestTrim(fld)) return;
var str = css.split('_'); // minlength_?? <-- str[1]
if (wrestFld == null) {
if (fld.value.length < parseInt(str[1])) {
wrestMsg = wrestItemname(fld) + " : 최소 "+str[1]+"글자 이상 입력하세요.\n";
wrestFld = fld;
}
}
}
// 이미지 확장자
function wrestImgExt(fld)
{
if (!wrestTrim(fld)) return;
var pattern = /\.(gif|jpg|png)$/i; // jpeg 는 제외
if(!pattern.test(fld.value)){
if(wrestFld == null){
wrestMsg = wrestItemname(fld)+" : 이미지 파일이 아닙니다.\n.gif .jpg .png 파일만 가능합니다.\n";
wrestFld = fld;
fld.select();
}
}
}
// 확장자
function wrestExtension(fld, css)
{
if (!wrestTrim(fld)) return;
var str = css.split("="); // ext=?? <-- str[1]
var src = fld.value.split(".");
var ext = src[src.length - 1];
if (wrestFld == null) {
if (ext.toLowerCase() < str[1].toLowerCase()) {
wrestMsg = wrestItemname(fld) + " : ."+str[1]+" 파일만 가능합니다.\n";
wrestFld = fld;
}
}
}
// 공백 검사후 공백을 "" 로 변환
function wrestNospace(fld)
{
var pattern = /(\s)/g; // \s 공백 문자
if (pattern.test(fld.value)) {
if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 공백이 없어야 합니다.\n";
wrestFld = fld;
}
}
}
// submit 할 때 속성을 검사한다.
function wrestSubmit()
{
wrestMsg = "";
wrestFld = null;
var attr = null;
// 해당폼에 대한 요소의 개수만큼 돌려라
for (var i=0; i<this.elements.length; i++) {
var el = this.elements[i];
// Input tag 의 type 이 text, file, password 일때만
// 셀렉트 박스일때도 필수 선택 검사합니다. select-one
if (el.type=="text" || el.type=="hidden" || el.type=="file" || el.type=="password" || el.type=="select-one" || el.type=="textarea") {
if (el.getAttribute("required") != null) {
wrestRequired(el);
}
var array_css = el.className.split(" "); // class 를 공백으로 나눔
el.style.backgroundColor = wrestFldDefaultColor;
// 배열의 길이만큼 돌려라
for (var k=0; k<array_css.length; k++) {
var css = array_css[k];
switch (css) {
case "required" : wrestRequired(el); break;
case "trim" : wrestTrim(el); break;
case "email" : wrestEmail(el); break;
case "hangul" : wrestHangul(el); break;
case "hangul2" : wrestHangul2(el); break;
case "hangulalpha" : wrestHangulAlpha(el); break;
case "hangulalnum" : wrestHangulAlNum(el); break;
case "nospace" : wrestNospace(el); break;
case "numeric" : wrestNumeric(el); break;
case "alpha" : wrestAlpha(el); break;
case "alnum" : wrestAlNum(el); break;
case "alnum_" : wrestAlNum_(el); break;
case "telnum" : wrestTelNum(el); break; // 김선용 2006.3 - 전화번호 형식 검사
case "imgext" : wrestImgExt(el); break;
default :
// css 가 minlength_ 로 시작한다면 _ 뒤의 숫자는 최소길이값
if (/^minlength\_/.test(css)) {
wrestMinLength(el, css); break;
} else if (/^extension\=/.test(css)) {
wrestExtension(el, css); break;
}
} // switch (css)
} // for (k)
} // if (el)
} // for (i)
// 필드가 null 이 아니라면 오류메세지 출력후 포커스를 해당 오류 필드로 옮김
// 오류 필드는 배경색상을 바꾼다.
if (wrestFld != null) {
// 경고메세지 출력
alert(wrestMsg);
if (wrestFld.style.display != "none") {
var id = wrestFld.getAttribute("id");
// 오류메세지를 위한 element 추가
var msg_el = document.createElement("strong");
msg_el.id = "msg_"+id;
msg_el.className = "msg_sound_only";
msg_el.innerHTML = wrestMsg;
wrestFld.parentNode.insertBefore(msg_el, wrestFld);
var new_href = document.location.href.replace(/#msg.+$/, "")+"#msg_"+id;
document.location.href = new_href;
//wrestFld.style.backgroundColor = wrestFldBackColor;
if (typeof(wrestFld.select) != "undefined")
wrestFld.select();
wrestFld.focus();
}
return false;
}
if (this.oldsubmit && this.oldsubmit() == false)
return false;
return true;
}
// 초기에 onsubmit을 가로채도록 한다.
function wrestInitialized()
{
for (var i = 0; i < document.forms.length; i++) {
// onsubmit 이벤트가 있다면 저장해 놓는다.
if (document.forms[i].onsubmit) {
document.forms[i].oldsubmit = document.forms[i].onsubmit;
}
document.forms[i].onsubmit = wrestSubmit;
}
}
// 폼필드 자동검사
$(document).ready(function(){
// onload
wrestInitialized();
});

101
js/zip.js Normal file
View File

@ -0,0 +1,101 @@
// 시도 정보
// sido 의 '서울특별시' 는 sigungu 의 '서울특별시' 와 일치해야 함
var sido = new Array(
Array('서울특별시' , '서울'),
Array('부산광역시' , '부산'),
Array('대구광역시' , '대구'),
Array('인천광역시' , '인천'),
Array('광주광역시' , '광주'),
Array('대전광역시' , '대전'),
Array('울산광역시' , '울산'),
Array('세종특별자치시' , '세종'),
Array('경기도' , '경기'),
Array('강원도' , '강원'),
Array('충청북도' , '충북'),
Array('충청남도' , '충남'),
Array('전라북도' , '전북'),
Array('전라남도' , '전남'),
Array('경상북도' , '경북'),
Array('경상남도' , '경남'),
Array('제주특별자치도' , '제주')
);
// 시군구 정보
var sigungu = new Array();
sigungu['서울특별시'] = '강남구,강동구,강북구,강서구,관악구,광진구,구로구,금천구,노원구,도봉구,동대문구,동작구,마포구,서대문구,서초구,성동구,성북구,송파구,양천구,영등포구,용산구,은평구,종로구,중구,중랑구';
sigungu['부산광역시'] = '강서구,금정구,기장군,남구,동구,동래구,부산진구,북구,사상구,사하구,서구,수영구,연제구,영도구,중구,해운대구';
sigungu['대구광역시'] = '남구,달서구,달성군,동구,북구,서구,수성구,중구';
sigungu['인천광역시'] = '강화군,계양구,남구,남동구,동구,부평구,서구,연수구,옹진군,중구';
sigungu['광주광역시'] = '광산구,남구,동구,북구,서구';
sigungu['대전광역시'] = '대덕구,동구,서구,유성구,중구';
sigungu['울산광역시'] = '남구,동구,북구,울주군,중구';
sigungu['세종특별자치시'] = '없음';
sigungu['경기도'] = '가평군,고양시 덕양구,고양시 일산동구,고양시 일산서구,과천시,광명시,광주시,구리시,군포시,김포시,남양주시,동두천시,부천시 소사구,부천시 오정구,부천시 원미구,성남시 분당구,성남시 수정구,성남시 중원구,수원시 권선구,수원시 영통구,수원시 장안구,수원시 팔달구,시흥시,안산시 단원구,안산시 상록구,안성시,안양시 동안구,안양시 만안구,양주시,양평군,여주시,연천군,오산시,용인시 기흥구,용인시 수지구,용인시 처인구,의왕시,의정부시,이천시,파주시,평택시,포천시,하남시,화성시';
sigungu['강원도'] = '강릉시,고성군,동해시,삼척시,속초시,양구군,양양군,영월군,원주시,인제군,정선군,철원군,춘천시,태백시,평창군,홍천군,화천군,횡성군';
sigungu['충청북도'] = '괴산군,단양군,보은군,영동군,옥천군,음성군,제천시,증평군,진천군,청원군,청주시 상당구,청주시 흥덕구,충주시';
sigungu['충청남도'] = '계룡시,공주시,금산군,논산시,당진시,보령시,부여군,서산시,서천군,아산시,예산군,천안시 동남구,천안시 서북구,청양군,태안군,홍성군';
sigungu['전라북도'] = '전주시 완산구,전주시 덕진구,군산시,익산시,정읍시,남원시,김제시,완주군,진안군,무주군,장수군,임실군,순창군,고창군,부안군';
sigungu['전라남도'] = '강진군,고흥군,곡성군,광양시,구례군,나주시,담양군,목포시,무안군,보성군,순천시,신안군,여수시,영광군,영암군,완도군,장성군,장흥군,진도군,함평군,해남군,화순군';
sigungu['경상북도'] = '경산시,경주시,고령군,구미시,군위군,김천시,문경시,봉화군,상주시,성주군,안동시,영덕군,영양군,영주시,영천시,예천군,울릉군,울진군,의성군,청도군,청송군,칠곡군,포항시 남구,포항시 북구';
sigungu['경상남도'] = '거제시,거창군,고성군,김해시,남해군,밀양시,사천시,산청군,양산시,의령군,진주시,창녕군,창원시 마산합포구,창원시 마산회원구,창원시 성산구,창원시 의창구,창원시 진해구,통영시,하동군,함안군,함양군,합천군';
sigungu['제주특별자치도'] = '서귀포시,제주시';
$(function() {
// 시도 선택시 시군구 option 을 만든다.
$("#sido").bind("change", function() {
var sido = $(this).val();
gugun_make(sido);
});
// 로딩시 시도 option 을 만든다.
for (var i=0; i<sido.length; i++) {
$("#sido").append($('<option></option>').val(sido[i][0]).text(sido[i][1]));
}
});
function gugun_make(sido)
{
var gugun = document.getElementById("gugun");
gugun.options.length = 1;
gugun.options[0].value = "";
gugun.options[0].text = "- 시군구 선택 -";
gugun.options[0].selected = true;
if (!sido) {
return;
}
sojae = sigungu[sido].split(",");
gugun.options.length = sojae.length+1;
for (i=0; i<sojae.length; i++) {
gugun.options[i+1].value = (sojae[i] == "없음") ? "" : sojae[i];
gugun.options[i+1].text = sojae[i];
}
}
function search_call(page)
{
$("#q_info").fadeOut(200);
var sido = $("#sido").val();
var gugun = $("#gugun").val();
var q = $.trim($("#q").val());
if(!page)
page = 1;
$.getJSON("//juso.sir.co.kr/search.php?sido="+sido+"&gugun="+gugun+"&page="+page+"&q="+q+"&callback=?",
function(data) {
$("#result").empty();
if(data.error) {
alert(data.error);
return false;
}
$("#result").html(data.juso);
}
);
}