site.js 에 호환성문제가 있는것으로 추정되어 롤백

This commit is contained in:
iyak 2025-04-03 06:07:29 +00:00
parent 3526c0ff85
commit 46fd22fb87
2 changed files with 124 additions and 370 deletions

View File

@ -89,7 +89,7 @@ function viewuser(uno, id, useGet) {
$("body").append("<form id=\"frmcdduv\" name=\"frmcdduv\" method=\"post\" action=\"/CDD/Uv\" target=\"" + id + "\"><input type=\"hidden\" name=\"IsFirstOpen\" value=\"true\" /><input type=\"hidden\" id=\"userno\" name=\"UserNo\" value=\"" + uno + "\" /></form>");
}
if (useGet) {
winopen('/CDD/Uv?UserNo='+uno, id, 1015, 600);
winopen('/CDD/Uv?UserNo=' + uno, id, 1015, 600);
} else {
winopen('', id, 1015, 600);
$("#frmcdduv").submit();
@ -101,8 +101,8 @@ function rmsplit(v) {
function msgtemp(m, t) {
$("#msgtemp").remove();
$("body.sitebody").append("<div id=\"msgtemp\" class=\"msgtemp\"><div>" + (m.toString() == "1" ? "저장해야 반영됩니다." : m) + "</div><div class=\"small\">클릭으로 닫기 | 4초후 자동닫힘</div></div>");
$("#msgtemp").css("top", event.pageY-50);
$("#msgtemp").css("left", event.pageX-50);
$("#msgtemp").css("top", event.pageY - 50);
$("#msgtemp").css("left", event.pageX - 50);
$("#msgtemp").slideToggle('fast');
clearTimeout(_msgtemptime);
_msgtemptime = setTimeout(function () {
@ -319,7 +319,7 @@ function stopsound(a) {
}
function msgerror(isadmin) {
isadmin = isadmin || false;
msg((isadmin ? "운영자에게":"시스템관리자") + "에게 문의해주세요.");
msg((isadmin ? "운영자에게" : "시스템관리자") + "에게 문의해주세요.");
}
function uploadeditorimage(files, el, fdata, _callback, _url) {
_url = _url || '/aCommon/UploadEditorImageUrl';
@ -346,94 +346,6 @@ function rcchange(s) {
eval($(s).attr("data-scmethod"));
}
}
/** 로딩이미지 보여주기 */
function showLoadingImage() {
// 이미 존재하는 경우 중복 생성 방지
if (document.getElementById('custom-loading-overlay')) {
return;
}
// 로딩 이미지 요소 생성
const loadingDiv = document.createElement('div');
loadingDiv.id = 'custom-loading-overlay';
// 인라인 스타일 대신 클래스 사용을 위한 스타일 추가
const style = document.createElement('style');
style.textContent = `
#custom-loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
#custom-loading-spinner {
width: 40px;
height: 40px;
background-color: #fff;
border-radius: 100%;
-webkit-animation: sk-scaleout 1.0s infinite ease-in-out;
animation: sk-scaleout 1.0s infinite ease-in-out;
}
@-webkit-keyframes sk-scaleout {
0% { -webkit-transform: scale(0) }
100% { -webkit-transform: scale(1.0); opacity: 0; }
}
@keyframes sk-scaleout {
0% { transform: scale(0); -webkit-transform: scale(0); }
100% { transform: scale(1.0); -webkit-transform: scale(1.0); opacity: 0; }
}
/* 애니메이션 미지원 브라우저용 대체 스타일 */
.no-animation #custom-loading-spinner {
background-color: #3498db;
border: 5px solid #f3f3f3;
}
`;
document.head.appendChild(style);
// 브라우저 애니메이션 지원 확인
const supportsAnimation = 'AnimationEvent' in window ||
'WebKitAnimationEvent' in window ||
'MozAnimationEvent' in window ||
'msAnimationEvent' in window ||
'OAnimationEvent' in window;
// 기본 로딩 스피너
const spinnerDiv = document.createElement('div');
spinnerDiv.id = 'custom-loading-spinner';
// 애니메이션을 지원하지 않는 브라우저에는 정적 스타일 적용
if (!supportsAnimation) {
loadingDiv.className = 'no-animation';
}
loadingDiv.appendChild(spinnerDiv);
document.body.appendChild(loadingDiv);
}
/** 로딩이미지 제거 */
function hideLoadingImage() {
const loadingDiv = document.getElementById('custom-loading-overlay');
if (loadingDiv) {
// 스타일 요소도 정리
const style = document.querySelector('style[id^="custom-loading-style"]');
if (style) {
document.head.removeChild(style);
}
document.body.removeChild(loadingDiv);
}
}
function ajaxing(tf) {
if (!_jsislayer2) {
bglayer(false);
@ -473,7 +385,7 @@ function msgok(sd, m, hidemb) {
if (hidemb) {
$(".mainokbutton,.mainokbutton2").hide();
}
msg((sd == 0 ? "삭제되었습니다." : sd == 1 ? "저장되었습니다." : sd == -1 ? "권한이 없습니다.": sd == 2 ? "변경되었습니다." :"?") + m);
msg((sd == 0 ? "삭제되었습니다." : sd == 1 ? "저장되었습니다." : sd == -1 ? "권한이 없습니다." : sd == 2 ? "변경되었습니다." : "?") + m);
}
function msgok2(sd, m, hidemb) {
m = m || "";
@ -638,7 +550,7 @@ function msglayer(msg, bging) {
}
function msglayer2(msg) {
if (msg.indexOf('<') < 0) {
$("#layermessage2 div.msg").html("- " + msg + " -");
$("#layermessage2 div.msg").html("- " + msg + " -");
} else {
$("#layermessage2 div.msg").html(msg);
}
@ -870,214 +782,111 @@ function prg(id) {
function prgstop() {
$("#bglayer .progress, #bglayer2 .progress").hide();
}
function capfile(url, data, callback, noeval, setBG, jsislayer2) {
// 로딩바 표시 추가
showLoadingImage();
function capfile(url, data, callback, noeval, setBG, jsislayer2, abscaller) {
noeval = noeval || false;
_abscaller = abscaller || false;
_jsislayer2 = jsislayer2 || false;
_setBG = setBG || false;
// 백그라운드 레이어 표시
capfilecallback = callback;
if (_setBG) {
prg('');
bglayer();
}
if (_jsislayer2) {
prg('2');
bglayer2();
}
// iOS 호환성을 위한 처리
// FormData 객체 확인 및 필요시 수정
if (data instanceof FormData) {
// iOS에서 FormData 디버깅을 위한 로그 (개발 중에만 사용)
console.log("FormData 항목 수:", [...data.entries()].length);
}
// 콜백 함수 실행 헬퍼
function executeCallback(result) {
// 로딩바 숨김 추가
hideLoadingImage();
if (_setBG) {
$("#bglayer").hide();
}
if (noeval) {
// 함수 객체로 직접 호출
if (typeof callback === 'function') {
callback(result);
}
}
else {
// 기존 방식 유지 (eval 사용)
// 보안상 권장되지 않지만 기존 코드 호환성 유지
try {
window.capResult = result; // 전역 변수로 결과 저장
if (typeof callback === 'string') {
if (callback.substr(callback.length - 1, 1) == ")") {
eval(callback);
} else {
eval(callback + "()");
}
}
} catch (e) {
console.error("콜백 실행 오류:", e);
}
}
}
var ajaxRequest = $.ajax({
type: "POST",
url: url,
contentType: false,
processData: false,
data: data,
timeout: 60000,
xhr: function () {
var xhr = $.ajaxSettings.xhr();
// 업로드 진행 상황 모니터링 (iOS에서 파일 업로드 진행 확인)
if (xhr.upload) {
xhr.upload.addEventListener('progress', function (e) {
if (e.lengthComputable) {
var percent = Math.round((e.loaded / e.total) * 100);
console.log("업로드 진행률: " + percent + "%");
}
}, false);
}
return xhr;
}
data: data
});
// 에러 처리
ajaxRequest.fail(function (jqXHR, textStatus, errorThrown) {
console.error("Ajax 요청 실패:", textStatus, errorThrown);
// 타임아웃인 경우 별도 처리
if (textStatus === "timeout") {
alert("요청 시간이 초과되었습니다. 다시 시도해 주세요.");
// 로딩바 숨김 추가 (타임아웃 시)
hideLoadingImage();
ajaxRequest.error(function (e) {
prgstop();
isCaping = false;
console.log(e.responseText);
if (_jsislayer2) {
msg2("개발담당자에게 문의해주세요...");
}
else {
// 기존 에러 처리 로직 유지 (하지만 에러 시 다른 처리를 권장)
executeCallback({
code: -1,
message: "요청 처리 중 오류가 발생했습니다",
error: textStatus
});
msg("개발담당자에게 문의해주세요...");
}
});
ajaxRequest.done(function (data) {
if (data && data.code == 1000) {
executeCallback(data);
prgstop();
if (_setBG) {
$("#bglayer").hide();
}
capResult = data;
if (capResult.code == 1000 || _abscaller) {
eval(capfilecallback.substr(capfilecallback.length - 1, 1) == ")" ? capfilecallback : (capfilecallback + "()"));
}
else {
console.warn("서버 응답 코드가 1000이 아닙니다:", data);
executeCallback(data);
console.log(capResult.code);
console.log(capResult.msg);
console.log(capResult.obj);
}
if (_jsislayer2) {
bglayer2(false);
}
else {
bglayer(false);
}
});
}
function capfileform(url, fid, callback, iseval, getpost, autoMsg, noBG, jsislayer2) {
_jsislayer2 = jsislayer2 || false;
if (!isCaping) {
// 로딩바 표시 추가
showLoadingImage();
isAutoMsg = autoMsg || false;
_bging = noBG || false;
if (!_bging) { ajaxing(); }
if (_jsislayer2) { bglayer2(); }
if (!_bging) {
prg('');
ajaxing();
}
if (_jsislayer2) {
prg('2');
bglayer2();
}
_callback = callback;
capResult = null;
capOK = false;
isCaping = true;
// 폼 요소 직접 참조
const form = document.getElementById(fid);
// iOS 호환성을 위한 FormData 생성 방식 개선
let formData;
try {
// 기본 FormData 생성 시도
formData = new FormData(form);
// iOS 호환성 검사 - 파일 입력 필드 확인
const fileInputs = form.querySelectorAll('input[type="file"]');
let hasFiles = false;
fileInputs.forEach(input => {
if (input.files && input.files.length > 0) {
hasFiles = true;
// 파일 입력 필드 값이 제대로 FormData에 들어갔는지 확인
const fieldName = input.name || 'file';
if (!formData.has(fieldName)) {
console.log(`iOS 호환성: 수동으로 ${fieldName} 추가`);
// 수동으로 파일 추가
for (let i = 0; i < input.files.length; i++) {
formData.append(fieldName, input.files[i]);
}
}
}
});
// 디버깅용 로그
console.log('FormData 생성 완료:', hasFiles ? '파일 포함' : '파일 없음');
} catch (error) {
console.error('FormData 생성 오류:', error);
// 대체 방식으로 FormData 생성
formData = new FormData();
// 폼 필드 수동 추가
const formElements = form.elements;
for (let i = 0; i < formElements.length; i++) {
const field = formElements[i];
const name = field.name;
if (!name) continue;
if (field.type === 'file') {
for (let j = 0; j < field.files.length; j++) {
formData.append(name, field.files[j]);
}
}
else if (field.type !== 'submit' && field.type !== 'button') {
formData.append(name, field.value);
}
}
}
// 네트워크 요청 타임아웃 설정
const ajaxTimeout = 60000; // 60초
clearComma();
$.ajax({
type: getpost || "post",
url: url,
data: formData,
data: new FormData($('#' + fid)[0]),
contentType: false,
processData: false,
timeout: ajaxTimeout,
success: function (r) {
isCaping = false;
capResult = r;
setcap();
// 로딩바 숨김 추가
hideLoadingImage();
},
error: function (e) {
}, error: function (e) {
isCaping = false;
console.log('Ajax 오류:', e.status, e.statusText);
console.log(e.responseText);
if (e.status === 0 && e.statusText === 'timeout') {
alert("요청 시간이 초과되었습니다. 다시 시도해주세요.");
}
else if (_jsislayer2) {
alert("개발담당자에게 문의해주세요");
if (_jsislayer2) {
msg2("개발담당자에게 문의해주세요....");
}
else {
alert("개발담당자에게 문의해주세요.");
msg("개발담당자에게 문의해주세요....");
}
// 로딩바 숨김 추가
hideLoadingImage();
},
complete: function () {
}, complete: function () {
prgstop();
ajaxing(false);
// complete에도 로딩바 숨김 추가 (중복 호출 방지를 위해 다른 방법 고려 가능)
hideLoadingImage();
}
});
}
else {
console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
alert("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
}
}
//function (xhr, textStatus) {
// Do other operation
//callback()
//});
//function (xhr, textStatus) {
// Do other operation
//callback()
//});
function cap(url, formid, callback, getpost, autoMsg, noBG, jsislayer2) {
formid = formid || "mform";
_jsislayer2 = jsislayer2 || false;
@ -1125,107 +934,52 @@ function cap(url, formid, callback, getpost, autoMsg, noBG, jsislayer2) {
}
}
var _jsislayer2 = false;
function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2, hideBG, noerror, sync) {
function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2, noclearcomma) {
noclearcomma = noclearcomma || false;
_jsislayer2 = jsislayer2 || false;
_noerror = noerror || false;
_hideBG = hideBG || false;
// 동기식 요청은 권장되지 않지만, 기존 코드 호환성을 위해 유지
// 단, 경고 메시지 출력
_async = !(sync || false);
if (sync) {
console.warn("동기식 Ajax 요청은 권장되지 않으며 iOS에서 문제를 일으킬 수 있습니다.");
}
if (!isCaping) {
isAutoMsg = autoMsg || false;
_bging = noBG || false;
if (!_bging) {
prg('');
ajaxing();
}
if (_jsislayer2) {
prg('2');
bglayer2();
}
_callback = callback;
capResult = null;
capOK = false;
isCaping = true;
// 기존 함수 호출 유지, 존재 확인 후 실행
if (typeof clearComma === 'function') {
try {
clearComma();
} catch (e) {
console.error("clearComma 함수 실행 오류:", e);
}
if (!noclearcomma) {
clearComma();
}
// Ajax 요청 설정
const ajaxSettings = {
$.ajax({
type: getpost || "post",
url: url,
data: p,
async: _async,
timeout: _async ? 30000 : undefined, // 비동기 요청만 타임아웃 설정
success: function (r) {
isCaping = false;
capResult = r;
// iOS 호환성을 위한 추가 처리
setTimeout(function () {
setcap();
}, 0);
},
error: function (xhr, status, error) {
setcap();
}, error: function (e) {
isCaping = false;
console.log("Ajax 오류:", status, error);
if (xhr.responseText) {
console.log("응답 내용:", xhr.responseText);
console.log(e.responseText);
if (_jsislayer2) {
msg2("개발담당자에게 문의해주세요.");
}
// 타임아웃 오류 별도 처리
if (status === "timeout") {
if (_jsislayer2) {
alert("요청 시간이 초과되었습니다. 다시 시도해 주세요.");
} else {
alert("요청 시간이 초과되었습니다. 다시 시도해 주세요.");
}
else {
msg("개발담당자에게 문의해주세요.");
}
else if (!_noerror) {
if (_jsislayer2) {
alert("잠시 후 다시 요청해주세요.");
}
else {
alert("잠시 후 다시 요청해주세요.");
}
}
},
complete: function () {
// iOS에서의 지연 문제 방지를 위한 setTimeout 사용
setTimeout(function () {
ajaxing(false);
}, 0);
}, complete: function () {
prgstop();
ajaxing(false);
}
};
// iOS 특정 버전에서의 캐시 문제 방지
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
ajaxSettings.cache = false;
// URL에 타임스탬프 추가하여 캐시 방지
const timestamp = new Date().getTime();
ajaxSettings.url = ajaxSettings.url +
(ajaxSettings.url.indexOf('?') >= 0 ? '&' : '?') +
'_t=' + timestamp;
}
$.ajax(ajaxSettings);
});
}
else if (!_noerror) {
console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
else {
alert("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
}
}
@ -1849,7 +1603,7 @@ function bindComma(ci) {
if (fv.indexOf('.') > -1) {
if (fv.split('.')[0].length > 3) {
for (var fvi = fv.split('.')[0].length - 1; fvi > -1; fvi--) {
fv2 = fv.split('.')[0].substr(fvi, 1) + (fv2 != "" && (fv2.replace(/,/gi, '').length % 3) < 1 ? ($(ci).hasClass("nocomma")?"": ",") : "") + fv2;
fv2 = fv.split('.')[0].substr(fvi, 1) + (fv2 != "" && (fv2.replace(/,/gi, '').length % 3) < 1 ? ($(ci).hasClass("nocomma") ? "" : ",") : "") + fv2;
}
$(focusoutobj).val(fv2 + "." + fv.split('.')[1]);
}
@ -2017,16 +1771,16 @@ $(document).ready(function () {
if (aurl != "") {
window.open("http://" + aurl);
}
}).on("click", "div#msgtemp", function () {
$(this).hide();
}).on("click", ".closethisbox", function () {
if (($(this).attr("data-click") || "") != "") {
eval($(this).attr("data-click"));
}
$(this).closest('.findbox').slideUp('fast', function () {
$('#bglayer').hide();
});
}).on("change", ".filebox input.fileitem", function () {
}).on("click", "div#msgtemp", function () {
$(this).hide();
}).on("click", ".closethisbox", function () {
if (($(this).attr("data-click") || "") != "") {
eval($(this).attr("data-click"));
}
$(this).closest('.findbox').slideUp('fast', function () {
$('#bglayer').hide();
});
}).on("change", ".filebox input.fileitem", function () {
var _ext = $(this).attr("data-ext").toUpperCase();
if ($(this).val() != "" && _ext != "*" && _ext != "") {
var _extf = $(this).val().split('.')[$(this).val().split('.').length - 1].toUpperCase();
@ -2046,13 +1800,13 @@ $(document).ready(function () {
}
}).on("keydown", "input.isIp", function (e) {
if ((e.keyCode < 8 || e.keyCode > 9) && (e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 96 && e.keyCode > 105) && e.keyCode !== 46) { Prevent(); }
}).on("click", "td.breakword", function (e) {
if ($(this).hasClass("breakwordok")) {
$(this).removeClass("breakwordok");
}
else {
$(this).addClass("breakwordok");
}
}).on("click", "td.breakword", function (e) {
if ($(this).hasClass("breakwordok")) {
$(this).removeClass("breakwordok");
}
else {
$(this).addClass("breakwordok");
}
});
$("body").on("keydown", "input[type=text], input[type=password]", function (e) {
if (e.keyCode == 13) {

View File

@ -89,24 +89,24 @@ $(document).ready(function () {
$(this).val(0);
}
}
}).on("click", ".int, .intdot", function () {
$(this)[0].select();
}).on("click", ".int, .intdot", function () {
$(this)[0].select();
}).on("focus", ".int, .intdot, input[type='text'], input[type='password']", function () {
if ($(this).hasClass("int") || $(this).hasClass("intdot")) {
$(this).val($(this).val().replace(/,/gi, ''));
if ($(this).hasClass("int") || $(this).hasClass("intdot")) {
$(this).val($(this).val().replace(/,/gi, ''));
}
if (($(this).attr("id") || "") != "" && ($(this).attr("placeholder") || "") != "" && $("#ph_" + $(this).attr("id")).length < 1 && $(this).val() == "") {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie < 0) {
msie = ua.indexOf("Trident/");
}
if (($(this).attr("id") || "") != "" && ($(this).attr("placeholder") || "") != "" && $("#ph_" + $(this).attr("id")).length < 1 && $(this).val() == "") {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie < 0) {
msie = ua.indexOf("Trident/");
}
if (msie > -1) {
$("label.phplaceholder").remove();
$("<label class=\"phplaceholder\" id=\"ph_" + $(this).attr("id") + "\">" + $(this).attr("placeholder") + "<label>").insertAfter($(this));
$("#ph_" + $(this).attr("id")).css("top", ($(this).position().top + 10) + 'px');
}
if (msie > -1) {
$("label.phplaceholder").remove();
$("<label class=\"phplaceholder\" id=\"ph_" + $(this).attr("id") + "\">" + $(this).attr("placeholder") + "<label>").insertAfter($(this));
$("#ph_" + $(this).attr("id")).css("top", ($(this).position().top + 10) + 'px');
}
}
}).on("focusout", "input.datepicker-input", function () {
var v = $(this).val().replace(/[^0-9]/g, '');
if (v.length != 8) {
@ -161,7 +161,7 @@ $(document).ready(function () {
eval($(this).closest(".paging").attr("data-method") + "('L')");
}
else {
eval($(this).closest(".paging").attr("data-method") + "('" + $(this).text()+"')");
eval($(this).closest(".paging").attr("data-method") + "('" + $(this).text() + "')");
}
}
});
@ -222,7 +222,7 @@ function gopage(fid, pid, pno, a) {
pid = pid || "pagenum";
$("#" + fid).find("#" + pid).val(pno);
bglayer();
$("#"+fid).submit();
$("#" + fid).submit();
}
var _vc_cmino = 0;
var _vc_istaste = false;
@ -481,7 +481,7 @@ function bindComma(v) {
function gourl(url) {
location.href = url;
}
function disableit() {return false;}
function disableit() { return false; }
function refresh() {
bglayer();
location.href = location.href.replace('#', '');
@ -492,7 +492,7 @@ function getnull(v) {
function getdb(v, norpspliter, nullto) {
nullto = nullto || "";
if ((norpspliter || false)) {
return v=="0" ? "0" : (v || nullto).toString();
return v == "0" ? "0" : (v || nullto).toString();
}
return v == "0" ? v : (v || nullto).toString().replace(/:/gi, '').replace(/;/gi, '');
}
@ -1406,7 +1406,7 @@ function confirmok() {
_confirmokcb.substr(_confirmokcb.length - 1, 1) != ')' &&
_confirmokcb.indexOf('(') < 0 &&
_confirmokcb.indexOf(')') < 0) {
_confirmokcb += "()";
_confirmokcb += "()";
}
eval(_confirmokcb);
}