Comments (4)
试一下这个 #30 (comment)
from hexo-theme-inside.
试一下这个 #30 (comment)
emmm...原答案的链接进不去了,密码验证的函数实在是不好找😭
from hexo-theme-inside.
hexo-blog-encrypt/index.js#L94, 94, 95, 96 三行代码删掉,在 layout.ejs 的 <head>
里添加:
<%- css('css/blog-encrypt') %>
<%- js('lib/crypto-js') %>
<%- js('lib/blog-encrypt') %>
from hexo-theme-inside.
补充
修改 hexo-blog-encrypt
1.hexo-blog-encrypt/index.js#L94, line 94, 95, 96 删掉,新增一行代码(与主题的目录解析有冲突,所以禁用目录),修改一行代码:
data.content = data.template;
- data.content += `<script src="${hexo.config.root}lib/crypto-js.js"></script>`;
- data.content += `<script src="${hexo.config.root}lib/blog-encrypt.js"></script>`;
- data.content += `<link href="${hexo.config.root}css/blog-encrypt.css" rel="stylesheet" type="text/css">`;
+ delete data.toc;
data.more = data.abstract;
data.excerpt = data.more;
}
return data;
-});
+}, 11);
2.hexo-blog-encrypt/template.html#L1, line1 删掉
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
3.hexo-blog-encrypt/lib/blog-encrypt.js#L113 line113 以下代码按如下修改:
// Since you decided to use jQuery.
-$(document).ready(
- function () {
-
- console.log('Registering Enter for decrypt.');
- document.getElementById('pass').onkeypress = function (keyPressEvent) {
-
- if (keyPressEvent.keyCode === 13) {
-
- decryptAES();
-
- }
-
- };
-
- }
-);
+$(document).on('keypress', '#pass', function (keyPressEvent) {
+ if (keyPressEvent.keyCode === 13)
+ decryptAES();
+})
修改主题 layout/index.ejs
+<%- js("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js") %>
+<%- js("lib/crypto-js") %>
+<%- js("lib/blog-encrypt") %>
+<%- css("css/blog-encrypt") %>
</head>
最后
先执行 hexo clean
,再执行 hexo g
或 hexo s
;
如果还不行,打开 chrome 控制台,看下是不是有个 callback 什么鬼的报错了,hexo-blog-encrypt/lib/blog-encrypt.js#L33 删掉下面那行......
// Use jquery to load some js code
try {
$('#encrypt-blog').html(content);
- {callback}
} catch(e) {
from hexo-theme-inside.
Related Issues (20)
- 文章内图片使用markdown语法无法显示了(已安装hexo-renderer-marked) HOT 1
- 主题无法跟随系统自动切换
- Ability to use a page as root index? (non-blog homepage) HOT 2
- How to display code block? HOT 1
- how to add LineBreak to `bio` HOT 1
- iphone端加载博客图片异常 HOT 6
- Switch light/dark mode with system color mode
- 如何通过plugins支持giscus评论系统 HOT 3
- 主题配置中font服务似乎挂掉了 HOT 1
- Setup about page HOT 1
- How to add a picture/image of a post on the main dash page ? HOT 1
- Customize the css class for the thumbnail img
- Multiple categories of a post metadata will duplicate a repeated category tag
- 在post顶部加上更新时间和作者
- 在文章底部支持隐藏版权声明
- How to use Disqus autoload?
- How to set an avatar HOT 1
- 头像不显示了
- 一级标题如果直接连着三级标题,则不在目录中显示
- hexo deploy得到的index.html为空 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-theme-inside.