From 6def344216d936da3dcc1876fbd292774acc8bbe Mon Sep 17 00:00:00 2001 From: leebj Date: Tue, 4 Jun 2024 10:43:20 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=B5=EB=B0=B1,=20=ED=83=AD=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/resources/js/base/base.js | 58 +++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/webapp/resources/js/base/base.js b/src/main/webapp/resources/js/base/base.js index b2d67c1f..d4e9b3ba 100644 --- a/src/main/webapp/resources/js/base/base.js +++ b/src/main/webapp/resources/js/base/base.js @@ -35,7 +35,7 @@ function isEmpty(v) { || v == null || v == "null" ) return true; - + switch (typeof(v)) { case "string": return "" == trim(v); case "boolean": if (false == v) return false; @@ -81,13 +81,13 @@ function toQuery(map, encode) { function uuid() { var hexDigits = "0123456789abcde", result = []; - + for (var i = 0; i < 36; ++i) result[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); result[14] = "4"; result[19] = hexDigits.substr((result[19] & 0x3) | 0x8, 1); result[8] = result[13] = result[18] = result[23] = "-"; - + return result.join(""); } @@ -140,15 +140,15 @@ var dialog = { size = " modal-" + size; tmpl = tmpl.replace(/{size}/, size); dlg = $(tmpl).appendTo("body"); - + dlg.find(".modal-body").html(conf.content || "").fadeIn(); - + dlg.on("hidden.bs.modal", function() {// on dialog close $("#" + id +",#" + backdropID).remove(); // removes the dialog and its backdrop if (conf.onClose) conf.onClose(); }); - + if (conf.onOK) { let footer = dlg.find(".modal-footer"); footer.removeClass("hidden"); @@ -157,7 +157,7 @@ var dialog = { if (conf.getData) { var selected = conf.getData.apply(); if (!selected) return; - + conf.onOK(selected); dialog.close(id); } else { @@ -177,7 +177,7 @@ var dialog = { if (!backdrop.prop("id")) backdrop.prop("id", backdropID); }); - + if (conf.init) conf.init(); }, @@ -198,11 +198,11 @@ var dialog = { function onError(xhr, options, error) { if (xhr.readyState == 0) return dialog.alert("서버에 접근할 수 없습니다."); - + var resp = JSON.parse(xhr.responseText); if (resp.handler) return eval(resp.handler); - + var msgs = []; for (key in resp) msgs.push(resp[key]) @@ -223,17 +223,17 @@ var ajax = { if (options.data) options.type = "POST"; } - + var success = options.success; options.success = function(resp) { if ("string" == typeof resp) resp = trim(resp); - + var stacktrace = resp.stacktrace; delete resp.stacktrace; - + debug("response", resp); - + if (!resp.failed) return success(resp); @@ -241,17 +241,17 @@ var ajax = { title:resp.title, content:[resp.description, resp.message].join("
") }); - + debug("stacktrace", stacktrace); }; var handleError = options.error || onError; options.error = function(xhr, options, error) { wait(false); - + debug("error", xhr, options, error); handleError(xhr, options, error); } - + var handleComplete = options.complete || function(){}; options.complete = function() { wait(false); @@ -462,14 +462,14 @@ $.fn.getValues = function(propertyMapper) { key = input.prop("id") || input.prop("name"), value = input.val(); if (isEmpty(key) || value === undefined) return; - + var type = input.prop("type"); if ("file" == type) { value = input.get(0).files; } else if (["checkbox", "radio"].indexOf(type) > -1) { if (!input.is(":checked")) return; } - + var stored = inputValues[key]; if (stored === undefined) { inputValues[key] = value; @@ -485,7 +485,7 @@ $.fn.getValues = function(propertyMapper) { var array = [stored]; if (!Array.isArray(value)) array.push(value); - else + else array = array.concat(value); inputValues[key] = array; } @@ -504,7 +504,7 @@ $.fn.getValues = function(propertyMapper) { break; } if (value === undefined) continue; - + delete inputValues[valueProvider]; inputValues[property] = value; } @@ -531,10 +531,10 @@ $.fn.getValues = function(propertyMapper) { function paginate(config) { var rc = config.totalSize || 0; // if (!rc) return ""; - + var fetchCount = config.fetchSize || 0; // if (!fetchCount) return ""; - + var fetch = { all:0, none:-1, @@ -558,7 +558,7 @@ function paginate(config) { }; var lc = fetch.count(rc, fetchCount); if (lc < 2) return ""; - + var links = ifEmpty(config.links, fetch.all), page = fetch.page(ifEmpty(config.start, 0), fetchCount), band = fetch.band(page, links), @@ -590,7 +590,7 @@ function paginate(config) { next:function(bandCount) { bandCount = parseInt(bandCount); if (bandCount - band < 2) return ""; - + var nextBand = band + 1, page = nextBand * links, fromRec = page * fetchCount; @@ -600,7 +600,7 @@ function paginate(config) { bandCount = parseInt(bandCount); var lastBand = bandCount - 1; if (lastBand - band < 2) return ""; - + var pages = lastBand * links, fromRec = pages * fetchCount; return tags.link(config.last, fromRec, pages + 1); @@ -675,7 +675,7 @@ $.fn.setPagingInfo = function(config) { $.fn.setCurrentRow = function(val) { if (!val) return; - + return this.each(function() { var e = $(this); e.find("tr").each(function(){ @@ -684,7 +684,7 @@ $.fn.setCurrentRow = function(val) { if (current) tr.addClass("current-row"); else - tr.removeClass("current-row"); + tr.removeClass("current-row"); }); }); } @@ -792,7 +792,7 @@ function inputsInRange(fromSource, toSource) { toVal = to.val() || "", ok = toVal >= fromVal; if (ok) return; - + if ($(this)[0] == from[0]) to.val(from.val()) else