Repository: Lemonreds/hexo-theme-nayo
Branch: master
Commit: ed59e2950830
Files: 73
Total size: 97.5 KB
Directory structure:
gitextract_7jie21nk/
├── .babelrc
├── .gitignore
├── .postcssrc.js
├── README.md
├── _config.yml
├── languages/
│ ├── en.yml
│ ├── zh-CN.yml
│ └── zh-TW.yml
├── layout/
│ ├── _partial/
│ │ ├── _post/
│ │ │ ├── comment.ejs
│ │ │ ├── donate.ejs
│ │ │ ├── footer.ejs
│ │ │ ├── gallery.ejs
│ │ │ ├── header.ejs
│ │ │ ├── mathjax.ejs
│ │ │ ├── mob_share.ejs
│ │ │ └── toc.ejs
│ │ ├── after-footer.ejs
│ │ ├── article.ejs
│ │ ├── footer.ejs
│ │ ├── head.ejs
│ │ ├── header.ejs
│ │ ├── item.ejs
│ │ ├── page-name.ejs
│ │ ├── paginator.ejs
│ │ ├── search.ejs
│ │ └── slide-menu.ejs
│ ├── about.ejs
│ ├── archive.ejs
│ ├── category.ejs
│ ├── index.ejs
│ ├── layout.ejs
│ ├── post.ejs
│ └── tag.ejs
├── package.json
├── scripts/
│ ├── raw_length.js
│ └── render_img.js
├── source/
│ └── nayo.bundle.js
├── src/
│ ├── scripts/
│ │ ├── activeNav.js
│ │ ├── dom.js
│ │ ├── extends.js
│ │ ├── header.js
│ │ ├── lazyload.js
│ │ ├── main.js
│ │ ├── mask.js
│ │ ├── mobile.js
│ │ ├── scroll.js
│ │ ├── search.js
│ │ ├── totop.js
│ │ └── util.js
│ └── styles/
│ ├── base.scss
│ ├── code/
│ │ ├── hightlight.scss
│ │ └── theme.scss
│ ├── iconfont.scss
│ ├── mobile/
│ │ └── mobile.scss
│ ├── partial/
│ │ ├── archive.scss
│ │ ├── footer.scss
│ │ ├── header.scss
│ │ ├── index.scss
│ │ ├── item.scss
│ │ ├── page-name.scss
│ │ ├── paginator.scss
│ │ ├── post.scss
│ │ ├── search.scss
│ │ ├── tag.scss
│ │ └── toc.scss
│ ├── styles.scss
│ ├── three/
│ │ ├── hover.scss
│ │ └── valine.scss
│ └── utils/
│ ├── ani.scss
│ ├── reset.scss
│ ├── typo.scss
│ └── vars.scss
└── webpack.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": [
[
"env",
{
"targets": {
"browsers": ["last 2 versions"]
}
}
]
],
"plugins": ["transform-runtime"]
}
================================================
FILE: .gitignore
================================================
node_modules/
npm-debug.log
.vscode/
package-lock.json
.temp
================================================
FILE: .postcssrc.js
================================================
module.exports = {
plugins: {
"autoprefixer": {}
}
}
================================================
FILE: README.md
================================================
## hexo-theme-nayo
a concise theme for hexo[3.7.0].
在线预览 [preview](https://lemonreds.github.io/) | 常见问题 [common issues](https://lemonreds.github.io/2018/10/01/hexo-theme-nayo/)
## 效果图

## 安装说明
1. 从github上clone项目下来,放到目录 **yourhexoblog/themes/** 下。
```
$ git clone https://github.com/Lemonreds/hexo-theme-Nayo themes/nayo
```
或者直接download下来重名为nayo,并放到目录 **yourhexoblog/themes/** 下。
2.修改hexo的配置文件,**yourhexoblog/_config.yml** ,切换主题。
```
theme: Nayo
```
## 关于主题名字
主题名来自歌曲 <东京不太热> -封茗囧菌
## 修改主题
主题基于 hexoAPI、webpack4.0、Sass、Ejs 开发。
修改Ejs不需要安装依赖即可生效,修改js或css则需要webpack启动服务:
0. 启动hexo,本地预览主题的修改。
```
hexo s
```
1. 安装Node依赖
```
$ npm install
```
2. 运行开发环境
```
$ npm run dev
```
3. 生产环境打包
```
$ npm run build
```
================================================
FILE: _config.yml
================================================
# header navigation
# 导航菜单路径
# 默认不需要修改
menu:
home: /
archives: archives
tags: tags
about: about
search: search
# site title
# 网站的标题
title: Lemon
# author profile
# 图片放置于主题目录下: source/images/
# author为空时 Hexo/_config.yml 配置有效
profile:
author: Lemon
logo: /images/logo.png
avatar: /images/avatar.jpg
# site favicon
# 图片放置于主题目录下: source/images/
# 站点图标
favicon: /images/favicon.png
# social link
social:
Github: https://github.com/Lemonreds/hexo-theme-nayo
Weibo:
# Zhihu:
# Facebook:
Twitter:
instagram:
# LinkedIn:
Neteasemusic:
Telegram: /
# site analytics
# 站点访问统计
# 填入百度/谷歌的[ analytics id ]
baidu_analytics:
#636802045446222199ae541e32c8133e
google_analytics:
# comment
# 评论系统
# disqus(https://disqus.com/)
# 填入注册好的shortname即可
disqus:
comment: false
shortname: lemonreds
# 基于 valine(https://github.com/xCss/Valine)
# 创建 leancloud 应用 获取 id|key 填入即可
leancloud:
comment: true
app_id: cFM0eCo0CQ9xmBXmHi1eltol-gzGzoHsz
app_key: oh9tizsnvV2vNvWgqEvoNtQO
# 基于 mob(http://www.mob.com)
# 文章分享功能
mob_share:
true
# 文章分享链接
share_item:
- qq
- weixin
- weibo
#- douban
#- tumblr
#- facebook
#- twitter
#- google
# mathjax
# 渲染LateX公式
# 全局开启后,在你需要显示LateX公式的文章头部增加配置
# mathjax: true (参见下方说明)
mathjax:
enable: true
# 文章头部支持的配置有:
# example:
# ---
# title: hexo-theme-nayo
# date: 2018-02-08 21:44:25
#
# hide_toc: true | false
# hide_excerpt: true | false
# banner: /assets/05.jpg
# mathjax: true
# photos:
# - /assets/01.jpg
# - /assets/02.jpg
# - /assets/03.jpg
# - /assets/04.jpg
# ---
# 文章详情页面生效的配置
# hide_toc [boolean] 是否隐藏此文章的[TOC],默认为false
# hide_excerpt [boolean] 是否隐藏此[文章摘要](摘要只显示在首页,不显示在文章页),默认为false
# mathjax [boolean] 是否在此文章[渲染LateX公式]
# photos [array] 文章画廊展示图片
# footer
# 网站底部信息
footer:
author: Lemon
since: 2019
================================================
FILE: languages/en.yml
================================================
Menu:
home: Home
categories: Categories
tags: Tags
archives: Archives
about: About
search: Search
Page:
Archives: Archives
Categories: Categories
Tags: Tags
About: About
Post:
Donate: Donate
Share: Share
Prev: older
Next: newer
Archive:
count: "%d"
Paginator:
Prev: Prev
Next: Next
Contents: Contents
ReadMore: Continue
Untitled: Untitled
Search:
Sidebar_words: Search
input_words: Typing Something here.
================================================
FILE: languages/zh-CN.yml
================================================
Menu:
home: 首页
categories: 分类
tags: 标签
archives: 归档
about: 关于
search: 搜索
Page:
Archives: 归档
Categories: 分类
Tags: 标签
About: 关于
Post:
Donate: 赞赏
Share: 分享
Prev: older
Next: newer
Archive:
count: "%d"
Paginator:
Prev: 上一页
Next: 下一页
Contents: CONTENT
ReadMore: 阅读更多
Untitled: 无标题
Search:
Sidebar_words: 搜索
input_words: 输入你想搜索的
================================================
FILE: languages/zh-TW.yml
================================================
Menu:
home: 首頁
categories: 分類
tags: 標籤
archives: 歸檔
about: 關於
search: 搜索
Page:
Archives: 歸檔
Categories: 分類
Tags: 標籤
About: 關於
Post:
Donate: 讚賞
Share: 分享
Prev: older
Next: newer
Archive:
count: "%d"
Paginator:
Prev: 上一頁
Next: 下一頁
Contents: 目錄
ReadMore: 閱讀更多
Untitled: 無標題
Search:
Sidebar_words: 搜索
input_words: 输入你想搜索的
================================================
FILE: layout/_partial/_post/comment.ejs
================================================
<%# 评论%>
================================================
FILE: layout/_partial/_post/donate.ejs
================================================
<%= post.title || __('Untitled') %>
<% var date_format = config.date_format %>
<%= date(post.date, "MMM DD, YYYY") %>
<% if (post.banner){ %>
<% } %>
<% if (post.excerpt) { %>
<%- post.excerpt %>
<% } else { %>
<%- post.content %>
<%}%>
<% if( post.categories && post.categories.length) {%>
<% post.categories.sort('date',-1).each(function (cate){%>
<%- cate.name %>
<% })%>
<% }%>
<%if(post.tags && post.tags.length){%>
<% post.tags.sort('date',-1).each(function (tag){%>
<%- tag.name %>
<% })%>
<%}%>
================================================
FILE: layout/_partial/footer.ejs
================================================
<% var since = theme.footer.since %>
<% var year = date(new Date(), 'YYYY') %>
================================================
FILE: layout/_partial/head.ejs
================================================
<% if (is_post() || is_home()) { %>
<% } else{ %>
<% }%>
<%-body%>
<%- partial('_partial/search') %>
<%- partial('_partial/slide-menu') %>
<%- partial('_partial/after-footer') %>
<%- partial('_partial/footer') %>
<%- js('nayo.bundle')%>
================================================
FILE: layout/post.ejs
================================================
<%- partial('_partial/_post/header',{post: page}) %>
<%- partial('_partial/_post/mathjax',{post: page}) %>
<% if (page.banner){ %>
<% } else if (page.photos && page.photos.length){ %>
<%- partial('_partial/_post/gallery',{post:page}) %>
<%}%>
<% if (page.excerpt && page.hide_excerpt ){ %>
<%- page.more %>
<%} else{%>
<%- page.content %>
<%}%>
<%- partial('_partial/_post/footer',{post: page}) %>
<%- partial('_partial/_post/comment') %>
<%- partial('_partial/_post/toc',{post:page}) %>
================================================
FILE: layout/tag.ejs
================================================
<% var name = __('Page.Tags') %>
<% if( is_tag()){ %>
<%- partial('_partial/page-name',{icon:'icon-page-tags',name: page.tag }) %>
<% page.posts.each(function (post) { %>
<%- partial('_partial/item',{post: post}) %>
<% })%>
<%} else {%>
<%- partial('_partial/page-name',{icon:'icon-page-tags',name: name }) %>
<%}%>
================================================
FILE: package.json
================================================
{
"name": "hexo-theme-nayo",
"version": "0.4.0",
"description": "a concise theme for hexo.",
"scripts": {
"build": "webpack --config webpack.config.js --mode production",
"dev": "webpack --config webpack.config.js --watch --progress"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Lemonreds/hexo-theme-nayo.git"
},
"author": "lemonreds",
"license": "MIT",
"homepage": "https://github.com/Lemonreds/hexo-theme-nayo#readme",
"devDependencies": {
"autoprefixer": "^9.5.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"clean-webpack-plugin": "^2.0.1",
"css-loader": "^2.1.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^3.0.1",
"node-sass": "^4.11.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
}
}
================================================
FILE: scripts/raw_length.js
================================================
/**
*
* POST LENGTH
*
*/
hexo.extend.helper.register('raw_length', function (string) {
if( Object.prototype.toString.call(string) ==='[object String]'){
return string.replace(/<\/?[^>]*>/g, "").replace(/ /g, '').length
}else{
return 0
}
})
================================================
FILE: scripts/render_img.js
================================================
let cheerio = require('cheerio'),
loadedImage = 4,
placeHolder = '/images/placeholder.png';
/**
*
*
* LAZYLOAD
*
*/
function renderImg(source) {
let $ = cheerio.load(source, {
decodeEntities: false
}),
gallery = $('.gallery,.banner'),
img = $('img');
gallery.each((idx, element) => {
let origin = $(element).attr('data-origin')
if (origin && origin !== placeHolder) {
$(element).attr({
'data-src': origin
});
$(element).css('background-image', `url("${placeHolder}")`)
$(element).addClass('lazyload')
}
});
img.each((idx, element) => {
if (idx > loadedImage) {
let src = $(element).attr('src')
if (src && src !== placeHolder) {
$(element).attr({
'data-src': src,
'src': placeHolder
});
}
$(element).addClass('lazyload')
}
});
return $.html()
}
hexo.extend.filter.register('after_render:html', renderImg)
================================================
FILE: source/nayo.bundle.js
================================================
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e,n){var r=n(27)("wks"),o=n(28),i=n(2).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,e){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){"use strict";var r=i(n(60)),o=i(n(4));function i(t){return t&&t.__esModule?t:{default:t}}var u={query:function(t){if(!o.default.isStr(t))return(0,r.default)(null);var e=document.querySelectorAll(t);return 1===e.length?e[0]:e},addLoadEvent:function(t){var e=window.onload;"function"!=typeof window.onload?window.onload=t:window.onload=function(){e(),t()}},moveSmooth:function(t){var e=0;o.default.isNode(t)&&(e=t.offsetTop),window.scrollTo({top:e,behavior:"smooth"})}};t.exports=u},function(t,e,n){"use strict";t.exports={isMobile:function(){for(var t=navigator.userAgent,e=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"],n=0;n
0)return!0}return!1},isFunc:function(t){return"function"==typeof t},isStr:function(t){return"string"==typeof t},isNode:function(t){return t.nodeType===Node.ELEMENT_NODE},isArray:function(t){return Array.isArray(t)},filterHTML:function(t){return t=(t=(t=t.replace(/<\/?[^>]*>/g,"")).replace(/[|]*\n/,"")).replace(/&npsp;/gi,"")}}},function(t,e){t.exports={}},function(t,e,n){var r=n(7),o=n(15);t.exports=n(9)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(8),o=n(46),i=n(47),u=Object.defineProperty;e.f=n(9)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(14);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(23)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(2),o=n(1),i=n(22),u=n(6),a=n(11),s=function(t,e,n){var c,f,l,d=t&s.F,p=t&s.G,v=t&s.S,h=t&s.P,y=t&s.B,m=t&s.W,g=p?o:o[e]||(o[e]={}),b=g.prototype,x=p?r:v?r[e]:(r[e]||{}).prototype;for(c in p&&(n=e),n)(f=!d&&x&&void 0!==x[c])&&a(g,c)||(l=f?x[c]:n[c],g[c]=p&&"function"!=typeof x[c]?n[c]:y&&f?i(l,r):m&&x[c]==l?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):h&&"function"==typeof l?i(Function.call,l):l,h&&((g.virtual||(g.virtual={}))[c]=l,t&s.R&&b&&!b[c]&&u(b,c,l)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(44),o=n(13);t.exports=function(t){return r(o(t))}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(27)("keys"),o=n(28);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){t.exports={default:n(39),__esModule:!0}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){"use strict";var r=n(21),o=n(10),i=n(48),u=n(6),a=n(5),s=n(49),c=n(30),f=n(56),l=n(0)("iterator"),d=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,e,n,v,h,y,m){s(n,e,v);var g,b,x,w=function(t){if(!d&&t in S)return S[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},_=e+" Iterator",C="values"==h,L=!1,S=t.prototype,M=S[l]||S["@@iterator"]||h&&S[h],O=M||w(h),E=h?C?w("entries"):O:void 0,T="Array"==e&&S.entries||M;if(T&&(x=f(T.call(new t)))!==Object.prototype&&x.next&&(c(x,_,!0),r||"function"==typeof x[l]||u(x,l,p)),C&&M&&"values"!==M.name&&(L=!0,O=function(){return M.call(this)}),r&&!m||!d&&!L&&S[l]||u(S,l,O),a[e]=O,a[_]=p,h)if(g={values:C?O:w("values"),keys:y?O:w("keys"),entries:E},m)for(b in g)b in S||i(S,b,g[b]);else o(o.P+o.F*(d||L),e,g);return g}},function(t,e){t.exports=!0},function(t,e,n){var r=n(45);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(14),o=n(2).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(8),o=n(50),i=n(29),u=n(17)("IE_PROTO"),a=function(){},s=function(){var t,e=n(24)("iframe"),r=i.length;for(e.style.display="none",n(55).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("