refactor: var -> let 변경

dev
Jonguk. Lim 5 months ago
parent 6f3debc3c1
commit 8c81591418

@ -85,6 +85,7 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="border-card rounded w-100 h-px-250 ox-scroll align-content-start"> <div class="border-card rounded w-100 h-px-250 ox-scroll align-content-start">
<ul id="dragAndDrop--${pageName}" class="d-inline-flex"> <ul id="dragAndDrop--${pageName}" class="d-inline-flex">
<%-- <ul id="dragAndDrop--${pageName}" class="d-inline-flex" style="flex-wrap: wrap">--%>
</ul> </ul>
</div> </div>
@ -328,7 +329,7 @@
$P.fnDisplay = () => { $P.fnDisplay = () => {
if($P.fileArr.length > 0){ if($P.fileArr.length > 0){
var tagsText = $P.fnMakeImgTags($P.fileArr); let tagsText = $P.fnMakeImgTags($P.fileArr);
document.querySelector("#dragAndDrop--${pageName}").innerHTML = tagsText; document.querySelector("#dragAndDrop--${pageName}").innerHTML = tagsText;
$("#btnImageDel--${pageName}").removeAttr("hidden"); $("#btnImageDel--${pageName}").removeAttr("hidden");
} else { } else {
@ -340,18 +341,16 @@
// HTML 태그(img,checkbox) 문자열 생성 // HTML 태그(img,checkbox) 문자열 생성
$P.fnMakeImgTags = (fileArr) => { $P.fnMakeImgTags = (fileArr) => {
var tagsTextArr = []; let tagsTextArr = [];
for(var index = 0; index < fileArr.length; index++){ for(let index = 0; index < fileArr.length; index++){
var item = fileArr[index]; let item = fileArr[index];
var template = document.getElementById("imgCheckboxTemplate--${pageName}").innerHTML; let template = document.getElementById("imgCheckboxTemplate--${pageName}").innerHTML;
template = template.replace(/{name}/gi, "dsuseDsuseImgFilesSelector"); template = template.replace(/{name}/gi, "dsuseDsuseImgFilesSelector");
template = template.replace(/{value}/gi, item.id); template = template.replace(/{value}/gi, item.id);
template = template.replace(/{src}/gi, item.url); template = template.replace(/{src}/gi, item.url);
tagsTextArr.push(template); tagsTextArr.push(template);
} }
@ -414,14 +413,14 @@
//이미지 삭제 버튼 //이미지 삭제 버튼
$("#btnImageDel--${pageName}").on("click", function() { $("#btnImageDel--${pageName}").on("click", function() {
var checkeds = $("#dragAndDrop--${pageName}").find(":checkbox[name='dsuseDsuseImgFilesSelector']:checked"); let checkeds = $("#dragAndDrop--${pageName}").find(":checkbox[name='dsuseDsuseImgFilesSelector']:checked");
if(checkeds.length > 0){ if(checkeds.length > 0){
var keys = []; let keys = [];
checkeds.each(function(){ checkeds.each(function(){
keys.push(this.value); keys.push(this.value);
}); });
$P.fileArr = $P.fileArr.filter((element) => keys.indexOf(element.id) == -1); $P.fileArr = $P.fileArr.filter((element) => keys.indexOf(element.id) === -1);
$P.fnDisplay(); $P.fnDisplay();
} }
}); });

Loading…
Cancel
Save