Skip to content

Commit

Permalink
refactor: replace shjs with hljs (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
renbaoshuo committed Jun 20, 2024
1 parent d2c9aca commit d4cebd9
Show file tree
Hide file tree
Showing 54 changed files with 687 additions and 56 deletions.
2 changes: 1 addition & 1 deletion web/app/controllers/faq.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
requireLib('shjs');
requireLib('hljs');
requireLib('mathjax');
echoUOJPageHeader(UOJLocale::get('help'))
?>
Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/hack.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}
?>
<?php
$REQUIRE_LIB['shjs'] = "";
$REQUIRE_LIB['hljs'] = "";
?>
<?php echoUOJPageHeader(UOJLocale::get('problems::hack').' #'.$hack['id']) ?>

Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function(response_text) {custom_test_onsubmit(response_text, $('#div-custom_test
?>
<?php
$REQUIRE_LIB['mathjax'] = '';
$REQUIRE_LIB['shjs'] = '';
$REQUIRE_LIB['hljs'] = '';
?>
<?php echoUOJPageHeader(HTML::stripTags($problem['title']) . ' - ' . UOJLocale::get('problems::problem')) ?>
<?php
Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/subdomain/blog/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$all_tags = DB::selectAll("select distinct tag from blogs_tags where blog_id in (select id from blogs where $blogs_cond)");

requireLib('mathjax');
requireLib('shjs');
requireLib('hljs');
?>
<?php echoUOJPageHeader('日志') ?>

Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/subdomain/blog/blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function($comment) {
?>
<?php
$REQUIRE_LIB['mathjax'] = '';
$REQUIRE_LIB['shjs'] = '';
$REQUIRE_LIB['hljs'] = '';
?>
<?php echoUOJPageHeader(HTML::stripTags($blog['title']) . ' - 博客') ?>
<?php echoBlog($blog, array('show_title_only' => isset($_GET['page']) && $_GET['page'] != 1)) ?>
Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/subdomain/blog/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
?>
<?php
$REQUIRE_LIB['mathjax'] = '';
$REQUIRE_LIB['shjs'] = '';
$REQUIRE_LIB['hljs'] = '';
?>
<?php echoUOJPageHeader(UOJContext::user()['username'] . '的博客') ?>

Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
}
?>
<?php
$REQUIRE_LIB['shjs'] = "";
$REQUIRE_LIB['hljs'] = "";
?>
<?php echoUOJPageHeader(UOJLocale::get('problems::submission').' #'.$submission['id']) ?>
<?php echoSubmissionsListOnlyOne($submission, array(), $myUser) ?>
Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/super_manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function ($x, &$vdata) {
}
?>
<?php
requireLib('shjs');
requireLib('hljs');
requireLib('morris');
?>
<?php echoUOJPageHeader('系统管理') ?>
Expand Down
2 changes: 1 addition & 1 deletion web/app/models/UOJBlogEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function handleSave() {
if (isset($_POST['need_preview'])) {
ob_start();
if ($this->type == 'blog') {
echoUOJPageHeader('博客预览', array('ShowPageHeader' => false, 'REQUIRE_LIB' => array('mathjax' => '', 'shjs' => '')));
echoUOJPageHeader('博客预览', array('ShowPageHeader' => false, 'REQUIRE_LIB' => array('mathjax' => '', 'hljs' => '')));
echo '<article>';
echo $this->post_data['content'];
echo '</article>';
Expand Down
10 changes: 5 additions & 5 deletions web/app/views/page-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@
<?= HTML::js_src('/js/raphael.min.js') ?>
<?php endif ?>

<?php if (isset($REQUIRE_LIB['shjs'])): ?>
<!-- shjs -->
<?= HTML::css_link('/css/sh_typical.min.css') ?>
<?= HTML::js_src('/js/sh_main.min.js') ?>
<script type="text/javascript">$(document).ready(function(){sh_highlightDocument()})</script>
<?php if (isset($REQUIRE_LIB['hljs'])): ?>
<!-- hljs -->
<?= HTML::css_link('/css/highlight_github.css') ?>
<?= HTML::js_src('/js/highlight.min.js') ?>
<script type="text/javascript">$(document).ready(function(){hljs.highlightAll()})</script>
<?php endif ?>

<?php if (isset($REQUIRE_LIB['ckeditor'])): ?>
Expand Down
10 changes: 10 additions & 0 deletions web/css/highlight_github.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion web/css/sh_typical.min.css

This file was deleted.

Loading

0 comments on commit d4cebd9

Please sign in to comment.