Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3269 [BUGFIX] refactor reparse js file #3280

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,44 @@ $(window).on('load', function() {
console.log('loaded');
var submitBtn=document.querySelector('button[type=submit]'); // add the first listener
var theForm = submitBtn.parentNode.parentNode;
var action = "";
var number_of_files_line = "";

for (var i = 0; i < theForm.childNodes.length; i++) {
if (theForm.childNodes[i].className == "actions") {
form_header = theForm.childNodes[i];
submitBtn.addEventListener('click', function(e) {
e.preventDefault();
// number of files
action_counter = document.querySelector('span.action-counter')
is_action_counter_hidden = action_counter.className === "action-counter hidden"

for (var i = 0; i < form_header.childNodes.length; i++) {
if (form_header.childNodes[i].className == "action-counter") {
number_of_files = form_header.childNodes[i];
break;
}
}
action_counter_all = document.querySelector('span.all')

break;
if (is_action_counter_hidden) {
number_of_files_line = action_counter_all.innerText;
} else {
number_of_files_line = action_counter.innerText;
}
}
submitBtn.addEventListener('click', function(e) {
e.preventDefault();
if (confirm("You are about to re-parse " + number_of_files.innerHTML.split(/(\s+)/)[0] + " files. Are you sure you want to continue?")) {
console.log('submitting');
theForm.submit();

// what action is selected
action = document.querySelector('select[name=action]').value;

if (action === "reparse") {
console.log('reparse');
var splitted_number_of_files = number_of_files_line.split(/(\s+)/);
if (Number(splitted_number_of_files[0]) > 0 ) {
number_of_files = splitted_number_of_files[0];
} else {
number_of_files = splitted_number_of_files[2];
}
if (confirm("You are about to re-parse " + number_of_files + " files. Are you sure you want to continue?")) {
console.log('submitting');
theForm.submit();
} else {
console.log('not submitting');
};
} else {
console.log('not submitting');
};
console.log('not reparse');
alert('Please select the "Reparse" action to continue.');
}
});

});
Loading