Contents

Blog Theme Update

Contents

Go to the link first! {% iframe “/assets/github-btn.html?user=ttimasdf&repo=tranquilpeak-hexo-theme&type=star&count=true” 170 20 %}

Compared with the original theme, the main functions added:

  • Fully asynchronous loading (web pages, search pages, comment areas)
  • local search

The first time I wrote JS, I was so nervous. 🙈 I also forgot where I saw Instantclick, and I fell into the pit in an instant and added it to my own website. 😆

The first time I forked this theme, the original theme was version 1.4.0 (see repo local-search branch), the part written by myself is very dirty and full of bugs, whether it can be used is completely random! And because Swiftype can’t be used (because it can’t be loaded asynchronously, and the button event is overwritten by instantclick, it can’t be used at all), I picked up a search js from the theme of wzpan (it’s pretty easy to use), and the original author can’t say I’m too The garbage is too embarrassing to close (take a look, I will give you one more function, take a look), so I silently closed the PR…

This time I made up my mind to start over again, export the patch, fork the latest version, and insert it from the beginning… In other words, there are very few tools needed to write the front-end (only a little bit of node has been written, a little bit of work)

  • npm node package management, used to install the following two things
  • bower web package management, install jquery instantclick anything
  • grunt is equivalent to makefile, compiling, linking, confusing scss, ejs
  • Any editor + linter

You can start coding!

I think There are a lot of codes in this theme (I haven’t written JS yet), everyone says that the JS language can make the code ugly if you are not careful. I look back at the code I wrote for the first time… …Rotten like a pile of shit (。-_-。) If you want to look up, they are still in the branch of local_search. If you don’t want to cut your own meat, it’s better not to delete it🙈

And Javascript is really an object-oriented language because – there’s nothing but objects. The javascript object is as simple as a dict in python, to its prototype Declare a class method in it, it can be a father; add parentheses to a member, it is a function (but there is no python @property comes gracefully). If you want a function to have a name, you can choose it, if you don’t want it, you can assign it to whoever you want, and you can know the name if you want anyone to know it—the context can be changed when the function is called, and you don’t tell it.** It doesn't even know who it is and where it is **!

The worst thing is that you think that after you write the code, anyone should be able to use it, but browsers don’t think so. Each browser supports different functions of JS (ECMAScript, to be precise) Accurate to the granularity of different functions !

Anyway, after finishing this wave, I don’t want to write any more.