Browse Source

Add option to use local lib and fonts or specify cdn provider

pull/6/head
Menci 6 years ago
parent
commit
d39c9763e1
  1. 4
      config-example.json
  2. 2
      views/admin_raw.ejs
  3. 4
      views/footer.ejs
  4. 2
      views/forget_confirm.ejs
  5. 23
      views/header.ejs
  6. 2
      views/login.ejs
  7. 2
      views/problem.ejs
  8. 2
      views/sign_up.ejs
  9. 4
      views/statistics.ejs
  10. 8
      views/submission.ejs
  11. 6
      views/submissions.ejs
  12. 2
      views/user_edit.ejs
  13. 8
      views/util.ejs

4
config-example.json

@ -112,5 +112,7 @@
"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",
"cdnjs_url": "https://cdnjs.loli.net/ajax/libs",
"google_fonts_url": "https://fonts.loli.net"
} }

2
views/admin_raw.ejs

@ -5,7 +5,7 @@
<div id="editor" style="border: 1px solid #D4D4D5; height: 500px; margin-bottom: 20px; "><%= data %></div> <div id="editor" style="border: 1px solid #D4D4D5; height: 500px; margin-bottom: 20px; "><%= data %></div>
<input type="hidden" name="data"> <input type="hidden" name="data">
<script src="https://cdnjs.loli.net/ajax/libs/ace/1.4.1/ace.js"></script> <script src="<%- lib('ace/1.4.2/ace.js') %>"></script>
<script type="text/javascript"> <script type="text/javascript">
var editor = ace.edit("editor"); var editor = ace.edit("editor");

4
views/footer.ejs

@ -5,8 +5,8 @@
</div> </div>
</div> </div>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script> <script src="<%- lib('semantic-ui/2.4.1/semantic.min.js') %>"></script>
<script src="https://cdnjs.loli.net/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script> <script src="<%- lib('Chart.js/2.7.3/Chart.bundle.min.js') %>"></script>
<script src="/script.js?20170710"></script> <script src="/script.js?20170710"></script>
</body> </body>
</html> </html>

2
views/forget_confirm.ejs

@ -32,7 +32,7 @@
</div> </div>
</div> </div>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js"></script> <script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script>
<script type="text/javascript"> <script type="text/javascript">
function showMessage(mclass, content) { function showMessage(mclass, content) {
$("#msgBox").addClass(mclass); $("#msgBox").addClass(mclass);

23
views/header.ejs

@ -6,17 +6,24 @@
<meta content="IE=edge" http-equiv="X-UA-Compatible"> <meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=1200"> <meta name="viewport" content="width=1200">
<title><%= title %> - <%= syzoj.config.title %></title> <title><%= title %> - <%= syzoj.config.title %></title>
<link href="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet"> <link href="<%- lib('semantic-ui/2.4.1/semantic.min.css') %>" rel="stylesheet">
<link href="/tomorrow.css" rel="stylesheet"> <link href="/tomorrow.css" rel="stylesheet">
<link href="/mathjax.css?20181105" rel="stylesheet"> <link href="/mathjax.css?20181105" rel="stylesheet">
<link href="https://cdnjs.loli.net/ajax/libs/KaTeX/0.10.0/katex.min.css" rel="stylesheet"> <link href="<%- lib('KaTeX/0.10.0/katex.min.css') %>" rel="stylesheet">
<link href="https://cdnjs.loli.net/ajax/libs/morris.js/0.5.1/morris.css" rel="stylesheet"> <link href="<%- lib('morris.js/0.5.1/morris.css') %>" rel="stylesheet">
<link href="/style.css?20181212" rel="stylesheet"> <link href="/style.css?20181212" rel="stylesheet">
<link href="https://fonts.loli.net/css?family=Fira+Mono" rel="stylesheet"> <% if (!syzoj.config.google_fonts_url) { %>
<link href="https://fonts.loli.net/css?family=Lato:400,700,400italic,700italic&subset=latin" rel="stylesheet"> <link href="<%- syzoj.utils.makeUrl(['google-fonts', 'fira-mono.css']) %>" rel="stylesheet">
<link href="https://fonts.loli.net/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&amp;subset=latin-ext" rel="stylesheet"> <link href="<%- syzoj.utils.makeUrl(['google-fonts', 'lato.css']) %>" rel="stylesheet">
<link href="https://fonts.loli.net/css?family=Exo+2:600" rel="stylesheet"> <link href="<%- syzoj.utils.makeUrl(['google-fonts', 'open-sans.css']) %>" rel="stylesheet">
<script src="https://cdnjs.loli.net/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <link href="<%- syzoj.utils.makeUrl(['google-fonts', 'exo-2.css']) %>" rel="stylesheet">
<% } else { %>
<link href="<%- syzoj.config.google_fonts_url %>/css?family=Fira+Mono" rel="stylesheet">
<link href="<%- syzoj.config.google_fonts_url %>/css?family=Lato:400,700,400italic,700italic&subset=latin" rel="stylesheet">
<link href="<%- syzoj.config.google_fonts_url %>/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&amp;subset=latin-ext" rel="stylesheet">
<link href="<%- syzoj.config.google_fonts_url %>/css?family=Exo+2:600" rel="stylesheet">
<% } %>
<script src="<%- lib('jquery/3.3.1/jquery.min.js') %>"></script>
<% if (syzoj.config.google_analytics && syzoj.config.google_analytics !== 'UA-XXXXXXXX-X') { %> <% if (syzoj.config.google_analytics && syzoj.config.google_analytics !== 'UA-XXXXXXXX-X') { %>
<script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

2
views/login.ejs

@ -38,7 +38,7 @@
</div> </div>
</div> </div>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js"></script> <script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script>
<script type="text/javascript"> <script type="text/javascript">
function key_login(event) { function key_login(event) {
if (event.keyCode == 13) { if (event.keyCode == 13) {

2
views/problem.ejs

@ -23,7 +23,7 @@ div[class*=ace_br] {
border-radius: 0 !important; border-radius: 0 !important;
} }
</style> </style>
<script src="https://cdnjs.loli.net/ajax/libs/ace/1.4.1/ace.js"></script> <script src="<%- lib('ace/1.4.2/ace.js') %>"></script>
<div class="ui center aligned grid"> <div class="ui center aligned grid">
<div class="row"> <div class="row">
<h1 class="ui header"> <h1 class="ui header">

2
views/sign_up.ejs

@ -28,7 +28,7 @@
<a id="sign_up" class="ui button" href="javascript:submit();">注册</a> <a id="sign_up" class="ui button" href="javascript:submit();">注册</a>
</form> </form>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js"></script> <script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script>
<script type="text/javascript"> <script type="text/javascript">
function show_error(error) { function show_error(error) {
$("#error_info").text(error); $("#error_info").text(error);

4
views/statistics.ejs

@ -11,8 +11,8 @@ let types = {
}; };
%> %>
<% include header %> <% include header %>
<script src="https://cdnjs.loli.net/ajax/libs/raphael/2.2.7/raphael.min.js"></script> <script src="<%- lib('raphael/2.2.7/raphael.min.js') %>"></script>
<script src="https://cdnjs.loli.net/ajax/libs/morris.js/0.5.1/morris.min.js"></script> <script src="<%- lib('morris.js/0.5.1/morris.min.js') %>"></script>
<script> <script>
function getColorOfScore(score) { function getColorOfScore(score) {
var color = []; var color = [];

8
views/submission.ejs

@ -1,7 +1,7 @@
<% this.title = '提交记录 #' + info.submissionId %> <% this.title = '提交记录 #' + info.submissionId %>
<% include util %> <% include util %>
<% include header %> <% include header %>
<script src="https://cdnjs.loli.net/ajax/libs/textfit/2.3.1/textFit.min.js"></script> <script src="<%- lib('textfit/2.3.1/textFit.min.js') %>"></script>
<style> <style>
.single-subtask { .single-subtask {
box-shadow: none !important; box-shadow: none !important;
@ -124,9 +124,9 @@
</template> </template>
</div> </div>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/vue/2.5.17/vue.min.js"></script> <script src="<%- lib('vue/2.5.21/vue.min.js') %>"></script>
<script src="https://cdnjs.loli.net/ajax/libs/socket.io/2.2.0/socket.io.js"></script> <script src="<%- lib('socket.io/2.2.0/socket.io.js') %>"></script>
<script src="https://cdnjs.loli.net/ajax/libs/jsondiffpatch/0.2.5/jsondiffpatch.min.js"></script> <script src="<%- lib('jsondiffpatch/0.2.5/jsondiffpatch.min.js') %>"></script>
<% include submissions_item %> <% include submissions_item %>

6
views/submissions.ejs

@ -1,7 +1,7 @@
<% this.title = '提交记录' %> <% this.title = '提交记录' %>
<% include header %> <% include header %>
<% include util %> <% include util %>
<script src="https://cdnjs.loli.net/ajax/libs/textfit/2.3.1/textFit.min.js"></script> <script src="<%- lib('textfit/2.3.1/textFit.min.js') %>"></script>
<div class="padding"> <div class="padding">
<% if (displayConfig.inContest) { %> <% if (displayConfig.inContest) { %>
<div class="ui large info message"> <div class="ui large info message">
@ -120,8 +120,8 @@
<% } %> <% } %>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/vue/2.4.2/vue.min.js"></script> <script src="<%- lib('vue/2.5.21/vue.min.js') %>"></script>
<script src="https://cdnjs.loli.net/ajax/libs/socket.io/2.0.3/socket.io.js"></script> <script src="<%- lib('socket.io/2.2.0/socket.io.js') %>"></script>
<% include submissions_item %> <% include submissions_item %>
<script> <script>

2
views/user_edit.ejs

@ -84,7 +84,7 @@
</form> </form>
</div> </div>
</div> </div>
<script src="https://cdnjs.loli.net/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js"></script> <script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script>
<script type="text/javascript"> <script type="text/javascript">
function make_md5(tag) { function make_md5(tag) {
if (tag.val()) { if (tag.val()) {

8
views/util.ejs

@ -66,4 +66,12 @@ this.iconHidden = [
'Skipped' 'Skipped'
]; ];
this.lib = uri => {
if (!syzoj.config.cdnjs_url) {
return syzoj.utils.makeUrl(['cdnjs', uri]);
} else {
return syzoj.config.cdnjs_url + '/' + uri;
}
}
%> %>

Loading…
Cancel
Save