Skip to content

Commit

Permalink
Merge pull request #143 from LQDJudge/anhkha2003
Browse files Browse the repository at this point in the history
Allow more extensions for uploading testcases, including Polygon format
  • Loading branch information
anhkha2003 authored Dec 25, 2024
2 parents 60ac046 + 50b31cc commit de6a8de
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions templates/problem/data.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,19 @@
});

function isInpFile(x) {
let tail = ['.in', '.inp', '.IN', '.INP']
let tail = ['.in', '.inp', '.txt', '.dat', '.IN', '.INP', '.TXT', '.DAT']
for (let i of tail) {
if (x.endsWith(i)) {
return true;
}
}
if (!x.includes('.') && !x.endsWith('/')) {
return true;
}
return false;
}
function isOutFile(x) {
let tail = ['.out', '.OUT', '.ans', '.ANS']
let tail = ['.out', '.ans', '.res', '.a', '.OUT', '.ANS', '.RES', '.A'];
for (let i of tail) {
if (x.endsWith(i)) {
return true;
Expand All @@ -296,14 +299,17 @@
e.preventDefault();
var inFiles = [], outFiles = [];
for (let file of window.valid_files) {
if (file.endsWith('/')) {
continue;
}
if (isInpFile(file)) {
inFiles.push(file);
}
if (isOutFile(file)) {
outFiles.push(file);
}
}
if (inFiles.length == 0) {
if (inFiles.length == 0 || outFiles.length == 0) {
alert("No input/output files. Make sure your files' suffices are .in(p)/.out");
return false;
}
Expand Down

0 comments on commit de6a8de

Please sign in to comment.