Giter Site home page Giter Site logo

Comments (4)

ikeq avatar ikeq commented on May 22, 2024

试一下这个 #30 (comment)

from hexo-theme-inside.

Directoree avatar Directoree commented on May 22, 2024

试一下这个 #30 (comment)

emmm...原答案的链接进不去了,密码验证的函数实在是不好找😭

from hexo-theme-inside.

ikeq avatar ikeq commented on May 22, 2024

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.

ikeq avatar ikeq commented on May 22, 2024

补充

修改 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 ghexo 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.