Browse Source

Merge branch 'master' of https://github.com/syzoj/syzoj

master
Tian Yunhao 6 years ago
parent
commit
c5c9974f1f
  1. 8
      README.en.md
  2. 8
      README.md
  3. 13
      app.js
  4. BIN
      bin/jcf
  5. 180
      bin/jcf.xml
  6. 9
      config-example.json
  7. 36
      language-config.json
  8. 54
      libs/code_formatter.js
  9. 35
      libs/judger.js
  10. 19
      libs/submissions_process.js
  11. 31
      models/formatted_code.js
  12. 1
      models/user.js
  13. 22
      modules/admin.js
  14. 4
      modules/contest.js
  15. 23
      modules/problem.js
  16. 14
      modules/socketio.js
  17. 32
      modules/submission.js
  18. 1
      modules/user.js
  19. 10
      package.json
  20. 18962
      static/cdnjs/Chart.js/2.7.3/Chart.bundle.js
  21. 10
      static/cdnjs/Chart.js/2.7.3/Chart.bundle.min.js
  22. 14456
      static/cdnjs/Chart.js/2.7.3/Chart.js
  23. 10
      static/cdnjs/Chart.js/2.7.3/Chart.min.js
  24. 335
      static/cdnjs/KaTeX/0.10.0/contrib/auto-render.js
  25. 1
      static/cdnjs/KaTeX/0.10.0/contrib/auto-render.min.js
  26. 14
      static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.css
  27. 208
      static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.js
  28. 1
      static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.min.css
  29. 1
      static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.min.js
  30. 137
      static/cdnjs/KaTeX/0.10.0/contrib/mathtex-script-type.js
  31. 1
      static/cdnjs/KaTeX/0.10.0/contrib/mathtex-script-type.min.js
  32. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_AMS-Regular.ttf
  33. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_AMS-Regular.woff
  34. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_AMS-Regular.woff2
  35. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Bold.ttf
  36. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Bold.woff
  37. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Bold.woff2
  38. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Regular.ttf
  39. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Regular.woff
  40. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Regular.woff2
  41. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Bold.ttf
  42. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Bold.woff
  43. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Bold.woff2
  44. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Regular.ttf
  45. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Regular.woff
  46. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Regular.woff2
  47. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Bold.ttf
  48. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Bold.woff
  49. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Bold.woff2
  50. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-BoldItalic.ttf
  51. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-BoldItalic.woff
  52. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-BoldItalic.woff2
  53. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Italic.ttf
  54. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Italic.woff
  55. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Italic.woff2
  56. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Regular.ttf
  57. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Regular.woff
  58. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Regular.woff2
  59. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-BoldItalic.ttf
  60. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-BoldItalic.woff
  61. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-BoldItalic.woff2
  62. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-Italic.ttf
  63. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-Italic.woff
  64. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-Italic.woff2
  65. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Bold.ttf
  66. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Bold.woff
  67. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Bold.woff2
  68. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Italic.ttf
  69. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Italic.woff
  70. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Italic.woff2
  71. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Regular.ttf
  72. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Regular.woff
  73. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Regular.woff2
  74. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Script-Regular.ttf
  75. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Script-Regular.woff
  76. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Script-Regular.woff2
  77. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size1-Regular.ttf
  78. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size1-Regular.woff
  79. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size1-Regular.woff2
  80. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size2-Regular.ttf
  81. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size2-Regular.woff
  82. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size2-Regular.woff2
  83. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size3-Regular.ttf
  84. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size3-Regular.woff
  85. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size3-Regular.woff2
  86. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size4-Regular.ttf
  87. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size4-Regular.woff
  88. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size4-Regular.woff2
  89. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Typewriter-Regular.ttf
  90. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Typewriter-Regular.woff
  91. BIN
      static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Typewriter-Regular.woff2
  92. 1
      static/cdnjs/KaTeX/0.10.0/katex.min.css
  93. 1
      static/cdnjs/KaTeX/0.10.0/katex.min.js
  94. 17
      static/cdnjs/ace/1.4.2/ace.js
  95. 8
      static/cdnjs/ace/1.4.2/ext-beautify.js
  96. 8
      static/cdnjs/ace/1.4.2/ext-elastic_tabstops_lite.js
  97. 8
      static/cdnjs/ace/1.4.2/ext-emmet.js
  98. 8
      static/cdnjs/ace/1.4.2/ext-error_marker.js
  99. 8
      static/cdnjs/ace/1.4.2/ext-keybinding_menu.js
  100. 8
      static/cdnjs/ace/1.4.2/ext-language_tools.js
  101. Some files were not shown because too many files have changed in this diff Show More

8
README.en.md

@ -1,4 +1,4 @@
<p align="center"><img src="static/syzoj.svg" width="250"></p> <p align="center"><img src="static/self/syzoj.svg" width="250"></p>
[中文](README.md) | English [中文](README.md) | English
@ -38,3 +38,9 @@ Who upgraded from a commit BEFORE [84b9e2d7b51e4ed3ab426621b66cf5ae9e1e1c23](htt
```sql ```sql
ALTER TABLE `problem` ADD `publicize_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `type`; ALTER TABLE `problem` ADD `publicize_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `type`;
``` ```
Who upgraded from a commit BEFORE [d8be150fc6b8c43af61c5e4aca4fc0fe0445aef3](https://github.com/syzoj/syzoj/commit/d8be150fc6b8c43af61c5e4aca4fc0fe0445aef3) (Dec 7, 2018) **MUST** perform the following SQL on the database.
```sql
ALTER TABLE `user` ADD `prefer_formatted_code` TINYINT(1) NOT NULL AFTER `public_email`;
```

8
README.md

@ -1,4 +1,4 @@
<p align="center"><img src="static/syzoj.svg" width="250"></p> <p align="center"><img src="static/self/syzoj.svg" width="250"></p>
中文 | [English](README.en.md) 中文 | [English](README.en.md)
@ -38,3 +38,9 @@ ALTER TABLE `judge_state` CHANGE `result` `result` JSON NOT NULL;
```sql ```sql
ALTER TABLE `problem` ADD `publicize_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `type`; ALTER TABLE `problem` ADD `publicize_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `type`;
``` ```
从该 commit [d8be150fc6b8c43af61c5e4aca4fc0fe0445aef3](https://github.com/syzoj/syzoj/commit/d8be150fc6b8c43af61c5e4aca4fc0fe0445aef3)(2018 年 12 月 7 日)前更新的用户**必须**在其数据库上执行以下 SQL 语句。
```sql
ALTER TABLE `user` ADD `prefer_formatted_code` TINYINT(1) NOT NULL AFTER `public_email`;
```

13
app.js

@ -28,9 +28,13 @@ global.syzoj = {
winstonLib.configureWinston(!syzoj.production); winstonLib.configureWinston(!syzoj.production);
app.server = require('http').createServer(app); app.server = require('http').createServer(app);
if (!module.parent) {
// Loaded by `require()`, not node CLI.
app.server.listen(parseInt(syzoj.config.port), syzoj.config.hostname, () => { app.server.listen(parseInt(syzoj.config.port), syzoj.config.hostname, () => {
this.log(`SYZOJ is listening on ${syzoj.config.hostname}:${parseInt(syzoj.config.port)}...`); this.log(`SYZOJ is listening on ${syzoj.config.hostname}:${parseInt(syzoj.config.port)}...`);
}); });
}
// Set assets dir // Set assets dir
app.use(Express.static(__dirname + '/static', { maxAge: syzoj.production ? '1y' : 0 })); app.use(Express.static(__dirname + '/static', { maxAge: syzoj.production ? '1y' : 0 }));
@ -63,7 +67,9 @@ global.syzoj = {
})()); })());
await this.connectDatabase(); await this.connectDatabase();
if (!module.parent) {
await this.lib('judger').connect(); await this.lib('judger').connect();
}
this.loadModules(); this.loadModules();
}, },
async connectDatabase() { async connectDatabase() {
@ -108,7 +114,7 @@ global.syzoj = {
this.db = new Sequelize(this.config.db.database, this.config.db.username, this.config.db.password, { this.db = new Sequelize(this.config.db.database, this.config.db.username, this.config.db.password, {
host: this.config.db.host, host: this.config.db.host,
dialect: 'mysql', dialect: 'mariadb',
logging: syzoj.production ? false : syzoj.log, logging: syzoj.production ? false : syzoj.log,
timezone: require('moment')().format('Z'), timezone: require('moment')().format('Z'),
operatorsAliases: operatorsAliases operatorsAliases: operatorsAliases
@ -164,7 +170,8 @@ global.syzoj = {
app.use(Session(sessionConfig)); app.use(Session(sessionConfig));
app.use((req, res, next) => { app.use((req, res, next) => {
// req.session.user_id = 1; res.locals.useLocalLibs = !!parseInt(req.headers['syzoj-no-cdn']);
let User = syzoj.model('user'); let User = syzoj.model('user');
if (req.session.user_id) { if (req.session.user_id) {
User.fromID(req.session.user_id).then((user) => { User.fromID(req.session.user_id).then((user) => {
@ -175,7 +182,7 @@ global.syzoj = {
res.locals.user = null; res.locals.user = null;
req.session.user_id = null; req.session.user_id = null;
next(); next();
}) });
} else { } else {
if (req.cookies.login) { if (req.cookies.login) {
let obj; let obj;

BIN
bin/jcf

Binary file not shown.

180
bin/jcf.xml

@ -0,0 +1,180 @@
<?xml version="1.0" ?>
<JediCodeFormatSettings>
<WriteVersion> 2.44 </WriteVersion>
<WriteDateTime> 39387.7118126273 </WriteDateTime>
<Description> JEDI Code Format Settings </Description>
<Obfuscate>
<Enabled> False </Enabled>
<Caps> 1 </Caps>
<RemoveComments> True </RemoveComments>
<RemoveWhiteSpace> True </RemoveWhiteSpace>
<RemoveIndent> True </RemoveIndent>
<RebreakLines> True </RebreakLines>
</Obfuscate>
<Clarify>
<OnceOffs> 0 </OnceOffs>
<Warnings> True </Warnings>
<WarnUnusedParams> True </WarnUnusedParams>
<IgnoreUnusedParams> Sender </IgnoreUnusedParams>
<FileExtensions> dpr, pas, pp </FileExtensions>
</Clarify>
<Indent>
<IndentationSpaces> 2 </IndentationSpaces>
<FirstLevelIndent> 2 </FirstLevelIndent>
<HasFirstLevelIndent> False </HasFirstLevelIndent>
<IndentGlobals> True </IndentGlobals>
<IndentClasses> True </IndentClasses>
<IndentProcedures> False </IndentProcedures>
<KeepCommentsWithCodeInGlobals> True </KeepCommentsWithCodeInGlobals>
<KeepCommentsWithCodeInProcs> True </KeepCommentsWithCodeInProcs>
<KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef>
<KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere>
<IndentBeginEnd> False </IndentBeginEnd>
<IndentbeginEndSpaces> 2 </IndentbeginEndSpaces>
<IndentElse> False </IndentElse>
<IndentCaseElse> True </IndentCaseElse>
</Indent>
<Spaces>
<TabsToSpaces> True </TabsToSpaces>
<SpacesToTabs> False </SpacesToTabs>
<SpacesPerTab> 2 </SpacesPerTab>
<SpacesForTab> 2 </SpacesForTab>
<FixSpacing> True </FixSpacing>
<SpaceBeforeClassHeritage> False </SpaceBeforeClassHeritage>
<SpacesBeforeColonVar> 0 </SpacesBeforeColonVar>
<SpacesBeforeColonConst> 0 </SpacesBeforeColonConst>
<SpacesBeforeColonParam> 0 </SpacesBeforeColonParam>
<SpacesBeforeColonFn> 0 </SpacesBeforeColonFn>
<SpacesBeforeColonClassVar> 0 </SpacesBeforeColonClassVar>
<SpacesBeforeColonRecordField> 0 </SpacesBeforeColonRecordField>
<SpacesBeforeColonCaseLabel> 0 </SpacesBeforeColonCaseLabel>
<SpacesBeforeColonLabel> 0 </SpacesBeforeColonLabel>
<MaxSpacesInCode> 2 </MaxSpacesInCode>
<UseMaxSpacesInCode> True </UseMaxSpacesInCode>
<SpaceForOperator> 0 </SpaceForOperator>
<SpaceBeforeOpenBracketsInFunctionDeclaration> False </SpaceBeforeOpenBracketsInFunctionDeclaration>
<SpaceBeforeOpenBracketsInFunctionCall> False </SpaceBeforeOpenBracketsInFunctionCall>
<SpaceBeforeOpenSquareBracketsInExpression> False </SpaceBeforeOpenSquareBracketsInExpression>
<SpaceAfterOpenBrackets> False </SpaceAfterOpenBrackets>
<SpaceBeforeCloseBrackets> False </SpaceBeforeCloseBrackets>
</Spaces>
<Returns>
<WhenRebreakLines> 2 </WhenRebreakLines>
<MaxLineLength> 90 </MaxLineLength>
<NumReturnsAfterFinalEnd> 1 </NumReturnsAfterFinalEnd>
<RemoveBadReturns> True </RemoveBadReturns>
<AddGoodReturns> True </AddGoodReturns>
<UsesOnePerLine> False </UsesOnePerLine>
<RemoveExpressionReturns> True </RemoveExpressionReturns>
<RemoveVarReturns> True </RemoveVarReturns>
<NoReturnsInProperty> True </NoReturnsInProperty>
<RemoveProcedureDefReturns> True </RemoveProcedureDefReturns>
<RemoveReturns> True </RemoveReturns>
<RemoveVarBlankLines> True </RemoveVarBlankLines>
<RemoveProcHeaderBlankLines> True </RemoveProcHeaderBlankLines>
<Block> 1 </Block>
<BlockBegin> 1 </BlockBegin>
<Label> 1 </Label>
<LabelBegin> 1 </LabelBegin>
<CaseLabel> 1 </CaseLabel>
<CaseBegin> 1 </CaseBegin>
<CaseElse> 0 </CaseElse>
<CaseElseBegin> 0 </CaseElseBegin>
<EndElse> 1 </EndElse>
<ElseIf> 1 </ElseIf>
<ElseBegin> 0 </ElseBegin>
<BeforeCompilerDirectUses> 1 </BeforeCompilerDirectUses>
<BeforeCompilerDirectStatements> 0 </BeforeCompilerDirectStatements>
<BeforeCompilerDirectGeneral> 1 </BeforeCompilerDirectGeneral>
<AfterCompilerDirectUses> 1 </AfterCompilerDirectUses>
<AfterCompilerDirectStatements> 0 </AfterCompilerDirectStatements>
<AfterCompilerDirectGeneral> 1 </AfterCompilerDirectGeneral>
<ReturnChars> 0 </ReturnChars>
<RemoveConsecutiveBlankLines> True </RemoveConsecutiveBlankLines>
<MaxConsecutiveBlankLines> 4 </MaxConsecutiveBlankLines>
<MaxBlankLinesInSection> 1 </MaxBlankLinesInSection>
<LinesBeforeProcedure> 1 </LinesBeforeProcedure>
</Returns>
<Comments>
<RemoveEmptyDoubleSlashComments> True </RemoveEmptyDoubleSlashComments>
<RemoveEmptyCurlyBraceComments> True </RemoveEmptyCurlyBraceComments>
</Comments>
<Capitalisation>
<Enabled> True </Enabled>
<ReservedWords> 1 </ReservedWords>
<Operators> 1 </Operators>
<Directives> 1 </Directives>
<Constants> 1 </Constants>
<Types> 1 </Types>
</Capitalisation>
<SpecificWordCaps>
<Enabled> True </Enabled>
<Words> </Words>
</SpecificWordCaps>
<Identifiers>
<Enabled> True </Enabled>
<Words> ActivePage, AnsiCompareStr, AnsiCompareText, AnsiUpperCase, AsBoolean, AsDateTime, AsFloat, AsInteger, Assign, AsString, AsVariant, BeginDrag, Buttons, Caption, Checked, Classes, ClassName, Clear, Close, Components, Controls, Count, Create, Data, Dec, Delete, Destroy, Dialogs, Enabled, EndDrag, EOF, Exception, Execute, False, FieldByName, First, Forms, Free, FreeAndNil, GetFirstChild, Graphics, Height, idAbort, idCancel, idIgnore, IDispatch, idNo, idOk, idRetry, idYes, Inc, Initialize, IntToStr, ItemIndex, IUnknown, Lines, Math, MaxValue, mbAbort, mbAll, mbCancel, mbHelp, mbIgnore, mbNo, mbOK, mbRetry, mbYes, mbYesToAll, Messages, MinValue, mnNoToAll, mrAbort, mrAll, mrCancel, mrIgnore, mrNo, mrNone, mrNoToAll, mrOk, mrRetry, mrYes, mrYesToAll, mtConfirmation, mtCustom, mtError, mtInformation, mtWarning, Name, Next, Open, Ord, ParamStr, PChar, Perform, ProcessMessages, Read, ReadOnly, RecordCount, Register, Release, Result, Sender, SetFocus, Show, ShowMessage, Source, StdCtrls, StrToInt, SysUtils, TAutoObject, TButton, TComponent, TDataModule, Text, TForm, TFrame, TList, TNotifyEvent, TObject, TObjectList, TPageControl, TPersistent, True, TStringList, TStrings, TTabSheet, Unassigned, Value, Visible, WideString, Width, Windows, Write </Words>
</Identifiers>
<NotIdent>
<Enabled> True </Enabled>
<Words> False, Name, nil, PChar, Read, ReadOnly, True, WideString, Write </Words>
</NotIdent>
<UnitNameCaps>
<Enabled> True </Enabled>
<Words> ActnColorMaps, ActnCtrls, ActnList, ActnMan, ActnMenus, ActnPopup, ActnRes, ADOConst, ADODB, ADOInt, AppEvnts, AxCtrls, BandActn, bdeconst, bdemts, Buttons, CheckLst, Classes, Clipbrd.pas, CmAdmCtl, ComCtrls, ComStrs, Consts, Controls, CtlConsts, CtlPanel, CustomizeDlg, DataBkr, DB, DBActns, dbcgrids, DBClient, DBClientActnRes, DBClientActns, DBCommon, DBConnAdmin, DBConsts, DBCtrls, DbExcept, DBGrids, DBLocal, DBLocalI, DBLogDlg, dblookup, DBOleCtl, DBPWDlg, DBTables, DBXpress, DdeMan, Dialogs, DrTable, DSIntf, ExtActns, ExtCtrls, ExtDlgs, FileCtrl, FMTBcd, Forms, Graphics, GraphUtil, Grids, HTTPIntr, IB, IBBlob, IBCustomDataSet, IBDatabase, IBDatabaseInfo, IBDCLConst, IBErrorCodes, IBEvents, IBExternals, IBExtract, IBGeneratorEditor, IBHeader, IBIntf, IBQuery, IBRestoreEditor, IBSecurityEditor, IBServiceEditor, IBSQL, IBSQLMonitor, IBStoredProc, IBTable, IBUpdateSQL, IBUtils, IBXConst, ImgList, Jcl8087, JclAbstractContainers, JclAlgorithms, JclAnsiStrings, JclAppInst, JclArrayLists, JclArraySets, JclBase, JclBinaryTrees, JclBorlandTools, JclCIL, JclCLR, JclCOM, JclComplex, JclCompression, JclConsole, JclContainerIntf, JclCounter, JclDateTime, JclDebug, JclDotNet, JclEDI, JclEDI_ANSIX12, JclEDI_ANSIX12_Ext, JclEDI_UNEDIFACT, JclEDI_UNEDIFACT_Ext, JclEDISEF, JclEDITranslators, JclEDIXML, JclExprEval, JclFileUtils, JclFont, JclGraphics, JclGraphUtils, JclHashMaps, JclHashSets, JclHookExcept, JclIniFiles, JclLANMan, JclLinkedLists, JclLocales, JclLogic, JclMapi, JclMath, JclMetadata, JclMIDI, JclMime, JclMiscel, JclMsdosSys, JclMultimedia, JclNTFS, JclPCRE, JclPeImage, JclPrint, JclQGraphics, JclQGraphUtils, JclQueues, JclRegistry, JclResources, JclRTTI, JclSchedule, JclSecurity, JclShell, JclSimpleXml, JclStacks, JclStatistics, JclStreams, JclStrHashMap, JclStringLists, JclStrings, JclStructStorage, JclSvcCtrl, JclSynch, JclSysInfo, JclSysUtils, JclTask, JclTD32, JclUnicode, JclUnitConv, JclUnitVersioning, JclUnitVersioningProviders, JclValidation, JclVectors, JclWideFormat, JclWideStrings, JclWin32, JclWin32Ex, JclWinMIDI, ListActns, Mask, MConnect, Menus, Midas, MidasCon, MidConst, MPlayer, MtsRdm, Mxconsts, ObjBrkr, OleAuto, OleConst, OleCtnrs, OleCtrls, OleDB, OleServer, Outline, Printers, Provider, recerror, ScktCnst, ScktComp, ScktMain, SConnect, ShadowWnd, SimpleDS, SMINTF, SqlConst, SqlExpr, SqlTimSt, StdActnMenus, StdActns, StdCtrls, StdStyleActnCtrls, SvcMgr, SysUtils, TabNotBk, Tabs, TConnect, Themes, ToolWin, ValEdit, VDBConsts, WinHelpViewer, XPActnCtrls, XPMan, XPStyleActnCtrls </Words>
</UnitNameCaps>
<Asm>
<Caps> 0 </Caps>
<BreaksAfterLabel> 0 </BreaksAfterLabel>
<BreaksAfterLabelEnabled> False </BreaksAfterLabelEnabled>
<StatementIndentEnabled> False </StatementIndentEnabled>
<StatementIndent> 0 </StatementIndent>
<ParamsIndentEnabled> False </ParamsIndentEnabled>
<ParamsIndent> 0 </ParamsIndent>
</Asm>
<PreProcessor>
<Enabled> True </Enabled>
<DefinedSymbols> DELPHI5_UP, MSWINDOWS </DefinedSymbols>
<DefinedOptions> </DefinedOptions>
</PreProcessor>
<Align>
<AlignAssign> True </AlignAssign>
<AlignConst> True </AlignConst>
<AlignTypedef> True </AlignTypedef>
<AlignVars> True </AlignVars>
<AlignComment> True </AlignComment>
<AlignFields> True </AlignFields>
<InterfaceOnly> False </InterfaceOnly>
<MinColumn> 2 </MinColumn>
<MaxColumn> 60 </MaxColumn>
<MaxVariance> 1 </MaxVariance>
<MaxVarianceInterface> 10 </MaxVarianceInterface>
<MaxUnalignedStatements> 0 </MaxUnalignedStatements>
</Align>
<Replace>
<Enabled> False </Enabled>
<Words> </Words>
</Replace>
<Uses>
<RemoveEnabled> False </RemoveEnabled>
<InsertInterfaceEnabled> False </InsertInterfaceEnabled>
<InsertImplementationEnabled> False </InsertImplementationEnabled>
<FindReplaceEnabled> False </FindReplaceEnabled>
<Remove> </Remove>
<InsertInterface> </InsertInterface>
<InsertImplementation> </InsertImplementation>
<Find> </Find>
<Replace> </Replace>
</Uses>
<Transform>
<BeginEndStyle> 1 </BeginEndStyle>
<AddBlockEndSemicolon> True </AddBlockEndSemicolon>
<SortUsesInterface> False </SortUsesInterface>
<SortUsesImplmentation> False </SortUsesImplmentation>
<SortUsesProgram> False </SortUsesProgram>
<SortUsesBreakOnReturn> False </SortUsesBreakOnReturn>
<SortUsesBreakOnComment> True </SortUsesBreakOnComment>
<SortUsesSortOrder> 0 </SortUsesSortOrder>
<SortUsesNoComments> False </SortUsesNoComments>
</Transform>
</JediCodeFormatSettings>

9
config-example.json

@ -112,5 +112,12 @@
"session_secret": "@SESSION_SECRET@", "session_secret": "@SESSION_SECRET@",
"rabbitMQ": "amqp://localhost/", "rabbitMQ": "amqp://localhost/",
"email_jwt_secret": "@EMAIL_JWT_SECRET@", "email_jwt_secret": "@EMAIL_JWT_SECRET@",
"google_analytics": "UA-XXXXXXXX-X" "google_analytics": "UA-XXXXXXXX-X",
"gravatar_url": "https://cdn.v2ex.com/gravatar",
"cdnjs_url": "https://cdnjs.loli.net/ajax/libs",
"self_cdn_url": "",
"google_fonts": {
"type": "like-google-fonts",
"url": "https://fonts.loli.net"
}
} }

36
language-config.json

@ -3,55 +3,64 @@
"show": "C++", "show": "C++",
"highlight": "cpp", "highlight": "cpp",
"version": "GCC 8.2.0", "version": "GCC 8.2.0",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"cpp11": { "cpp11": {
"show": "C++ 11", "show": "C++ 11",
"highlight": "cpp", "highlight": "cpp",
"version": "GCC 8.2.0", "version": "GCC 8.2.0",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"cpp17": { "cpp17": {
"show": "C++ 17", "show": "C++ 17",
"highlight": "cpp", "highlight": "cpp",
"version": "GCC 8.2.0", "version": "GCC 8.2.0",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"cpp-noilinux": { "cpp-noilinux": {
"show": "C++ (NOI)", "show": "C++ (NOI)",
"highlight": "cpp", "highlight": "cpp",
"version": "GCC 4.8.4 (NOILinux 1.4.1)", "version": "GCC 4.8.4 (NOILinux 1.4.1)",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"cpp11-noilinux": { "cpp11-noilinux": {
"show": "C++ 11 (NOI)", "show": "C++ 11 (NOI)",
"highlight": "cpp", "highlight": "cpp",
"version": "GCC 4.8.4 (NOILinux 1.4.1)", "version": "GCC 4.8.4 (NOILinux 1.4.1)",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"cpp11-clang": { "cpp11-clang": {
"show": "C++ 11 (Clang)", "show": "C++ 11 (Clang)",
"highlight": "cpp", "highlight": "cpp",
"version": "Clang 7.0.1", "version": "Clang 7.0.1",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"cpp17-clang": { "cpp17-clang": {
"show": "C++ 17 (Clang)", "show": "C++ 17 (Clang)",
"highlight": "cpp", "highlight": "cpp",
"version": "Clang 7.0.1", "version": "Clang 7.0.1",
"editor": "c_cpp" "editor": "c_cpp",
"format": "cpp"
}, },
"c": { "c": {
"show": "C", "show": "C",
"highlight": "c", "highlight": "c",
"version": "Clang 7.0.1", "version": "Clang 7.0.1",
"editor": "c_cpp" "editor": "c_cpp",
"format": "c"
}, },
"c-noilinux": { "c-noilinux": {
"show": "C (NOI)", "show": "C (NOI)",
"highlight": "c", "highlight": "c",
"version": "GCC 4.8.4 (NOILinux 1.4.1)", "version": "GCC 4.8.4 (NOILinux 1.4.1)",
"editor": "c_cpp" "editor": "c_cpp",
"format": "c"
}, },
"csharp": { "csharp": {
"show": "C#", "show": "C#",
@ -69,13 +78,15 @@
"show": "Java", "show": "Java",
"highlight": "java", "highlight": "java",
"version": "OpenJDK 10.0.2", "version": "OpenJDK 10.0.2",
"editor": "java" "editor": "java",
"format": "java"
}, },
"pascal": { "pascal": {
"show": "Pascal", "show": "Pascal",
"highlight": "pascal", "highlight": "pascal",
"version": "Free Pascal 3.0.4", "version": "Free Pascal 3.0.4",
"editor": "pascal" "editor": "pascal",
"format": "pas"
}, },
"lua": { "lua": {
"show": "Lua", "show": "Lua",
@ -105,7 +116,8 @@
"show": "Node.js", "show": "Node.js",
"highlight": "js", "highlight": "js",
"version": "10.14.0", "version": "10.14.0",
"editor": "javascript" "editor": "javascript",
"format": "js"
}, },
"ruby": { "ruby": {
"show": "Ruby", "show": "Ruby",

54
libs/code_formatter.js

@ -0,0 +1,54 @@
let child_process = require('child_process');
let streamToString = require('stream-to-string');
let tempfile = require('tempfile');
let fs = require('fs-extra');
module.exports = async (code, lang) => {
let timer, result, tempFile;
try {
let process, pascalAddProgram;
if (lang === 'pas') {
tempFile = tempfile('.pas');
if (code.indexOf('program') === -1) {
code = 'program format\n' + code;
pascalAddProgram = true;
}
await fs.writeFile(tempFile, code);
process = child_process.spawn(`${__dirname}/../bin/jcf`, [tempFile, '-inplace']);
} else {
process = child_process.spawn(`clang-format -style="{BasedOnStyle: Google, IndentWidth: 4, AccessModifierOffset: -4, SortIncludes: false, AllowShortIfStatementsOnASingleLine: false, ColumnLimit: 110, Cpp11BracedListStyle: false }" -assume-filename="a.${lang}"`, { shell: true });
process.stdin.setEncoding('utf-8');
process.stdin.write(code);
process.stdin.end();
}
timer = setTimeout(() => process.kill(), 5000);
if (lang === 'pas') {
await streamToString(process.stdout);
result = await fs.readFile(tempFile, 'utf-8');
if (pascalAddProgram) result = result.replace('program format\n', '');
} else {
result = await streamToString(process.stdout);
}
await new Promise((resolve, reject) => {
let exit = code => {
if (code === 0) resolve();
else reject(code);
}
if (process.exitCode !== null) exit(process.exitCode);
else process.on('close', exit);
});
} catch (e) {
console.log(e.stack);
result = null;
}
clearTimeout(timer);
try { if (tempFile) await fs.delete(tempFile); } catch (e) {}
return result;
}

35
libs/judger.js

@ -13,6 +13,21 @@ let amqpConnection;
let amqpSendChannel; let amqpSendChannel;
let amqpConsumeChannel; let amqpConsumeChannel;
const judgeStateCache = new Map();
function getRunningTaskStatusString(result) {
let isPending = status => [0, 1].includes(status);
let allFinished = 0, allTotal = 0;
for (let subtask of result.judge.subtasks) {
for (let curr of subtask.cases) {
allTotal++;
if (!isPending(curr.status)) allFinished++;
}
}
return `Running ${allFinished}/${allTotal}`;
}
async function connect () { async function connect () {
amqpConnection = await amqp.connect(syzoj.config.rabbitMQ); amqpConnection = await amqp.connect(syzoj.config.rabbitMQ);
amqpSendChannel = await amqpConnection.createChannel(); amqpSendChannel = await amqpConnection.createChannel();
@ -55,6 +70,7 @@ async function connect () {
} else { } else {
winston.error("Unsupported result type: " + data.type); winston.error("Unsupported result type: " + data.type);
} }
})(msg).then(async() => { })(msg).then(async() => {
amqpConsumeChannel.ack(msg) amqpConsumeChannel.ack(msg)
}, async(err) => { }, async(err) => {
@ -73,18 +89,35 @@ async function connect () {
(async (result) => { (async (result) => {
if (result.type === interface.ProgressReportType.Started) { if (result.type === interface.ProgressReportType.Started) {
socketio.createTask(result.taskId); socketio.createTask(result.taskId);
judgeStateCache.set(data.taskId, {
result: 'Compiling',
score: 0,
time: 0,
memory: 0
})
} else if (result.type === interface.ProgressReportType.Compiled) { } else if (result.type === interface.ProgressReportType.Compiled) {
socketio.updateCompileStatus(result.taskId, result.progress); socketio.updateCompileStatus(result.taskId, result.progress);
} else if (result.type === interface.ProgressReportType.Progress) { } else if (result.type === interface.ProgressReportType.Progress) {
const convertedResult = judgeResult.convertResult(data.taskId, data.progress);
judgeStateCache.set(data.taskId, {
result: getRunningTaskStatusString(data.progress),
score: convertedResult.score,
time: convertedResult.time,
memory: convertedResult.memory
});
socketio.updateProgress(result.taskId, result.progress); socketio.updateProgress(result.taskId, result.progress);
} else if (result.type === interface.ProgressReportType.Finished) { } else if (result.type === interface.ProgressReportType.Finished) {
socketio.updateResult(result.taskId, result.progress); socketio.updateResult(result.taskId, result.progress);
setTimeout(() => {
judgeStateCache.delete(result.taskId);
}, 5000);
} else if (result.type === interface.ProgressReportType.Reported) { } else if (result.type === interface.ProgressReportType.Reported) {
socketio.cleanupProgress(result.taskId); socketio.cleanupProgress(result.taskId);
} }
})(data).then(async() => { })(data).then(async() => {
progressChannel.ack(msg) progressChannel.ack(msg)
}, async(err) => { }, async(err) => {
console.log(err);
winston.error('Error handling progress', err); winston.error('Error handling progress', err);
progressChannel.nack(msg, false, false); progressChannel.nack(msg, false, false);
}); });
@ -139,3 +172,5 @@ module.exports.judge = async function (judge_state, problem, priority) {
amqpSendChannel.sendToQueue('judge', msgPack.encode({ content: content, extraData: extraData }), { priority: priority }); amqpSendChannel.sendToQueue('judge', msgPack.encode({ content: content, extraData: extraData }), { priority: priority });
} }
module.exports.getCachedJudgeState = taskId => judgeStateCache.get(taskId);

19
libs/submissions_process.js

@ -1,3 +1,5 @@
const { getCachedJudgeState } = require('./judger');
const getSubmissionInfo = (s, displayConfig) => ({ const getSubmissionInfo = (s, displayConfig) => ({
submissionId: s.id, submissionId: s.id,
taskId: s.task_id, taskId: s.task_id,
@ -6,20 +8,27 @@ const getSubmissionInfo = (s, displayConfig) => ({
problemName: s.problem.title, problemName: s.problem.title,
problemId: s.problem_id, problemId: s.problem_id,
language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null, language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null,
codeSize: displayConfig.showCode ? syzoj.utils.formatSize(s.code_length) : null, codeSize: displayConfig.showCode ? s.code_length : null,
submitTime: syzoj.utils.formatDate(s.submit_time), submitTime: syzoj.utils.formatDate(s.submit_time),
}); });
const getRoughResult = (x, displayConfig) => { const getRoughResult = (x, displayConfig, roughOnly) => {
if (displayConfig.showResult) { if (displayConfig.showResult) {
if (x.pending) { if (x.pending) {
return null; let res = getCachedJudgeState(x.task_id) || null
if (!res) return null;
if (roughOnly) {
res.result = 'Judging';
res.time = res.memory = res.score = 0;
}
return res;
} else { } else {
return { return {
result: x.status, result: x.status,
time: displayConfig.showUsage ? x.total_time : null, time: displayConfig.showUsage ? x.total_time : null,
memory: displayConfig.showUsage ? syzoj.utils.formatSize((x.max_memory * 1024) || 0, 2) : null, memory: displayConfig.showUsage ? x.max_memory : null,
precise_memory: displayConfig.showUsage ? x.max_memory : null,
score: displayConfig.showScore ? x.score : null score: displayConfig.showScore ? x.score : null
}; };
} }

31
models/formatted_code.js

@ -0,0 +1,31 @@
let Sequelize = require('sequelize');
let db = syzoj.db;
let model = db.define('formatted_code', {
key: { type: Sequelize.STRING(50), primaryKey: true },
code: { type: Sequelize.TEXT('medium') }
}, {
timestamps: false,
tableName: 'formatted_code',
indexes: [
{
fields: ['key']
}
]
});
let Model = require('./common');
class FormattedCode extends Model {
static async create(val) {
return FormattedCode.fromRecord(FormattedCode.model.build(Object.assign({
key: "",
code: ""
}, val)));
}
getModel() { return model; }
}
FormattedCode.model = model;
module.exports = FormattedCode;

1
models/user.js

@ -17,6 +17,7 @@ let model = db.define('user', {
is_admin: { type: Sequelize.BOOLEAN }, is_admin: { type: Sequelize.BOOLEAN },
is_show: { type: Sequelize.BOOLEAN }, is_show: { type: Sequelize.BOOLEAN },
public_email: { type: Sequelize.BOOLEAN }, public_email: { type: Sequelize.BOOLEAN },
prefer_formatted_code: { type: Sequelize.BOOLEAN },
sex: { type: Sequelize.INTEGER }, sex: { type: Sequelize.INTEGER },
rating: { type: Sequelize.INTEGER }, rating: { type: Sequelize.INTEGER },

22
modules/admin.js

@ -60,24 +60,7 @@ let configItems = {
'page.ranklist': { name: '排行榜', type: Number }, 'page.ranklist': { name: '排行榜', type: Number },
'page.discussion': { name: '讨论', type: Number }, 'page.discussion': { name: '讨论', type: Number },
'page.article_comment': { name: '评论', type: Number }, 'page.article_comment': { name: '评论', type: Number },
'page.contest': { name: '比赛', type: Number }, 'page.contest': { name: '比赛', type: Number }
'编译器版本': null,
'languages.cpp.version': { name: 'C++', type: String },
'languages.cpp11.version': { name: 'C++11', type: String },
'languages.csharp.version': { name: 'C#', type: String },
'languages.c.version': { name: 'C', type: String },
'languages.vala.version': { name: 'Vala', type: String },
'languages.java.version': { name: 'Java', type: String },
'languages.pascal.version': { name: 'Pascal', type: String },
'languages.lua.version': { name: 'Lua', type: String },
'languages.luajit.version': { name: 'LuaJIT', type: String },
'languages.python2.version': { name: 'Python 2', type: String },
'languages.python3.version': { name: 'Python 3', type: String },
'languages.nodejs.version': { name: 'Node.js', type: String },
'languages.ruby.version': { name: 'Ruby', type: String },
'languages.haskell.version': { name: 'Haskell', type: String },
'languages.ocaml.version': { name: 'OCaml', type: String },
'languages.vbnet.version': { name: 'Visual Basic', type: String }
}; };
app.get('/admin/config', async (req, res) => { app.get('/admin/config', async (req, res) => {
@ -371,7 +354,8 @@ app.post('/admin/rejudge', async (req, res) => {
}; };
if (req.body.language) { if (req.body.language) {
if (req.body.language === 'submit-answer') where.language = ''; if (req.body.language === 'submit-answer') where.language = { $or: [{ $eq: '', }, { $eq: null }] };
else if (req.body.language === 'non-submit-answer') where.language = { $not: '' };
else where.language = req.body.language; else where.language = req.body.language;
} }
if (req.body.status) where.status = { $like: req.body.status + '%' }; if (req.body.status) where.status = { $like: req.body.status + '%' };

4
modules/contest.js

@ -83,7 +83,11 @@ app.post('/contest/:id/edit', async (req, res) => {
ranklist = contest.ranklist; ranklist = contest.ranklist;
} }
try {
ranklist.ranking_params = JSON.parse(req.body.ranking_params); ranklist.ranking_params = JSON.parse(req.body.ranking_params);
} catch (e) {
ranklist.ranking_params = {};
}
await ranklist.save(); await ranklist.save();
contest.ranklist_id = ranklist.id; contest.ranklist_id = ranklist.id;

23
modules/problem.js

@ -1,5 +1,6 @@
let Problem = syzoj.model('problem'); let Problem = syzoj.model('problem');
let JudgeState = syzoj.model('judge_state'); let JudgeState = syzoj.model('judge_state');
let FormattedCode = syzoj.model('formatted_code');
let CustomTest = syzoj.model('custom_test'); let CustomTest = syzoj.model('custom_test');
let WaitingJudge = syzoj.model('waiting_judge'); let WaitingJudge = syzoj.model('waiting_judge');
let Contest = syzoj.model('contest'); let Contest = syzoj.model('contest');
@ -9,6 +10,7 @@ let Article = syzoj.model('article');
const Sequelize = require('sequelize'); const Sequelize = require('sequelize');
let Judger = syzoj.lib('judger'); let Judger = syzoj.lib('judger');
let CodeFormatter = syzoj.lib('code_formatter');
app.get('/problems', async (req, res) => { app.get('/problems', async (req, res) => {
try { try {
@ -665,6 +667,27 @@ app.post('/problem/:id/submit', app.multer.fields([{ name: 'answer', maxCount: 1
} }
await judge_state.updateRelatedInfo(true); await judge_state.updateRelatedInfo(true);
if (problem.type !== 'submit-answer' && syzoj.languages[req.body.language].format) {
let key = syzoj.utils.getFormattedCodeKey(judge_state.code, req.body.language);
let formattedCode = await FormattedCode.findOne({
where: {
key: key
}
});
if (!formattedCode) {
let formatted = await CodeFormatter(judge_state.code, syzoj.languages[req.body.language].format);
if (formatted) {
formattedCode = await FormattedCode.create({
key: key,
code: formatted
});
await formattedCode.save();
}
}
}
try { try {
await Judger.judge(judge_state, problem, contest_id ? 3 : 2); await Judger.judge(judge_state, problem, contest_id ? 3 : 2);
judge_state.pending = true; judge_state.pending = true;

14
modules/socketio.js

@ -232,7 +232,15 @@ exports.updateCompileStatus = updateCompileStatus;
function updateProgress(taskId, data) { function updateProgress(taskId, data) {
winston.verbose(`Updating progress for #${taskId}`); winston.verbose(`Updating progress for #${taskId}`);
currentJudgeList[taskId] = data; currentJudgeList[taskId] = data;
const finalResult = judgeResult.convertResult(taskId, data);
const roughResult = {
result: "Running",
time: finalResult.time,
memory: finalResult.memory,
score: finalResult.score
};
forAllClients(detailProgressNamespace, taskId, (client) => { forAllClients(detailProgressNamespace, taskId, (client) => {
try {
winston.debug(`Pushing progress update to ${client}`); winston.debug(`Pushing progress update to ${client}`);
if (clientDetailProgressList[client] && clientDisplayConfigList[client]) { if (clientDetailProgressList[client] && clientDisplayConfigList[client]) {
const original = clientDetailProgressList[client].content; const original = clientDetailProgressList[client].content;
@ -242,10 +250,14 @@ function updateProgress(taskId, data) {
taskId: taskId, taskId: taskId,
from: version, from: version,
to: version + 1, to: version + 1,
delta: diff.diff(original, updated) delta: diff.diff(original, updated),
roughResult: roughResult
}); });
clientDetailProgressList[client].version++; clientDetailProgressList[client].version++;
} }
} catch (e) {
console.log(e);
}
}); });
} }
exports.updateProgress = updateProgress; exports.updateProgress = updateProgress;

32
modules/submission.js

@ -1,4 +1,5 @@
let JudgeState = syzoj.model('judge_state'); let JudgeState = syzoj.model('judge_state');
let FormattedCode = syzoj.model('formatted_code');
let User = syzoj.model('user'); let User = syzoj.model('user');
let Contest = syzoj.model('contest'); let Contest = syzoj.model('contest');
let Problem = syzoj.model('problem'); let Problem = syzoj.model('problem');
@ -62,7 +63,8 @@ app.get('/submissions', async (req, res) => {
} }
if (req.query.language) { if (req.query.language) {
if (req.query.language === 'submit-answer') where.language = ''; if (req.query.language === 'submit-answer') where.language = { $or: [{ $eq: '', }, { $eq: null }] };
else if (req.query.language === 'non-submit-answer') where.language = { $not: '' };
else where.language = req.query.language; else where.language = req.query.language;
} }
if (req.query.status) where.status = { $like: req.query.status + '%' }; if (req.query.status) where.status = { $like: req.query.status + '%' };
@ -96,7 +98,10 @@ app.get('/submissions', async (req, res) => {
let paginate = syzoj.utils.paginate(await JudgeState.count(where), req.query.page, syzoj.config.page.judge_state); let paginate = syzoj.utils.paginate(await JudgeState.count(where), req.query.page, syzoj.config.page.judge_state);
let judge_state = await JudgeState.query(paginate, where, [['id', 'desc']], true); let judge_state = await JudgeState.query(paginate, where, [['id', 'desc']], true);
await judge_state.forEachAsync(async obj => obj.loadRelationships()); await judge_state.forEachAsync(async obj => {
await obj.loadRelationships();
if (obj.problem.type !== 'submit-answer') obj.code_length = obj.code.length;
})
res.render('submissions', { res.render('submissions', {
// judge_state: judge_state, // judge_state: judge_state,
@ -107,7 +112,7 @@ app.get('/submissions', async (req, res) => {
type: 'rough', type: 'rough',
displayConfig: displayConfig displayConfig: displayConfig
}, syzoj.config.session_secret) : null, }, syzoj.config.session_secret) : null,
result: getRoughResult(x, displayConfig), result: getRoughResult(x, displayConfig, true),
running: false, running: false,
})), })),
paginate: paginate, paginate: paginate,
@ -139,22 +144,37 @@ app.get('/submission/:id', async (req, res) => {
if ((!contest.ended || !contest.is_public) && if ((!contest.ended || !contest.is_public) &&
!(await judge.problem.isAllowedEditBy(res.locals.user) || await contest.isSupervisior(curUser))) { !(await judge.problem.isAllowedEditBy(res.locals.user) || await contest.isSupervisior(curUser))) {
throw new Error("比赛没有结束或者没有公开哦"); throw new Error("比赛未结束或未公开。");
} }
} }
await judge.loadRelationships(); await judge.loadRelationships();
if (judge.problem.type !== 'submit-answer') { if (judge.problem.type !== 'submit-answer') {
judge.codeLength = judge.code.length; judge.code_length = judge.code.length;
let key = syzoj.utils.getFormattedCodeKey(judge.code, judge.language);
if (key) {
let formattedCode = await FormattedCode.findOne({
where: {
key: key
}
});
if (formattedCode) {
judge.formattedCode = await syzoj.utils.highlight(formattedCode.code, syzoj.languages[judge.language].highlight);
}
}
judge.code = await syzoj.utils.highlight(judge.code, syzoj.languages[judge.language].highlight); judge.code = await syzoj.utils.highlight(judge.code, syzoj.languages[judge.language].highlight);
} }
displayConfig.showRejudge = await judge.problem.isAllowedEditBy(res.locals.user); displayConfig.showRejudge = await judge.problem.isAllowedEditBy(res.locals.user);
res.render('submission', { res.render('submission', {
info: getSubmissionInfo(judge, displayConfig), info: getSubmissionInfo(judge, displayConfig),
roughResult: getRoughResult(judge, displayConfig), roughResult: getRoughResult(judge, displayConfig, false),
code: (judge.problem.type !== 'submit-answer') ? judge.code.toString("utf8") : '', code: (judge.problem.type !== 'submit-answer') ? judge.code.toString("utf8") : '',
formattedCode: judge.formattedCode ? judge.formattedCode.toString("utf8") : null,
preferFormattedCode: res.locals.user ? res.locals.user.prefer_formatted_code : false,
detailResult: processOverallResult(judge.result, displayConfig), detailResult: processOverallResult(judge.result, displayConfig),
socketToken: (judge.pending && judge.task_id != null) ? jwt.sign({ socketToken: (judge.pending && judge.task_id != null) ? jwt.sign({
taskId: judge.task_id, taskId: judge.task_id,

1
modules/user.js

@ -187,6 +187,7 @@ app.post('/user/:id/edit', async (req, res) => {
user.information = req.body.information; user.information = req.body.information;
user.sex = req.body.sex; user.sex = req.body.sex;
user.public_email = (req.body.public_email === 'on'); user.public_email = (req.body.public_email === 'on');
user.prefer_formatted_code = (req.body.prefer_formatted_code === 'on');
await user.save(); await user.save();

10
package.json

@ -40,15 +40,15 @@
"gravatar": "^1.8.0", "gravatar": "^1.8.0",
"javascript-time-ago": "^1.0.30", "javascript-time-ago": "^1.0.30",
"js-yaml": "^3.9.0", "js-yaml": "^3.9.0",
"jsondiffpatch": "0.3.11", "jsondiffpatch": "0.2.5",
"jsonwebtoken": "^8.4.0", "jsonwebtoken": "^8.4.0",
"katex": "^0.10.0", "katex": "^0.10.0",
"mathjax-node": "^2.1.1", "mathjax-node": "^2.1.1",
"moemark": "^0.3.10", "moemark": "^0.3.10",
"moment": "^2.15.0", "moment": "^2.23.0",
"msgpack-lite": "^0.1.26", "msgpack-lite": "^0.1.26",
"multer": "^1.2.0", "multer": "^1.2.0",
"mysql2": "^1.6.4", "mariadb": "^2.0.2-rc",
"node-7z": "^0.4.0", "node-7z": "^0.4.0",
"nodemailer": "^4.7.0", "nodemailer": "^4.7.0",
"object-assign-deep": "^0.4.0", "object-assign-deep": "^0.4.0",
@ -57,10 +57,12 @@
"request": "^2.74.0", "request": "^2.74.0",
"request-promise": "^4.1.1", "request-promise": "^4.1.1",
"sendmail": "^1.1.1", "sendmail": "^1.1.1",
"sequelize": "^4.41.2", "sequelize": "^5.0.0-beta.15",
"session-file-store": "^1.0.0", "session-file-store": "^1.0.0",
"socket.io": "^2.2.0", "socket.io": "^2.2.0",
"stream-to-string": "^1.1.0",
"syzoj-divine": "^1.0.2", "syzoj-divine": "^1.0.2",
"tempfile": "^2.0.0",
"tmp-promise": "^1.0.3", "tmp-promise": "^1.0.3",
"waliyun": "^3.1.1", "waliyun": "^3.1.1",
"winston": "^3.1.0", "winston": "^3.1.0",

18962
static/cdnjs/Chart.js/2.7.3/Chart.bundle.js

File diff suppressed because it is too large Load Diff

10
static/cdnjs/Chart.js/2.7.3/Chart.bundle.min.js vendored

File diff suppressed because one or more lines are too long

14456
static/cdnjs/Chart.js/2.7.3/Chart.js vendored

File diff suppressed because it is too large Load Diff

10
static/cdnjs/Chart.js/2.7.3/Chart.min.js vendored

File diff suppressed because one or more lines are too long

335
static/cdnjs/KaTeX/0.10.0/contrib/auto-render.js

@ -0,0 +1,335 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("katex"));
else if(typeof define === 'function' && define.amd)
define(["katex"], factory);
else if(typeof exports === 'object')
exports["renderMathInElement"] = factory(require("katex"));
else
root["renderMathInElement"] = factory(root["katex"]);
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external "katex"
var external_katex_ = __webpack_require__(0);
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
/* eslint no-constant-condition:0 */
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
// Adapted from
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
var index = startIndex;
var braceLevel = 0;
var delimLength = delimiter.length;
while (index < text.length) {
var character = text[index];
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
return index;
} else if (character === "\\") {
index++;
} else if (character === "{") {
braceLevel++;
} else if (character === "}") {
braceLevel--;
}
index++;
}
return -1;
};
var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) {
var finalData = [];
for (var i = 0; i < startData.length; i++) {
if (startData[i].type === "text") {
var text = startData[i].data;
var lookingForLeft = true;
var currIndex = 0;
var nextIndex = void 0;
nextIndex = text.indexOf(leftDelim);
if (nextIndex !== -1) {
currIndex = nextIndex;
finalData.push({
type: "text",
data: text.slice(0, currIndex)
});
lookingForLeft = false;
}
while (true) {
if (lookingForLeft) {
nextIndex = text.indexOf(leftDelim, currIndex);
if (nextIndex === -1) {
break;
}
finalData.push({
type: "text",
data: text.slice(currIndex, nextIndex)
});
currIndex = nextIndex;
} else {
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length);
if (nextIndex === -1) {
break;
}
finalData.push({
type: "math",
data: text.slice(currIndex + leftDelim.length, nextIndex),
rawData: text.slice(currIndex, nextIndex + rightDelim.length),
display: display
});
currIndex = nextIndex + rightDelim.length;
}
lookingForLeft = !lookingForLeft;
}
finalData.push({
type: "text",
data: text.slice(currIndex)
});
} else {
finalData.push(startData[i]);
}
}
return finalData;
};
/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
/* eslint no-console:0 */
var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) {
var data = [{
type: "text",
data: text
}];
for (var i = 0; i < delimiters.length; i++) {
var delimiter = delimiters[i];
data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false);
}
return data;
};
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
* API, we should copy it before mutating.
*/
var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) {
var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters);
var fragment = document.createDocumentFragment();
for (var i = 0; i < data.length; i++) {
if (data[i].type === "text") {
fragment.appendChild(document.createTextNode(data[i].data));
} else {
var span = document.createElement("span");
var math = data[i].data; // Override any display mode defined in the settings with that
// defined by the text itself
optionsCopy.displayMode = data[i].display;
try {
external_katex_default.a.render(math, span, optionsCopy);
} catch (e) {
if (!(e instanceof external_katex_default.a.ParseError)) {
throw e;
}
optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
fragment.appendChild(document.createTextNode(data[i].rawData));
continue;
}
fragment.appendChild(span);
}
}
return fragment;
};
var renderElem = function renderElem(elem, optionsCopy) {
for (var i = 0; i < elem.childNodes.length; i++) {
var childNode = elem.childNodes[i];
if (childNode.nodeType === 3) {
// Text node
var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy);
i += frag.childNodes.length - 1;
elem.replaceChild(frag, childNode);
} else if (childNode.nodeType === 1) {
(function () {
// Element node
var className = ' ' + childNode.className + ' ';
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
return className.indexOf(' ' + x + ' ') === -1;
});
if (shouldRender) {
renderElem(childNode, optionsCopy);
}
})();
} // Otherwise, it's something else, and ignore it.
}
};
var renderMathInElement = function renderMathInElement(elem, options) {
if (!elem) {
throw new Error("No element provided to render");
}
var optionsCopy = {}; // Object.assign(optionsCopy, option)
for (var option in options) {
if (options.hasOwnProperty(option)) {
optionsCopy[option] = options[option];
}
} // default options
optionsCopy.delimiters = optionsCopy.delimiters || [{
left: "$$",
right: "$$",
display: true
}, {
left: "\\(",
right: "\\)",
display: false
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
// {left: "$", right: "$", display: false},
// \[…\] must come last in this array. Otherwise, renderMathInElement
// will search for \[ before it searches for $$ or \(
// That makes it susceptible to finding a \\[0.3em] row delimiter and
// treating it as if it were the start of a KaTeX math zone.
{
left: "\\[",
right: "\\]",
display: true
}];
optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code"];
optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
// math elements within a single call to `renderMathInElement`.
optionsCopy.macros = optionsCopy.macros || {};
renderElem(elem, optionsCopy);
};
/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement);
/***/ })
/******/ ])["default"];
});

1
static/cdnjs/KaTeX/0.10.0/contrib/auto-render.min.js vendored

@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(r){return function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(e,t){e.exports=r},function(e,t,r){"use strict";r.r(t);var n=r(0),l=r.n(n),s=function(e,t,r){for(var n=r,o=0,a=e.length;n<t.length;){var i=t[n];if(o<=0&&t.slice(n,n+a)===e)return n;"\\"===i?n++:"{"===i?o++:"}"===i&&o--,n++}return-1},d=function(e,t,r,n){for(var o=[],a=0;a<e.length;a++)if("text"===e[a].type){var i=e[a].data,l=!0,d=0,f=void 0;for(-1!==(f=i.indexOf(t))&&(d=f,o.push({type:"text",data:i.slice(0,d)}),l=!1);;){if(l){if(-1===(f=i.indexOf(t,d)))break;o.push({type:"text",data:i.slice(d,f)}),d=f}else{if(-1===(f=s(r,i,d+t.length)))break;o.push({type:"math",data:i.slice(d+t.length,f),rawData:i.slice(d,f+r.length),display:n}),d=f+r.length}l=!l}o.push({type:"text",data:i.slice(d)})}else o.push(e[a]);return o},i=function(e,t){for(var r=function(e,t){for(var r=[{type:"text",data:e}],n=0;n<t.length;n++){var o=t[n];r=d(r,o.left,o.right,o.display||!1)}return r}(e,t.delimiters),n=document.createDocumentFragment(),o=0;o<r.length;o++)if("text"===r[o].type)n.appendChild(document.createTextNode(r[o].data));else{var a=document.createElement("span"),i=r[o].data;t.displayMode=r[o].display;try{l.a.render(i,a,t)}catch(e){if(!(e instanceof l.a.ParseError))throw e;t.errorCallback("KaTeX auto-render: Failed to parse `"+r[o].data+"` with ",e),n.appendChild(document.createTextNode(r[o].rawData));continue}n.appendChild(a)}return n};t.default=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},function e(t,r){for(var n=0;n<t.childNodes.length;n++){var o=t.childNodes[n];if(3===o.nodeType){var a=i(o.textContent,r);n+=a.childNodes.length-1,t.replaceChild(a,o)}else 1===o.nodeType&&function(){var t=" "+o.className+" ";-1===r.ignoredTags.indexOf(o.nodeName.toLowerCase())&&r.ignoredClasses.every(function(e){return-1===t.indexOf(" "+e+" ")})&&e(o,r)}()}}(e,r)}}]).default});

14
static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.css

@ -0,0 +1,14 @@
/* Force selection of entire .katex/.katex-display blocks, so that we can
* copy/paste the entire source code. If you omit this CSS, partial
* selections of a formula will work, but will copy the ugly HTML
* representation instead of the LaTeX source code. (Full selections will
* still produce the LaTeX source code.)
*/
.katex,
.katex-display {
user-select: all;
-moz-user-select: all;
-webkit-user-select: all;
-ms-user-select: all;
}

208
static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.js

@ -0,0 +1,208 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})((typeof self !== 'undefined' ? self : this), function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/* 1 */,
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./contrib/copy-tex/copy-tex.css
var copy_tex = __webpack_require__(0);
// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
// Set these to how you want inline and display math to be delimited.
var defaultCopyDelimiters = {
inline: ['$', '$'],
// alternative: ['\(', '\)']
display: ['$$', '$$'] // alternative: ['\[', '\]']
}; // Replace .katex elements with their TeX source (<annotation> element).
// Modifies fragment in-place. Useful for writing your own 'copy' handler,
// as in copy-tex.js.
var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) {
if (copyDelimiters === void 0) {
copyDelimiters = defaultCopyDelimiters;
}
// Remove .katex-html blocks that are preceded by .katex-mathml blocks
// (which will get replaced below).
var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
for (var i = 0; i < katexHtml.length; i++) {
var element = katexHtml[i];
if (element.remove) {
element.remove(null);
} else {
element.parentNode.removeChild(element);
}
} // Replace .katex-mathml elements with their annotation (TeX source)
// descendant, with inline delimiters.
var katexMathml = fragment.querySelectorAll('.katex-mathml');
for (var _i = 0; _i < katexMathml.length; _i++) {
var _element = katexMathml[_i];
var texSource = _element.querySelector('annotation');
if (texSource) {
if (_element.replaceWith) {
_element.replaceWith(texSource);
} else {
_element.parentNode.replaceChild(texSource, _element);
}
texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
}
} // Switch display math to display delimiters.
var displays = fragment.querySelectorAll('.katex-display annotation');
for (var _i2 = 0; _i2 < displays.length; _i2++) {
var _element2 = displays[_i2];
_element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
}
return fragment;
};
/* harmony default export */ var katex2tex = (katexReplaceWithTex);
// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js
// Global copy handler to modify behavior on .katex elements.
document.addEventListener('copy', function (event) {
var selection = window.getSelection();
if (selection.isCollapsed) {
return; // default action OK if selection is empty
}
var fragment = selection.getRangeAt(0).cloneContents();
if (!fragment.querySelector('.katex-mathml')) {
return; // default action OK if no .katex-mathml elements
} // Preserve usual HTML copy/paste behavior.
var html = [];
for (var i = 0; i < fragment.childNodes.length; i++) {
html.push(fragment.childNodes[i].outerHTML);
}
event.clipboardData.setData('text/html', html.join('')); // Rewrite plain-text version.
event.clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling.
event.preventDefault();
});
/***/ })
/******/ ])["default"];
});

1
static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.min.css vendored

@ -0,0 +1 @@
.katex,.katex-display{-moz-user-select:all;-ms-user-select:all;-webkit-user-select:all;user-select:all}

1
static/cdnjs/KaTeX/0.10.0/contrib/copy-tex.min.js vendored

@ -0,0 +1 @@
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t,n){},,function(e,t,n){"use strict";n.r(t);n(0);var p={inline:["$","$"],display:["$$","$$"]},l=function(e,t){void 0===t&&(t=p);for(var n=e.querySelectorAll(".katex-mathml + .katex-html"),r=0;r<n.length;r++){var o=n[r];o.remove?o.remove(null):o.parentNode.removeChild(o)}for(var l=e.querySelectorAll(".katex-mathml"),i=0;i<l.length;i++){var a=l[i],u=a.querySelector("annotation");u&&(a.replaceWith?a.replaceWith(u):a.parentNode.replaceChild(u,a),u.innerHTML=t.inline[0]+u.innerHTML+t.inline[1])}for(var f=e.querySelectorAll(".katex-display annotation"),c=0;c<f.length;c++){var d=f[c];d.innerHTML=t.display[0]+d.innerHTML.substr(t.inline[0].length,d.innerHTML.length-t.inline[0].length-t.inline[1].length)+t.display[1]}return e};document.addEventListener("copy",function(e){var t=window.getSelection();if(!t.isCollapsed){var n=t.getRangeAt(0).cloneContents();if(n.querySelector(".katex-mathml")){for(var r=[],o=0;o<n.childNodes.length;o++)r.push(n.childNodes[o].outerHTML);e.clipboardData.setData("text/html",r.join("")),e.clipboardData.setData("text/plain",l(n).textContent),e.preventDefault()}}})}]).default});

137
static/cdnjs/KaTeX/0.10.0/contrib/mathtex-script-type.js

@ -0,0 +1,137 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("katex"));
else if(typeof define === 'function' && define.amd)
define(["katex"], factory);
else {
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
var scripts = document.body.getElementsByTagName("script");
scripts = Array.prototype.slice.call(scripts);
scripts.forEach(function (script) {
if (!script.type || !script.type.match(/math\/tex/i)) {
return -1;
}
var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
var katexElement = document.createElement(display ? "div" : "span");
katexElement.setAttribute("class", display ? "equation" : "inline-equation");
try {
katex__WEBPACK_IMPORTED_MODULE_0___default.a.render(script.text, katexElement, {
displayMode: display
});
} catch (err) {
//console.error(err); linter doesn't like this
katexElement.textContent = script.text;
}
script.parentNode.replaceChild(katexElement, script);
});
/***/ })
/******/ ])["default"];
});

1
static/cdnjs/KaTeX/0.10.0/contrib/mathtex-script-type.min.js vendored

@ -0,0 +1 @@
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,function(r){return function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(e,t){e.exports=r},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),u=document.body.getElementsByTagName("script");(u=Array.prototype.slice.call(u)).forEach(function(t){if(!t.type||!t.type.match(/math\/tex/i))return-1;var e=null!=t.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(e?"div":"span");r.setAttribute("class",e?"equation":"inline-equation");try{o.a.render(t.text,r,{displayMode:e})}catch(e){r.textContent=t.text}t.parentNode.replaceChild(r,t)})}]).default});

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_AMS-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_AMS-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_AMS-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Bold.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Bold.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Bold.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Caligraphic-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Bold.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Bold.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Bold.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Fraktur-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Bold.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Bold.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Bold.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-BoldItalic.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-BoldItalic.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-BoldItalic.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Italic.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Italic.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Italic.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Main-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-BoldItalic.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-BoldItalic.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-BoldItalic.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-Italic.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-Italic.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Math-Italic.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Bold.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Bold.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Bold.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Italic.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Italic.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Italic.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_SansSerif-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Script-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Script-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Script-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size1-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size1-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size1-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size2-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size2-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size2-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size3-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size3-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size3-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size4-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size4-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Size4-Regular.woff2

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Typewriter-Regular.ttf

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Typewriter-Regular.woff

Binary file not shown.

BIN
static/cdnjs/KaTeX/0.10.0/fonts/KaTeX_Typewriter-Regular.woff2

Binary file not shown.

1
static/cdnjs/KaTeX/0.10.0/katex.min.css vendored

File diff suppressed because one or more lines are too long

1
static/cdnjs/KaTeX/0.10.0/katex.min.js vendored

File diff suppressed because one or more lines are too long

17
static/cdnjs/ace/1.4.2/ace.js

File diff suppressed because one or more lines are too long

8
static/cdnjs/ace/1.4.2/ext-beautify.js

@ -0,0 +1,8 @@
define("ace/ext/beautify",["require","exports","module","ace/token_iterator"],function(e,t,n){"use strict";function i(e,t){return e.type.lastIndexOf(t+".xml")>-1}var r=e("../token_iterator").TokenIterator;t.singletonTags=["area","base","br","col","command","embed","hr","html","img","input","keygen","link","meta","param","source","track","wbr"],t.blockTags=["article","aside","blockquote","body","div","dl","fieldset","footer","form","head","header","html","nav","ol","p","script","section","style","table","tbody","tfoot","thead","ul"],t.beautify=function(e){var n=new r(e,0,0),s=n.getCurrentToken(),o=e.getTabString(),u=t.singletonTags,a=t.blockTags,f,l=!1,c=!1,h=!1,p="",d="",v="",m=0,g=0,y=0,b=0,w=0,E=0,S=!1,x,T=0,N=0,C=[],k=!1,L,A=!1,O=!1,M=!1,_=!1,D={0:0},P={},H=function(){f&&f.value&&f.type!=="string.regexp"&&(f.value=f.value.trim())},B=function(){p=p.replace(/ +$/,"")},j=function(){p=p.trimRight(),l=!1};while(s!==null){T=n.getCurrentTokenRow(),C=n.$rowTokens,f=n.stepForward();if(typeof s!="undefined"){d=s.value,w=0,M=v==="style"||e.$modeId==="ace/mode/css",i(s,"tag-open")?(O=!0,f&&(_=a.indexOf(f.value)!==-1),d==="</"&&(_&&!l&&N<1&&N++,M&&(N=1),w=1,_=!1)):i(s,"tag-close")?O=!1:i(s,"comment.start")?_=!0:i(s,"comment.end")&&(_=!1),!O&&!N&&s.type==="paren.rparen"&&s.value.substr(0,1)==="}"&&N++,T!==x&&(N=T,x&&(N-=x));if(N){j();for(;N>0;N--)p+="\n";l=!0,!i(s,"comment")&&!s.type.match(/^(comment|string)$/)&&(d=d.trimLeft())}if(d){s.type==="keyword"&&d.match(/^(if|else|elseif|for|foreach|while|switch)$/)?(P[m]=d,H(),h=!0,d.match(/^(else|elseif)$/)&&p.match(/\}[\s]*$/)&&(j(),c=!0)):s.type==="paren.lparen"?(H(),d.substr(-1)==="{"&&(h=!0,A=!1,O||(N=1)),d.substr(0,1)==="{"&&(c=!0,p.substr(-1)!=="["&&p.trimRight().substr(-1)==="["?(j(),c=!1):p.trimRight().substr(-1)===")"?j():B())):s.type==="paren.rparen"?(w=1,d.substr(0,1)==="}"&&(P[m-1]==="case"&&w++,p.trimRight().substr(-1)==="{"?j():(c=!0,M&&(N+=2))),d.substr(0,1)==="]"&&p.substr(-1)!=="}"&&p.trimRight().substr(-1)==="}"&&(c=!1,b++,j()),d.substr(0,1)===")"&&p.substr(-1)!=="("&&p.trimRight().substr(-1)==="("&&(c=!1,b++,j()),B()):s.type!=="keyword.operator"&&s.type!=="keyword"||!d.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?s.type==="punctuation.operator"&&d===";"?(j(),H(),h=!0,M&&N++):s.type==="punctuation.operator"&&d.match(/^(:|,)$/)?(j(),H(),h=!0,l=!1):s.type==="support.php_tag"&&d==="?>"&&!l?(j(),c=!0):i(s,"attribute-name")&&p.substr(-1).match(/^\s$/)?c=!0:i(s,"attribute-equals")?(B(),H()):i(s,"tag-close")&&(B(),d==="/>"&&(c=!0)):(j(),H(),c=!0,h=!0);if(l&&(!s.type.match(/^(comment)$/)||!!d.substr(0,1).match(/^[/#]$/))&&(!s.type.match(/^(string)$/)||!!d.substr(0,1).match(/^['"]$/))){b=y;if(m>g){b++;for(L=m;L>g;L--)D[L]=b}else m<g&&(b=D[m]);g=m,y=b,w&&(b-=w),A&&!E&&(b++,A=!1);for(L=0;L<b;L++)p+=o}s.type==="keyword"&&d.match(/^(case|default)$/)&&(P[m]=d,m++),s.type==="keyword"&&d.match(/^(break)$/)&&P[m-1]&&P[m-1].match(/^(case|default)$/)&&m--,s.type==="paren.lparen"&&(E+=(d.match(/\(/g)||[]).length,m+=d.length),s.type==="keyword"&&d.match(/^(if|else|elseif|for|while)$/)?(A=!0,E=0):!E&&d.trim()&&s.type!=="comment"&&(A=!1);if(s.type==="paren.rparen"){E-=(d.match(/\)/g)||[]).length;for(L=0;L<d.length;L++)m--,d.substr(L,1)==="}"&&P[m]==="case"&&m--}c&&!l&&(B(),p.substr(-1)!=="\n"&&(p+=" ")),p+=d,h&&(p+=" "),l=!1,c=!1,h=!1;if(i(s,"tag-close")&&(_||a.indexOf(v)!==-1)||i(s,"doctype")&&d===">")_&&f&&f.value==="</"?N=-1:N=1;i(s,"tag-open")&&d==="</"?m--:i(s,"tag-open")&&d==="<"&&u.indexOf(f.value)===-1?m++:i(s,"tag-name")?v=d:i(s,"tag-close")&&d==="/>"&&u.indexOf(v)===-1&&m--,x=T}}s=f}p=p.trim(),e.doc.setValue(p)},t.commands=[{name:"beautify",exec:function(e){t.beautify(e.session)},bindKey:"Ctrl-Shift-B"}]}); (function() {
window.require(["ace/ext/beautify"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

8
static/cdnjs/ace/1.4.2/ext-elastic_tabstops_lite.js

@ -0,0 +1,8 @@
define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"],function(e,t,n){"use strict";var r=function(e){this.$editor=e;var t=this,n=[],r=!1;this.onAfterExec=function(){r=!1,t.processRows(n),n=[]},this.onExec=function(){r=!0},this.onChange=function(e){r&&(n.indexOf(e.start.row)==-1&&n.push(e.start.row),e.end.row!=e.start.row&&n.push(e.end.row))}};(function(){this.processRows=function(e){this.$inChange=!0;var t=[];for(var n=0,r=e.length;n<r;n++){var i=e[n];if(t.indexOf(i)>-1)continue;var s=this.$findCellWidthsForBlock(i),o=this.$setBlockCellWidthsToMax(s.cellWidths),u=s.firstRow;for(var a=0,f=o.length;a<f;a++){var l=o[a];t.push(u),this.$adjustRow(u,l),u++}}this.$inChange=!1},this.$findCellWidthsForBlock=function(e){var t=[],n,r=e;while(r>=0){n=this.$cellWidthsForRow(r);if(n.length==0)break;t.unshift(n),r--}var i=r+1;r=e;var s=this.$editor.session.getLength();while(r<s-1){r++,n=this.$cellWidthsForRow(r);if(n.length==0)break;t.push(n)}return{cellWidths:t,firstRow:i}},this.$cellWidthsForRow=function(e){var t=this.$selectionColumnsForRow(e),n=[-1].concat(this.$tabsForRow(e)),r=n.map(function(e){return 0}).slice(1),i=this.$editor.session.getLine(e);for(var s=0,o=n.length-1;s<o;s++){var u=n[s]+1,a=n[s+1],f=this.$rightmostSelectionInCell(t,a),l=i.substring(u,a);r[s]=Math.max(l.replace(/\s+$/g,"").length,f-u)}return r},this.$selectionColumnsForRow=function(e){var t=[],n=this.$editor.getCursorPosition();return this.$editor.session.getSelection().isEmpty()&&e==n.row&&t.push(n.column),t},this.$setBlockCellWidthsToMax=function(e){var t=!0,n,r,i,s=this.$izip_longest(e);for(var o=0,u=s.length;o<u;o++){var a=s[o];if(!a.push){console.error(a);continue}a.push(NaN);for(var f=0,l=a.length;f<l;f++){var c=a[f];t&&(n=f,i=0,t=!1);if(isNaN(c)){r=f;for(var h=n;h<r;h++)e[h][o]=i;t=!0}i=Math.max(i,c)}}return e},this.$rightmostSelectionInCell=function(e,t){var n=0;if(e.length){var r=[];for(var i=0,s=e.length;i<s;i++)e[i]<=t?r.push(i):r.push(0);n=Math.max.apply(Math,r)}return n},this.$tabsForRow=function(e){var t=[],n=this.$editor.session.getLine(e),r=/\t/g,i;while((i=r.exec(n))!=null)t.push(i.index);return t},this.$adjustRow=function(e,t){var n=this.$tabsForRow(e);if(n.length==0)return;var r=0,i=-1,s=this.$izip(t,n);for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];i+=1+a,f+=r;var l=i-f;if(l==0)continue;var c=this.$editor.session.getLine(e).substr(0,f),h=c.replace(/\s*$/g,""),p=c.length-h.length;l>0&&(this.$editor.session.getDocument().insertInLine({row:e,column:f+1},Array(l+1).join(" ")+" "),this.$editor.session.getDocument().removeInLine(e,f,f+1),r+=l),l<0&&p>=-l&&(this.$editor.session.getDocument().removeInLine(e,f+l,f),r+=l)}},this.$izip_longest=function(e){if(!e[0])return[];var t=e[0].length,n=e.length;for(var r=1;r<n;r++){var i=e[r].length;i>t&&(t=i)}var s=[];for(var o=0;o<t;o++){var u=[];for(var r=0;r<n;r++)e[r][o]===""?u.push(NaN):u.push(e[r][o]);s.push(u)}return s},this.$izip=function(e,t){var n=e.length>=t.length?t.length:e.length,r=[];for(var i=0;i<n;i++){var s=[e[i],t[i]];r.push(s)}return r}}).call(r.prototype),t.ElasticTabstopsLite=r;var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{useElasticTabstops:{set:function(e){e?(this.elasticTabstops||(this.elasticTabstops=new r(this)),this.commands.on("afterExec",this.elasticTabstops.onAfterExec),this.commands.on("exec",this.elasticTabstops.onExec),this.on("change",this.elasticTabstops.onChange)):this.elasticTabstops&&(this.commands.removeListener("afterExec",this.elasticTabstops.onAfterExec),this.commands.removeListener("exec",this.elasticTabstops.onExec),this.removeListener("change",this.elasticTabstops.onChange))}}})}); (function() {
window.require(["ace/ext/elastic_tabstops_lite"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

8
static/cdnjs/ace/1.4.2/ext-emmet.js

File diff suppressed because one or more lines are too long

8
static/cdnjs/ace/1.4.2/ext-error_marker.js

@ -0,0 +1,8 @@
; (function() {
window.require(["ace/ext/error_marker"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

8
static/cdnjs/ace/1.4.2/ext-keybinding_menu.js

@ -0,0 +1,8 @@
define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../../lib/dom"),i="#ace_settingsmenu, #kbshortcutmenu {background-color: #F7F7F7;color: black;box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);padding: 1em 0.5em 2em 1em;overflow: auto;position: absolute;margin: 0;bottom: 0;right: 0;top: 0;z-index: 9991;cursor: default;}.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);background-color: rgba(255, 255, 255, 0.6);color: black;}.ace_optionsMenuEntry:hover {background-color: rgba(100, 100, 100, 0.1);transition: all 0.3s}.ace_closeButton {background: rgba(245, 146, 146, 0.5);border: 1px solid #F48A8A;border-radius: 50%;padding: 7px;position: absolute;right: -8px;top: -8px;z-index: 100000;}.ace_closeButton{background: rgba(245, 146, 146, 0.9);}.ace_optionsMenuKey {color: darkslateblue;font-weight: bold;}.ace_optionsMenuCommand {color: darkcyan;font-weight: normal;}.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {vertical-align: middle;}.ace_optionsMenuEntry button[ace_selected_button=true] {background: #e7e7e7;box-shadow: 1px 0px 2px 0px #adadad inset;border-color: #adadad;}.ace_optionsMenuEntry button {background: white;border: 1px solid lightgray;margin: 0px;}.ace_optionsMenuEntry button:hover{background: #f0f0f0;}";r.importCssString(i),n.exports.overlayPage=function(t,n,i,s,o,u){function l(e){e.keyCode===27&&a.click()}i=i?"top: "+i+";":"",o=o?"bottom: "+o+";":"",s=s?"right: "+s+";":"",u=u?"left: "+u+";":"";var a=document.createElement("div"),f=document.createElement("div");a.style.cssText="margin: 0; padding: 0; position: fixed; top:0; bottom:0; left:0; right:0;z-index: 9990; background-color: rgba(0, 0, 0, 0.3);",a.addEventListener("click",function(){document.removeEventListener("keydown",l),a.parentNode.removeChild(a),t.focus(),a=null}),document.addEventListener("keydown",l),f.style.cssText=i+s+o+u,f.addEventListener("click",function(e){e.stopPropagation()});var c=r.createElement("div");c.style.position="relative";var h=r.createElement("div");h.className="ace_closeButton",h.addEventListener("click",function(){a.click()}),c.appendChild(h),f.appendChild(c),f.appendChild(n),a.appendChild(f),document.body.appendChild(a),t.blur()}}),define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../../lib/keys");n.exports.getEditorKeybordShortcuts=function(e){var t=r.KEY_MODS,n=[],i={};return e.keyBinding.$handlers.forEach(function(e){var t=e.commandKeyBinding;for(var r in t){var s=r.replace(/(^|-)\w/g,function(e){return e.toUpperCase()}),o=t[r];Array.isArray(o)||(o=[o]),o.forEach(function(e){typeof e!="string"&&(e=e.name),i[e]?i[e].key+="|"+s:(i[e]={key:s,command:e},n.push(i[e]))})}}),n}}),define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"],function(e,t,n){"use strict";function i(t){if(!document.getElementById("kbshortcutmenu")){var n=e("./menu_tools/overlay_page").overlayPage,r=e("./menu_tools/get_editor_keyboard_shortcuts").getEditorKeybordShortcuts,i=r(t),s=document.createElement("div"),o=i.reduce(function(e,t){return e+'<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'+t.command+"</span> : "+'<span class="ace_optionsMenuKey">'+t.key+"</span></div>"},"");s.id="kbshortcutmenu",s.innerHTML="<h1>Keyboard Shortcuts</h1>"+o+"</div>",n(t,s,"0","0","0",null)}}var r=e("ace/editor").Editor;n.exports.init=function(e){r.prototype.showKeyboardShortcuts=function(){i(this)},e.commands.addCommands([{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e,t){e.showKeyboardShortcuts()}}])}}); (function() {
window.require(["ace/ext/keybinding_menu"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

8
static/cdnjs/ace/1.4.2/ext-language_tools.js

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save