Changes & added Club
This commit is contained in:
61
public_html/club/upload/js/main.js
Executable file
61
public_html/club/upload/js/main.js
Executable file
@@ -0,0 +1,61 @@
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
$(document).ready(function() {
|
||||
|
||||
// on form submit, upload file:
|
||||
$("form#upload").submit(function(event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "upload.php?pw=" + urlParams.get("p") + "&folder=/IMG/" + urlParams.get("f") + "/" + urlParams.get("n") + "/",
|
||||
data: new FormData($(this)[0]),
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
xhr: function() {
|
||||
var my_xhr = $.ajaxSettings.xhr();
|
||||
document.getElementById('alert').innerText = "Subiendo...";
|
||||
|
||||
if (my_xhr.upload) {
|
||||
my_xhr.upload.addEventListener("progress", function(event) {
|
||||
Progress(event.loaded, event.total);
|
||||
});
|
||||
}
|
||||
|
||||
return my_xhr;
|
||||
},
|
||||
success: function() {
|
||||
document.getElementById('alert').innerText = "Subido!";
|
||||
Finished();
|
||||
|
||||
},
|
||||
error: function(xhr, status, message) {
|
||||
document.getElementById('alert').innerText = "Error! " + xhr.status + " " + status + " - " + message;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// progress bar:
|
||||
function Progress(current, total) {
|
||||
var percent = ((current / total) * 100).toFixed(0) + "%";
|
||||
|
||||
document.getElementById('fileuploaderprog').value = ((current / total) * 100).toFixed(0);
|
||||
document.getElementById('fileuploaderprog').innerText = percent;
|
||||
}
|
||||
|
||||
// upload finished:
|
||||
function Finished() {
|
||||
setTimeout(function() {
|
||||
$("form#upload input[type='file']").val("");
|
||||
document.getElementById('uploaderfileinp').value = "";
|
||||
|
||||
document.getElementById('fileuploaderprog').innerText = "Subido!"
|
||||
|
||||
setTimeout(function() {
|
||||
document.getElementById('fileuploaderprog').innerText = "0%"
|
||||
location.href="../cal.php?f=" + urlParams.get("f")
|
||||
|
||||
}, 3000);
|
||||
}, 500);
|
||||
}
|
||||
2
public_html/club/upload/js/plugin/jquery-3.6.0.min.js
vendored
Executable file
2
public_html/club/upload/js/plugin/jquery-3.6.0.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user