diff --git a/app/frontend/static/assets/js/shared/upload.js b/app/frontend/static/assets/js/shared/upload.js index 143580d2..d31d4e23 100644 --- a/app/frontend/static/assets/js/shared/upload.js +++ b/app/frontend/static/assets/js/shared/upload.js @@ -115,60 +115,58 @@ async function uploadFile(type, file = null, path = null, file_num = 0, _onProgr window.location.reload(); }, }); - } else { - if (type !== "server_upload") { - // All promises resolved successfully - $("#upload_input").html(`
🔒
`); - if (type === "import") { - document.getElementById("lower_half").style.visibility = "visible"; - document.getElementById("lower_half").hidden = false; - } else if (type === "background") { - setTimeout(function () { - location.href = `/panel/custom_login`; - }, 2000); - } - } else { - let caught = false; - let expanded = false; - try { - expanded = document.getElementById(path).classList.contains("clicked"); - } catch { } - - let par_el; - let items; - try { - par_el = document.getElementById(path + "ul"); - items = par_el.children; - } catch (err) { - console.log(err); - caught = true; - par_el = document.getElementById("files-tree"); - items = par_el.children; - } - - let name = file.name; - let full_path = path + '/' + name; - let flag = false; - - for (let item of items) { - if ($(item).attr("data-name") === name) { - flag = true; - } - } - - if (!flag) { - if (caught && !expanded) { - $(par_el).append(`
  • ${name}
  • `); - } else if (expanded) { - $(par_el).append(`
  • ${name}
  • `); - } - setTreeViewContext(); - } - - $(`#upload-progress-bar-${file_num + 1}`).removeClass("progress-bar-striped"); - $(`#upload-progress-bar-${file_num + 1}`).addClass("bg-success"); - $(`#upload-progress-bar-${file_num + 1}`).html(''); + } else if (type !== "server_upload") { + // All promises resolved successfully + $("#upload_input").html(`
    🔒
    `); + if (type === "import") { + document.getElementById("lower_half").style.visibility = "visible"; + document.getElementById("lower_half").hidden = false; + } else if (type === "background") { + setTimeout(function () { + location.href = `/panel/custom_login`; + }, 2000); } + } else { + let caught = false; + let expanded = false; + try { + expanded = document.getElementById(path).classList.contains("clicked"); + } catch { } + + let par_el; + let items; + try { + par_el = document.getElementById(path + "ul"); + items = par_el.children; + } catch (err) { + console.log(err); + caught = true; + par_el = document.getElementById("files-tree"); + items = par_el.children; + } + + let name = file.name; + let full_path = path + '/' + name; + let flag = false; + + for (let item of items) { + if ($(item).attr("data-name") === name) { + flag = true; + } + } + + if (!flag) { + if (caught && !expanded) { + $(par_el).append(`
  • ${name}
  • `); + } else if (expanded) { + $(par_el).append(`
  • ${name}
  • `); + } + setTreeViewContext(); + } + + $(`#upload-progress-bar-${file_num + 1}`).removeClass("progress-bar-striped"); + $(`#upload-progress-bar-${file_num + 1}`).addClass("bg-success"); + $(`#upload-progress-bar-${file_num + 1}`).html(''); } }