Skip to content

Commit

Permalink
✨ 增加主题代码高亮开关 #254
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed May 11, 2023
1 parent 36c2f14 commit 7959120
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
13 changes: 10 additions & 3 deletions assets/dist/js/libs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/js/puock.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions assets/dist/style/libs.min.css

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion assets/js/puock.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Puock {
async_view_id: null,
mode_switch: false,
async_view_generate_time: null,
off_img_viewer:false
off_img_viewer:false,
off_code_highlighting:false
},
comment: {
loading: false,
Expand Down Expand Up @@ -585,6 +586,9 @@ class Puock {
}

initCodeHighlight(fullChange = true) {
if(this.data.params.off_code_highlighting){
return
}
if (window.hljs !== undefined) {
window.hljs.configure({ignoreUnescapedHTML: true})
document.querySelectorAll('pre').forEach((block, index) => {
Expand Down
1 change: 1 addition & 0 deletions inc/metas.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function pk_metas_get_async_view_id()
'async_view_id' => pk_metas_get_async_view_id(),
'mode_switch' => pk_is_checked('theme_mode_s'),
'off_img_viewer'=>pk_is_checked('off_img_viewer'),
'off_code_highlighting'=>pk_is_checked('off_code_highlighting'),
];
if($headMetas['async_view_id']){
$headMetas['async_view_generate_time'] = time();
Expand Down
12 changes: 9 additions & 3 deletions inc/setting/options/OptionBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@ function get_fields(): array
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'basic_img_lazy_a',
'label' => __('留言头像懒加载', PUOCK),
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'off_img_viewer',
'label' => __('禁用正文图片灯箱预览', PUOCK),
'type' => 'switch',
'sdt' => false,
],
[
'id' => 'basic_img_lazy_a',
'label' => __('留言头像懒加载', PUOCK),
'id' => 'off_code_highlighting',
'label' => __('禁用主题代码高亮', PUOCK),
'type' => 'switch',
'sdt' => 'false',
'sdt' => false,
],
[
'id' => 'post_content_indent',
Expand Down

0 comments on commit 7959120

Please sign in to comment.