mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 17:22:20 +09:00
Add krzip module
This commit is contained in:
parent
1a8b5c8b29
commit
7bef97f170
26 changed files with 1611 additions and 0 deletions
11
modules/krzip/tpl/js/admin.js
Normal file
11
modules/krzip/tpl/js/admin.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
jQuery(function ($) {
|
||||
$("#api_handler").on("change", function (e) {
|
||||
var prop = $(this).val() != 1;
|
||||
$("#epostapi_regkey").prop("disabled", prop);
|
||||
});
|
||||
});
|
||||
|
||||
/* End of file admin.js */
|
||||
/* Location: ./modules/krzip/tpl/js/admin.js */
|
||||
107
modules/krzip/tpl/js/daumapi.js
Normal file
107
modules/krzip/tpl/js/daumapi.js
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.Krzip = function () {
|
||||
var $this = $(this);
|
||||
|
||||
var values = {
|
||||
postcode : $this.find(".krzip-hidden-postcode"),
|
||||
roadAddress : $this.find(".krzip-hidden-roadAddress"),
|
||||
jibunAddress : $this.find(".krzip-hidden-jibunAddress"),
|
||||
detailAddress : $this.find(".krzip-hidden-detailAddress"),
|
||||
extraAddress : $this.find(".krzip-hidden-extraAddress")
|
||||
};
|
||||
|
||||
var ui = {
|
||||
postcode : $this.find(".krzip-postcode"),
|
||||
roadAddress : $this.find(".krzip-roadAddress"),
|
||||
jibunAddress : $this.find(".krzip-jibunAddress"),
|
||||
detailAddress : $this.find(".krzip-detailAddress"),
|
||||
extraAddress : $this.find(".krzip-extraAddress"),
|
||||
search : $this.find(".krzip-search"),
|
||||
guide : $this.find(".krzip-guide")
|
||||
};
|
||||
|
||||
var krzip = new daum.Postcode({
|
||||
oncomplete: function (response) {
|
||||
var fullAddr = "", extraAddr = "";
|
||||
|
||||
/* 도로명 주소를 선택했을 경우 */
|
||||
if(response.userSelectedType === "R") {
|
||||
fullAddr = response.roadAddress;
|
||||
/* 법정동명이 있을 경우 */
|
||||
if(response.bname !== "") {
|
||||
extraAddr += response.bname;
|
||||
}
|
||||
/* 건물명이 있을 경우 */
|
||||
if(response.buildingName !== "") {
|
||||
extraAddr += (extraAddr !== "" ? ", " + response.buildingName : response.buildingName);
|
||||
}
|
||||
if(extraAddr) {
|
||||
extraAddr = "(" + extraAddr + ")";
|
||||
}
|
||||
}
|
||||
/* 지번 주소를 선택했을 경우 */
|
||||
else {
|
||||
fullAddr = response.jibunAddress;
|
||||
}
|
||||
|
||||
/* 우편번호 저장 */
|
||||
ui.postcode.val(response.zonecode).trigger("change");
|
||||
|
||||
/* 도로명 주소 저장 */
|
||||
var roadAddr = (response.userSelectedType === "R" ? fullAddr : response.roadAddress);
|
||||
ui.roadAddress.val(roadAddr).trigger("change");
|
||||
|
||||
/* 지번 주소 저장 */
|
||||
var jibunAddr = (response.userSelectedType === "R" ? response.jibunAddress : fullAddr);
|
||||
ui.jibunAddress.val(jibunAddr ? "(" + jibunAddr + ")" : jibunAddr).trigger("change");
|
||||
|
||||
/* 부가 주소 저장 */
|
||||
ui.extraAddress.val(extraAddr).trigger("change");
|
||||
|
||||
/* 예상 주소 저장 */
|
||||
ui.guide.hide().html("");
|
||||
if(response.autoRoadAddress) {
|
||||
var expRoadAddr = (response.autoRoadAddress + extraRoadAddr);
|
||||
ui.guide
|
||||
.html("(" + xe.lang.msg_krzip_road_address_expectation.replace("%s", expRoadAddr) + ")")
|
||||
.show();
|
||||
}
|
||||
else if(response.autoJibunAddress) {
|
||||
var expJibunAddr = response.autoJibunAddress;
|
||||
ui.guide
|
||||
.html("(" + xe.lang.msg_krzip_jibun_address_expectation.replace("%s", expJibunAddr) + ")")
|
||||
.show();
|
||||
}
|
||||
|
||||
/* 상세 주소로 커서 이동 */
|
||||
ui.detailAddress.trigger("focus");
|
||||
}
|
||||
});
|
||||
|
||||
/* 상세 주소 저장 이벤트 등록 */
|
||||
var i, val, key = ["postcode", "roadAddress", "jibunAddress", "detailAddress", "extraAddress"];
|
||||
for(i = 0; i < key.length; i++) {
|
||||
val = key[i];
|
||||
ui[val].data("linked", val).on("change", function (e) {
|
||||
var $this = $(this);
|
||||
values[$this.data("linked")].val($this.val());
|
||||
});
|
||||
}
|
||||
|
||||
/* 검색 이벤트 등록 */
|
||||
key = ["postcode", "roadAddress", "jibunAddress", "extraAddress", "search"];
|
||||
for(i = 0; i < key.length; i++) {
|
||||
val = key[i];
|
||||
ui[val].on("click", function (e) {
|
||||
krzip.open();
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
/* End of file daumapi.js */
|
||||
/* Location: ./modules/krzip/tpl/js/daumapi.js */
|
||||
73
modules/krzip/tpl/js/epostapi.js
Normal file
73
modules/krzip/tpl/js/epostapi.js
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.Krzip = function (order, data) {
|
||||
var $this = $(this);
|
||||
|
||||
var values = {
|
||||
postcode : $this.find(".krzip-hidden-postcode"),
|
||||
roadAddress : $this.find(".krzip-hidden-roadAddress"),
|
||||
jibunAddress : $this.find(".krzip-hidden-jibunAddress"),
|
||||
detailAddress : $this.find(".krzip-hidden-detailAddress"),
|
||||
extraAddress : $this.find(".krzip-hidden-extraAddress")
|
||||
};
|
||||
|
||||
var ui = {
|
||||
postcode : $this.find(".krzip-postcode"),
|
||||
roadAddress : $this.find(".krzip-roadAddress"),
|
||||
jibunAddress : $this.find(".krzip-jibunAddress"),
|
||||
detailAddress : $this.find(".krzip-detailAddress"),
|
||||
extraAddress : $this.find(".krzip-extraAddress"),
|
||||
search : $this.find(".krzip-search")
|
||||
};
|
||||
|
||||
var krzip = $this.data("krzip");
|
||||
if(!krzip) {
|
||||
krzip = {
|
||||
open: function (query) {
|
||||
var request_url = "./"
|
||||
.setQuery("module", "krzip")
|
||||
.setQuery("act", "dispKrzipSearchForm")
|
||||
.setQuery("query", query);
|
||||
popopen(request_url, $this.selector);
|
||||
}
|
||||
};
|
||||
|
||||
/* 상세 주소 저장 이벤트 등록 */
|
||||
var i, val, key = ["postcode", "roadAddress", "jibunAddress", "detailAddress", "extraAddress"];
|
||||
for(i = 0; i < key.length; i++) {
|
||||
val = key[i];
|
||||
ui[val].data("linked", val).on("change", function (e) {
|
||||
var $this = $(this);
|
||||
values[$this.data("linked")].val($this.val());
|
||||
});
|
||||
}
|
||||
|
||||
/* 검색 이벤트 등록 */
|
||||
key = ["postcode", "roadAddress", "jibunAddress", "extraAddress", "search"];
|
||||
for(i = 0; i < key.length; i++) {
|
||||
val = key[i];
|
||||
ui[val].on("click", function (e) {
|
||||
var query = krzip.query;
|
||||
krzip.open(query);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(order === "query" && data) {
|
||||
krzip.query = data.query;
|
||||
ui.postcode.val(data[0]).trigger("change");
|
||||
ui.roadAddress.val(data[1]).trigger("change");
|
||||
ui.jibunAddress.val(data[2]).trigger("change");
|
||||
ui.extraAddress.val(data[4]).trigger("change");
|
||||
ui.detailAddress.trigger("focus");
|
||||
}
|
||||
|
||||
/* 인스턴스 저장 */
|
||||
$this.data("krzip", krzip);
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
/* End of file epostapi.js */
|
||||
/* Location: ./modules/krzip/tpl/js/epostapi.js */
|
||||
48
modules/krzip/tpl/js/epostapi.search.js
Normal file
48
modules/krzip/tpl/js/epostapi.search.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.Krzip = function () {
|
||||
var $this = $(this);
|
||||
|
||||
var ui = {
|
||||
input : $this.find(".krzip-input"),
|
||||
search : $this.find(".krzip-search"),
|
||||
addressList : $this.find(".krzip-addressList")
|
||||
};
|
||||
|
||||
/* 자식 요소 이벤트 등록 */
|
||||
ui.search.on("click", function (e) {
|
||||
exec_json(
|
||||
"krzip.getKrzipCodeList",
|
||||
{query: ui.input.val()},
|
||||
function (response) {
|
||||
var address_list = response.address_list;
|
||||
$this.data("address_list", address_list);
|
||||
for(var i = 0; i < address_list.length; i++) {
|
||||
var val = address_list[i];
|
||||
var $li = $("<li>").data("index", i).html(val.join(" "));
|
||||
ui.addressList.html("").append($li);
|
||||
}
|
||||
},
|
||||
function (response) {
|
||||
$this.data("address_list", "");
|
||||
ui.addressList.html("");
|
||||
}
|
||||
);
|
||||
});
|
||||
ui.addressList.on("click", "li", function (e) {
|
||||
var address_list = $this.data("address_list"),
|
||||
address = address_list[$(this).data("index")];
|
||||
opener.jQuery(window.name).Krzip("query", address);
|
||||
window.close();
|
||||
});
|
||||
ui.input.on("keydown", function (e) {
|
||||
(e.keyCode == 13 && ui.search.trigger("click"));
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
/* End of file epostapi.search.js */
|
||||
/* Location: ./modules/krzip/tpl/js/epostapi.search.js */
|
||||
55
modules/krzip/tpl/js/postcodify.js
Normal file
55
modules/krzip/tpl/js/postcodify.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.Krzip = function () {
|
||||
var $this = $(this);
|
||||
|
||||
var values = {
|
||||
postcode : $this.find(".krzip-hidden-postcode"),
|
||||
roadAddress : $this.find(".krzip-hidden-roadAddress"),
|
||||
jibunAddress : $this.find(".krzip-hidden-jibunAddress"),
|
||||
detailAddress : $this.find(".krzip-hidden-detailAddress"),
|
||||
extraAddress : $this.find(".krzip-hidden-extraAddress")
|
||||
};
|
||||
|
||||
var ui = {
|
||||
postcode : $this.find(".krzip-postcode"),
|
||||
roadAddress : $this.find(".krzip-roadAddress"),
|
||||
jibunAddress : $this.find(".krzip-jibunAddress"),
|
||||
detailAddress : $this.find(".krzip-detailAddress"),
|
||||
extraAddress : $this.find(".krzip-extraAddress"),
|
||||
search : $this.find(".krzip-search"),
|
||||
guide : $this.find(".krzip-guide")
|
||||
};
|
||||
|
||||
values.postcode.addClass("postcodify_postcode5");
|
||||
values.roadAddress.addClass("postcodify_address");
|
||||
values.jibunAddress.addClass("postcodify_jibeon_address");
|
||||
values.detailAddress.addClass("postcodify_details");
|
||||
values.extraAddress.addClass("postcodify_extra_info");
|
||||
|
||||
ui.postcode.addClass("postcodify_postcode5");
|
||||
ui.roadAddress.addClass("postcodify_address");
|
||||
ui.jibunAddress.addClass("postcodify_jibeon_address");
|
||||
ui.detailAddress.addClass("postcodify_details");
|
||||
ui.extraAddress.addClass("postcodify_extra_info");
|
||||
|
||||
ui.search.postcodifyPopUp({
|
||||
inputParent : $this,
|
||||
useFullJibeon : false,
|
||||
requireExactQuery : false,
|
||||
onSelect : function () {
|
||||
var jibun = ui.jibunAddress.val();
|
||||
if(jibun) {
|
||||
values.jibunAddress.val("(" + jibun + ")");
|
||||
ui.jibunAddress.val("(" + jibun + ")");
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
/* End of file postcodify.js */
|
||||
/* Location: ./modules/krzip/tpl/js/postcodify.js */
|
||||
Loading…
Add table
Add a link
Reference in a new issue