众所周知,在去年年底,知名的免费cdn服务提供商jsdelivr由于大陆域名备案的问题,没有国内的CDN加速了,目前都只能解析到海外,不但速度慢,还会偶发性无法连接到服务器。因此国内超多网站都受到了影响。现在cdn.jsdelivr.net被墙,国内打不开这导致大部分网站js与css失效,所以要把jsdelivr的js和css替换一下,我选择直接替换到本地。
下面放我改好的文件,替换主题的原文件即可。
执念二开joe主题链接: https://zhinianblog.com/archives/993/
只适用于执念二开Joe主题,官方原版暂未支持!
只适用于执念二开Joe主题,官方原版暂未支持!
只适用于执念二开Joe主题,官方原版暂未支持!
只适用于执念二开Joe主题,官方原版暂未支持!
只适用于执念二开Joe主题,官方原版暂未支持!
只适用于执念二开Joe主题,官方原版暂未支持!
把 joe/post.php
文件里的head标签替换为下列代码
<head>
<?php $this->need('public/include.php'); ?>
<?php if ($this->options->JPrismTheme) : ?>
<link rel="stylesheet" href="<?php $this->options->JPrismTheme() ?>">
<?php else : ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/prism.min.css'); ?>">
<?php endif; ?>
<script src="<?php $this->options->themeUrl('assets/js/clipboard.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/prism.min.js'); ?>"></script>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.post.min.css'); ?>">
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js'); ?>"></script>
</head>
把 joe/page.php
内的head标签修改为下列代码
<head>
<?php $this->need('public/include.php'); ?>
<?php if ($this->options->JPrismTheme) : ?>
<link rel="stylesheet" href="<?php $this->options->JPrismTheme() ?>">
<?php else : ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/prism.min.css'); ?>">
<?php endif; ?>
<script src="<?php $this->options->themeUrl('assets/js/clipboard.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/prism.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js'); ?>"></script>
</head>
把 joe/archive.php
内的head标签修改为下列代码
<head>
<?php $this->need('public/include.php'); ?>
<script src="<?php $this->options->themeUrl('assets/js/wow.min.js'); ?>"></script>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.archive.min.css'); ?>">
<script src="<?php $this->options->themeUrl('assets/js/joe.archive.min.js'); ?>"></script>
</head>
还有一个地方是代码高亮的调用,把 joe/functions.php
内的代码高亮的调用修改为下列代码(js已经放在文件里了,直接调用即可)
$JPrismTheme = new Typecho_Widget_Helper_Form_Element_Select(
'JPrismTheme',
array(
'/usr/themes/Joe/assets/css/prism.min.css' => 'prism(默认)',
'/usr/themes/Joe/assets/css/prism-dark.min.css' => 'prism-dark',
'/usr/themes/Joe/assets/css/prism-okaidia.min.css' => 'prism-okaidia',
'/usr/themes/Joe/assets/css/prism-solarizedlight.min.css' => 'prism-solarizedlight',
'/usr/themes/Joe/assets/css/prism-tomorrow.min.css' => 'prism-tomorrow',
'/usr/themes/Joe/assets/css/prism-twilight.min.css' => 'prism-twilight',
'/usr/themes/Joe/assets/css/prism-a11y-dark.min.css' => 'prism-a11y-dark',
'/usr/themes/Joe/assets/css/prism-atom-dark.min.css' => 'prism-atom-dark',
'/usr/themes/Joe/assets/css/prism-base16-ateliersulphurpool.light.min.css' => 'prism-base16-ateliersulphurpool.light',
'/usr/themes/Joe/assets/css/prism-cb.min.css' => 'prism-cb',
'/usr/themes/Joe/assets/css/prism-coldark-cold.min.css' => 'prism-coldark-cold',
'/usr/themes/Joe/assets/css/prism-coldark-dark.min.css' => 'prism-coldark-dark',
'/usr/themes/Joe/assets/css/prism-darcula.min.css' => 'prism-darcula',
'/usr/themes/Joe/assets/css/prism-dracula.min.css' => 'prism-dracula',
'/usr/themes/Joe/assets/css/prism-duotone-dark.min.css' => 'prism-duotone-dark',
'/usr/themes/Joe/assets/css/prism-duotone-earth.min.css' => 'prism-duotone-earth',
'/usr/themes/Joe/assets/css/prism-duotone-forest.min.css' => 'prism-duotone-forest',
'/usr/themes/Joe/assets/css/prism-duotone-light.min.css' => 'prism-duotone-light',
'/usr/themes/Joe/assets/css/prism-duotone-sea.min.css' => 'prism-duotone-sea',
'/usr/themes/Joe/assets/css/prism-duotone-space.min.css' => 'prism-duotone-space',
'/usr/themes/Joe/assets/css/prism-ghcolors.min.css' => 'prism-ghcolors',
'/usr/themes/Joe/assets/css/prism-gruvbox-dark.min.css' => 'prism-gruvbox-dark',
'/usr/themes/Joe/assets/css/prism-hopscotch.min.css' => 'prism-hopscotch',
'/usr/themes/Joe/assets/css/prism-lucario.min.css' => 'prism-lucario',
'/usr/themes/Joe/assets/css/prism-material-dark.min.css' => 'prism-material-dark',
'/usr/themes/Joe/assets/css/prism-material-light.min.css' => 'prism-material-light',
'/usr/themes/Joe/assets/css/prism-material-oceanic.min.css' => 'prism-material-oceanic',
'/usr/themes/Joe/assets/css/prism-night-owl.min.css' => 'prism-night-owl',
'/usr/themes/Joe/assets/css/prism-nord.min.css' => 'prism-nord',
'/usr/themes/Joe/assets/css/prism-pojoaque.min.css' => 'prism-pojoaque',
'/usr/themes/Joe/assets/css/prism-shades-of-purple.min.css' => 'prism-shades-of-purple',
'/usr/themes/Joe/assets/css/prism-synthwave84.min.css' => 'prism-synthwave84',
'/usr/themes/Joe/assets/css/prism-vs.min.css' => 'prism-vs',
'/usr/themes/Joe/assets/css/prism-vsc-dark-plus.min.css' => 'prism-vsc-dark-plus',
'/usr/themes/Joe/assets/css/prism-xonokai.min.css' => 'prism-xonokai',
'/usr/themes/Joe/assets/css/prism-onelight.min.css' => 'prism-onelight',
'/usr/themes/Joe/assets/css/prism-onedark.min.css' => 'prism-onedark',
'/usr/themes/Joe/assets/css/prism-onedark2.min.css' => 'prism-onedark2',
),
'//cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism.min.css',
'选择一款您喜欢的代码高亮样式',
'介绍:用于修改代码块的高亮风格 <br>
其他:如果您有其他样式,可通过源代码修改此项,引入您的自定义样式链接'
);
$JPrismTheme->setAttribute('class', 'joe_content joe_post');
$form->addInput($JPrismTheme->multiMode());
这里的Joe是我的主题目录,如果你的不是就改成你的目录名。
写的比较匆忙,先备份主题再测试,有问题及时反馈。
2022/5/19:
再次说明,需要修改的四个文件没放替换版文件是因为怕你们自己修改过,如果替换了,你们自己修改的东西会丢失,所以才手动修改代码。
有说替换文件不全的,确实不全,比如二次元动态模型的js引用没有替换,但影响使用的js、css一定是完整的。至于说我教程有问题的,麻烦确认下自己修改的文件对不对,主题目录名对不对,是吧,我也只是尽量的提供帮助,没必要网络暴力吧,为什么别人跟着我教程就没问题?是不是改考虑考虑自己的问题?
再次提醒:
做好备份!
做好备份!
最好备份!
- 最新
- 最热
只看作者