@@ -34,13 +34,11 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
3434 QList<Task *> taskList = contest->getTaskList ();
3535
3636 for (int i = 0 ; i < taskList.size (); i++) {
37- htmlCode += QString (R"( <a name="c%1p%2"><p><span style="font-weight:bold; font-size:large;">)" )
38- .arg (num)
39- .arg (i);
37+ htmlCode += QString (R"( <div id="c%1p%2"><p><span>)" ).arg (num).arg (i);
4038 htmlCode += QString (" %1 %2</span><br>" ).arg (tr (" Task" )).arg (taskList[i]->getProblemTitle ());
4139
4240 if (! contestant->getCheckJudged (i)) {
43- htmlCode += QString (" %1</p></a >" ).arg (tr (" Not judged" ));
41+ htmlCode += QString (" %1</p></div >" ).arg (tr (" Not judged" ));
4442 continue ;
4543 }
4644
@@ -51,24 +49,25 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
5149 if (contestant->getCompileState (i) != CompileSuccessfully) {
5250 switch (contestant->getCompileState (i)) {
5351 case NoValidGraderFile:
54- htmlCode += QString (" %1</p></a >" )
52+ htmlCode += QString (" %1</p></div >" )
5553 .arg (tr (" Main grader (grader.*) cannot be found" ));
5654 break ;
5755
5856 case NoValidSourceFile:
5957 htmlCode +=
60- QString (" %1</p></a >" ).arg (tr (" Cannot find valid source file" ));
58+ QString (" %1</p></div >" ).arg (tr (" Cannot find valid source file" ));
6159 break ;
6260
6361 case CompileTimeLimitExceeded:
6462 htmlCode += QString (" %1%2<br>" )
6563 .arg (tr (" Source file: " ))
6664 .arg (contestant->getSourceFile (i));
67- htmlCode += QString (" %1</p></a>" ).arg (tr (" Compile time limit exceeded" ));
65+ htmlCode +=
66+ QString (" %1</p></div>" ).arg (tr (" Compile time limit exceeded" ));
6867 break ;
6968
7069 case InvalidCompiler:
71- htmlCode += QString (" %1</p></a >" ).arg (tr (" Cannot run given compiler" ));
70+ htmlCode += QString (" %1</p></div >" ).arg (tr (" Cannot run given compiler" ));
7271 break ;
7372
7473 case CompileError:
@@ -92,7 +91,7 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
9291 htmlCode += " </code></td></tr></table>" ;
9392 }
9493
95- htmlCode += " </p></a >" ;
94+ htmlCode += " </p></div >" ;
9695 break ;
9796
9897 default :
@@ -106,13 +105,13 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
106105 QString (" %1%2" ).arg (tr (" Source file: " )).arg (contestant->getSourceFile (i));
107106 }
108107
109- htmlCode += " <table style= \" border: solid; \" ><tr>" ;
110- htmlCode += QString (R"( <th scope="col" class="td-0" >%1</th>)" ).arg (tr (" Test Case" ));
111- htmlCode += QString (R"( <th scope="col" class="td-0" >%1</th>)" ).arg (tr (" Input File" ));
112- htmlCode += QString (R"( <th scope="col" class="td-0" >%1</th>)" ).arg (tr (" Result" ));
113- htmlCode += QString (R"( <th scope="col" class="td-0" >%1</th>)" ).arg (tr (" Time Used" ));
114- htmlCode += QString (R"( <th scope="col" class="td-0" >%1</th>)" ).arg (tr (" Memory Used" ));
115- htmlCode += QString (R"( <th scope="col" class="td-0" >%1</th></tr>)" ).arg (tr (" Score" ));
108+ htmlCode += " <table><tr>" ;
109+ htmlCode += QString (R"( <th>%1</th>)" ).arg (tr (" Test Case" ));
110+ htmlCode += QString (R"( <th>%1</th>)" ).arg (tr (" Input File" ));
111+ htmlCode += QString (R"( <th>%1</th>)" ).arg (tr (" Result" ));
112+ htmlCode += QString (R"( <th>%1</th>)" ).arg (tr (" Time Used" ));
113+ htmlCode += QString (R"( <th>%1</th>)" ).arg (tr (" Memory Used" ));
114+ htmlCode += QString (R"( <th>%1</th></tr>)" ).arg (tr (" Score" ));
116115 QList<TestCase *> testCases = taskList[i]->getTestCaseList ();
117116 QList<QStringList> inputFiles = contestant->getInputFiles (i);
118117 QList<QList<ResultState>> result = contestant->getResult (i);
@@ -127,23 +126,22 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
127126
128127 if (k == 0 ) {
129128 if (score[j].size () == inputFiles[j].size ())
130- htmlCode += QString (R"( <td rowspan="%1" class="td-0">#%2</td>)" )
131- .arg (inputFiles[j].size ())
132- .arg (j + 1 );
129+ htmlCode +=
130+ QString (R"( <td rowspan="%1">#%2</td>)" ).arg (inputFiles[j].size ()).arg (j + 1 );
133131 else
134- htmlCode += QString (R"( <td rowspan="%1" class="td-0" >#%2<br>%3:%4</td>)" )
132+ htmlCode += QString (R"( <td rowspan="%1">#%2<br>%3:%4</td>)" )
135133 .arg (inputFiles[j].size ())
136134 .arg (j + 1 )
137135 .arg (tr (" Subtask Dependence Status" ))
138136 .arg (statusRankingText (score[j].back ()));
139137 }
140138
141- htmlCode += QString (" <td class= \" td-0 \" >%1</td>" ).arg (inputFiles[j][k]);
139+ htmlCode += QString (" <td>%1</td>" ).arg (inputFiles[j][k]);
142140 QString text;
143141 QString bgColor = " rgb(255, 255, 255)" ;
144142 QString frColor = " rgb(0, 0, 0)" ;
145143 Settings::setTextAndColor (result[j][k], text, frColor, bgColor);
146- htmlCode += QString (" <td class= \" td-0 \" style=\" background-color: %2; color: %3;\" >%1" )
144+ htmlCode += QString (" <td style=\" background-color: %2; color: %3;\" >%1" )
147145 .arg (text)
148146 .arg (bgColor)
149147 .arg (frColor);
@@ -156,7 +154,7 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
156154 }
157155
158156 htmlCode += " </td>" ;
159- htmlCode += " <td class= \" td-0 \" >" ;
157+ htmlCode += " <td>" ;
160158
161159 if (timeUsed[j][k] != -1 ) {
162160 htmlCode += QString (" " ).asprintf (" %.3lf s" , double (timeUsed[j][k]) / 1000 );
@@ -165,7 +163,7 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
165163 }
166164
167165 htmlCode += " </td>" ;
168- htmlCode += " <td class= \" td-0 \" >" ;
166+ htmlCode += " <td>" ;
169167
170168 if (memoryUsed[j][k] != -1 ) {
171169 htmlCode += QString (" " ).asprintf (" %.3lf MB" , double (memoryUsed[j][k]) / 1024 / 1024 );
@@ -192,7 +190,7 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
192190
193191 htmlCode +=
194192 QString (
195- R"( <td rowspan="%1" class="td-0" style="background-color: %2;"><a class="c">%3</a > / %4</td>)" )
193+ R"( <td rowspan="%1" style="background-color: %2;"><span class="c">%3</span > / %4</td>)" )
196194 .arg (inputFiles[j].size ())
197195 .arg (bgColor)
198196 .arg (minv)
@@ -203,7 +201,7 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
203201 }
204202 }
205203
206- htmlCode += " </table><br></p>" ;
204+ htmlCode += " </table><br></p></div> " ;
207205 }
208206
209207 htmlCode += QString (" <p><a href=\" #top\" >%1</a></p>" ).arg (tr (" Return to top" ));
@@ -241,6 +239,8 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi
241239 " .a-0 {color: black; text-decoration: none;} .c {font-weight: bold; font-size: large;}"
242240 " .td-2 {border-radius: 5px; font-weight: bold;}"
243241 " .td-3 {border-radius: 5px;}</style>" ;
242+
243+ out << R"( <script src="https://unpkg.com/jquery@3/dist/jquery.slim.min.js"></script>)" ;
244244 out << " <title>" << contest->getContestTitle () << " : " << tr (" Contest Result" ) << " </title>" ;
245245 out << " </head><body>" ;
246246 QList<std::pair<int , QString>> sortList;
@@ -274,8 +274,7 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi
274274
275275 out << " <p><span class=\" d\" >" ;
276276 out << " <a name=\" top\" ></a>" << contest->getContestTitle () << " : " << tr (" Rank List" ) << " </span></p>" ;
277- out << " <p class=\" e\" >" << tr (" Click names or task scores to jump to details. Judged By LemonLime" )
278- << " </p>" ;
277+ out << " <p>" << tr (" Click names or task scores to jump to details. Judged By LemonLime" ) << " </p>" ;
279278 out << R"( <p><table cellpadding="1" style="border-style: solid;"><tr>)" ;
280279 out << QString (R"( <th class="th-0" scope="col">%1</th>)" ).arg (tr (" Rank" ));
281280 out << QString (R"( <th class="th-0" scope="col">%1</th>)" ).arg (tr (" Name" ));
@@ -294,7 +293,8 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi
294293
295294 for (auto &i : sortList) {
296295 Contestant *contestant = contest->getContestant (i.second );
297- out << QString (" <tr><td class=\" td-0\" >%1</td>" ).arg (rankList[contestant->getContestantName ()] + 1 );
296+ out << " <tr>" ;
297+ out << QString (" <td class=\" td-0\" >%1</td>" ).arg (rankList[contestant->getContestantName ()] + 1 );
298298 out << QString (R"( <td class="td-0"><a href="#c%1" class="a-0">%2</a></td>)" )
299299 .arg (loc[contestant])
300300 .arg (i.second );
@@ -364,17 +364,28 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi
364364 .arg (j);
365365 }
366366 }
367+ out << " </tr>" ;
367368 }
368369
369370 out << " </table></p>" ;
370371
371372 for (int i = 0 ; i < contestantList.size (); i++) {
372- out << QString (" <a name=\" c%1\" ><hr><a>" ).arg (i) << " <span class=\" d\" >" ;
373+ out << QString (" <a name=\" c%1\" ><hr></ a>" ).arg (i) << " <span class=\" d\" >" ;
373374 out << tr (" Contestant: %1" ).arg (contestantList[i]->getContestantName ()) << " </span>" ;
374375 out << getContestantHtmlCode (contest, contestantList[i], i);
375376 }
376377
377- out << " </body></html>" ;
378+ out << " </body>" ;
379+ out << R"(
380+ <script>
381+ $("div[id^='c'] th").addClass("td-0");
382+ $("div[id^='c'] td").addClass("td-0");
383+ $("div[id^='c']>p>span").css("font-weight", "bold").css("font-size", "large");
384+ $("div[id^='c']>p>table").css("border", "solid");
385+ $("div[id^='c']>p>table th").attr("scope", "col");
386+ </script>
387+ )" ;
388+ out << " </html>" ;
378389 QApplication::restoreOverrideCursor ();
379390 QMessageBox::information (widget, tr (" LemonLime" ), tr (" Export is done" ), QMessageBox::Ok);
380391}
@@ -526,7 +537,7 @@ auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *cont
526537 if (score[j][t] < minv)
527538 minv = score[j][t];
528539
529- htmlCode += QString (R"( <td rowspan="%1"><a class="c">%2</a > / %3</td>)" )
540+ htmlCode += QString (R"( <td rowspan="%1"><span class="c">%2</span > / %3</td>)" )
530541 .arg (inputFiles[j].size ())
531542 .arg (minv)
532543 .arg (maxv);
0 commit comments