hexo-theme-next
Advanced tools
Comparing version 7.7.1 to 7.7.2
@@ -48,4 +48,6 @@ <div align="right"> | ||
* Switch to another theme and check if the bug still exists (e.g. default theme landscape). In other words, prove that this is a NexT issue, not a issue from Hexo. | ||
* Upgrade theme NexT to the latest version. | ||
* Upgrade Hexo and Hexo plugins to the latest version. | ||
* Uninstall all non-essential Hexo plugins. | ||
* Upgrade Node.js and `npm` to the latest version. | ||
* Uninstall all non-essential Hexo plugins, or reinstall all plugins using `npm install --save`. | ||
@@ -52,0 +54,0 @@ If you get an error message from Hexo or your browser, please search in Google / Stackoverflow / GitHub Issues, or report it to us when submitting a new Issue. |
@@ -6,3 +6,3 @@ <!-- ATTENTION! | ||
3. In addition, you need to confirm that the changes made by this PR are compatible with PJAX. | ||
3. In addition, you need to confirm that the changes made by this PR are compatible with PJAX and Dark Mode. | ||
@@ -16,3 +16,2 @@ 4. We use ESLint and Stylint for identifying and reporting on patterns in JavaScript and Stylus. Please execute the following commands: | ||
``` | ||
And make sure that this PR does not cause more warning messages. | ||
@@ -39,4 +38,3 @@ 5. Please check if your PR fulfills the following requirements. | ||
- [ ] Refactoring (no functional changes, no api changes). | ||
- [ ] Build related changes. | ||
- [ ] CI related changes. | ||
- [ ] Build & CI related changes. | ||
- [ ] Documentation content changes. | ||
@@ -61,5 +59,1 @@ - [ ] Other... Please describe: | ||
``` | ||
## Does this PR introduce a breaking change? | ||
- [ ] Yes. | ||
- [ ] No. |
@@ -9,20 +9,8 @@ <h1 align="center">Algolia Search</h1> | ||
![](http://theme-next.iissnan.com/uploads/algolia/algolia-step-2.png) | ||
![](https://user-images.githubusercontent.com/16272760/73673892-68a29b00-46ea-11ea-90c5-916b4b11fc7a.png) | ||
1. Algolia requires users to upload their search index data either manually or via provided APIs. Install and configure [Hexo Algolia](https://github.com/oncletom/hexo-algolia) in your Hexo directory. This plugin will index your site and upload selected data to Algolia. | ||
``` | ||
$ cd hexo | ||
$ npm install hexo-algolia | ||
``` | ||
1. Go to the `API Keys` page and find your credentials. You will need the `Application ID` and the `Search-only API key` in the following sections. The `Admin API key` need to keep confidential. Never store your Admin API Key as apiKey in the` _config.yml` file: it would give full control of your Algolia index to others and you don't want to face the consequences. | ||
![](https://user-images.githubusercontent.com/8521181/35479066-64e35aec-0428-11e8-91f9-1ec3afa45c5c.png) | ||
![](https://user-images.githubusercontent.com/16272760/73673895-693b3180-46ea-11ea-8f50-8bae850b50d0.png) | ||
1. In the `API Keys` page, click the `ALL API KEYS` and the `edit` option in the created APIKEY to activate a pop-up box where you can setup authorizations and restrictions with a great level of precision. Check `Add records`, `Delete records`, `List indices`, `Delete index` features in ACL permissions that will be allowed for the given API key. And then click the `Update` button. | ||
![](https://user-images.githubusercontent.com/8521181/35479064-611aa0b4-0428-11e8-85a1-cfb449b486ec.png) | ||
![](https://user-images.githubusercontent.com/8521181/35479084-d4f7ac02-0428-11e8-95a6-c4e3b1bef47b.png) | ||
1. In your site's `_config.yml`, add the following configuration and replace the `applicationID` & `apiKey` & `indexName` with corresponding fields obtained at Algolia. | ||
@@ -38,7 +26,19 @@ | ||
1. In the `API Keys` page, click the `All API Keys` button to switch to the corresponding tab. Then click the `New API Key` button to activate a pop-up box where you can setup authorizations and restrictions with a great level of precision. Enter `addObject`, `deleteObject`, `listIndexes`, `deleteIndex` features in ACL permissions that will be allowed for the given API key. And then click the `Create` button. Copy this newly created key to the clipboard, we call it a `High-privilege API key`. | ||
![](https://user-images.githubusercontent.com/16272760/73673902-6b04f500-46ea-11ea-9c80-4e5c5002e07b.png) | ||
![](https://user-images.githubusercontent.com/16272760/73673905-6b9d8b80-46ea-11ea-9e01-702ec2a8a297.png) | ||
1. Algolia requires users to upload their search index data either manually or via provided APIs. Install and configure [Hexo Algolia](https://github.com/oncletom/hexo-algolia) in your Hexo directory. This plugin will index your site and upload selected data to Algolia. | ||
``` | ||
$ cd hexo | ||
$ npm install hexo-algolia | ||
``` | ||
1. Run the following command to upload index data, keep a weather eye out the output of the command. | ||
``` | ||
$ export HEXO_ALGOLIA_INDEXING_KEY=Search-Only API key # Use Git Bash | ||
# set HEXO_ALGOLIA_INDEXING_KEY=Search-Only API key # Use Windows command line | ||
$ export HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # Use Git Bash | ||
# set HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # Use Windows command line | ||
$ hexo clean | ||
@@ -70,6 +70,7 @@ $ hexo algolia | ||
... | ||
# Internal version: 1 | ||
# https://www.algolia.com | ||
algolia_instant_js: https://cdn.jsdelivr.net/npm/instantsearch.js@2.4.1/dist/instantsearch.js | ||
algolia_instant_css: https://cdn.jsdelivr.net/npm/instantsearch.js@2.4.1/dist/instantsearch.min.css | ||
# Algolia Search | ||
# algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js | ||
# instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js | ||
algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js | ||
instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js | ||
... | ||
@@ -76,0 +77,0 @@ ``` |
@@ -15,5 +15,5 @@ <h1 align="center">Math Equations</h1> | ||
If you use MathJax to render Math Equations, you need to use **only one of them**: [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) or [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed). | ||
If you use MathJax to render Math Equations, you need to use one of them: [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) or [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed) (Not recommended) as the renderer for Markdown. | ||
Firstly, you need to uninstall the original renderer `hexo-renderer-marked`, and install one of the renderer above: | ||
Firstly, you need to uninstall the original renderer `hexo-renderer-marked`, and install **one of the renderer above**: | ||
@@ -50,5 +50,5 @@ ```sh | ||
```latex | ||
$$\begin{equation} | ||
$$\begin{equation}\label{eq1} | ||
e=mc^2 | ||
\end{equation}\label{eq1}$$ | ||
\end{equation}$$ | ||
``` | ||
@@ -65,3 +65,3 @@ | ||
```latex | ||
$$\begin{equation} | ||
$$\begin{equation}\label{eq2} | ||
\begin{aligned} | ||
@@ -72,3 +72,3 @@ a &= b + c \\ | ||
\end{aligned} | ||
\end{equation}\label{eq2}$$ | ||
\end{equation}$$ | ||
``` | ||
@@ -102,3 +102,3 @@ | ||
For more information, you can visit the [official MathJax documentation on equation numbering](http://docs.mathjax.org/en/latest/tex.html#automatic-equation-numbering). You can also visit this [post](https://jdhao.github.io/2018/01/25/hexo-mathjax-equation-number/) for more details. | ||
For more information, you can visit the [official MathJax documentation on equation numbering](https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html). You can also visit this [post](https://theme-next.org/docs/third-party-services/math-equations) for more details. | ||
@@ -105,0 +105,0 @@ ### Katex |
@@ -14,3 +14,3 @@ <div align="right"> | ||
<br> | ||
<a href="https://github.com/theme-next/hexo-theme-next/releases"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a> | ||
<a href="https://www.npmjs.com/package/hexo-theme-next"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a> | ||
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E=10.9.0-green?style=flat-square"></a> | ||
@@ -17,0 +17,0 @@ <a href="https://hexo.io"><img src="https://img.shields.io/badge/hexo-%3E=3.5.0-blue?style=flat-square&logo=hexo"></a> |
@@ -7,20 +7,8 @@ <h1 align="center">Algolia 搜索</h1> | ||
![](http://theme-next.iissnan.com/uploads/algolia/algolia-step-2.png) | ||
![](https://user-images.githubusercontent.com/16272760/73673892-68a29b00-46ea-11ea-90c5-916b4b11fc7a.png) | ||
1. Index 创建完成后,此时这个 Index 里未包含任何数据。接下来需要安装 [Hexo Algolia](https://github.com/oncletom/hexo-algolia) 扩展,这个扩展的功能是搜集站点的内容并通过 API 发送给 Algolia。前往站点根目录,执行命令安装: | ||
1. 在 `API Keys` 页面找到需要使用的一些配置的值,包括 `Application ID` 和 `Search-Only API Key`。注意,`Admin API Key` 需要保密保存,不要外泄。 | ||
``` | ||
$ cd hexo | ||
$ npm install hexo-algolia | ||
``` | ||
![](https://user-images.githubusercontent.com/16272760/73673895-693b3180-46ea-11ea-8f50-8bae850b50d0.png) | ||
1. 在 `API Keys` 页面找到需要使用的一些配置的值,包括 `ApplicationID` 和 `Search-Only API Key`。注意,`Admin API Key` 需要保密保存,不要外泄。 | ||
![](https://user-images.githubusercontent.com/8521181/35479066-64e35aec-0428-11e8-91f9-1ec3afa45c5c.png) | ||
1. 在 `API Keys` 页面,点击 `ALL API KEYS` 找到新建 INDEX 对应的 key,**编辑权限**,在弹出框中找到 ACL ,**勾选 Add records、 Delete records、List indices、Delete index 权限**,点击 `update` 更新。 | ||
![](https://user-images.githubusercontent.com/8521181/35479064-611aa0b4-0428-11e8-85a1-cfb449b486ec.png) | ||
![](https://user-images.githubusercontent.com/8521181/35479084-d4f7ac02-0428-11e8-95a6-c4e3b1bef47b.png) | ||
1. 编辑 `站点配置文件`,新增以下配置,除了 `chunkSize` 字段,替换成在 Algolia 获取到的值: | ||
@@ -30,4 +18,4 @@ | ||
algolia: | ||
applicationID: 'applicationID' | ||
apiKey: 'apiKey' | ||
applicationID: 'Application ID' | ||
apiKey: 'Search-Only API Key' | ||
indexName: 'indexName' | ||
@@ -37,7 +25,19 @@ chunkSize: 5000 | ||
1. 当配置完成,在站点根目录下执行一下命令来更新上传 Index。请注意观察命令的输出。 | ||
1. 在 `API Keys` 页面,点击 `All API Keys` 切换到对应的页面中。接着点击 `New API Key` 按钮,来**编辑权限**。在弹出框中找到 ACL ,**输入 addObject、 deleteObject、listIndexes、deleteIndex 权限**,然后点击最下方的 `Create` 按钮。将这个新创建的 API Key 复制到剪贴板,我们称之为 `High-privilege API key`。 | ||
![](https://user-images.githubusercontent.com/16272760/73673902-6b04f500-46ea-11ea-9c80-4e5c5002e07b.png) | ||
![](https://user-images.githubusercontent.com/16272760/73673905-6b9d8b80-46ea-11ea-9e01-702ec2a8a297.png) | ||
1. 在 Index 和 API Key 创建完成后,此时这个 Index 里未包含任何数据。接下来需要安装 [Hexo Algolia](https://github.com/oncletom/hexo-algolia) 扩展,这个扩展的功能是搜集站点的内容并通过 API 发送给 Algolia。前往站点根目录,执行命令安装: | ||
``` | ||
$ export HEXO_ALGOLIA_INDEXING_KEY=Search-Only API key # 使用 Git Bash | ||
# set HEXO_ALGOLIA_INDEXING_KEY=Search-Only API key # 使用 Windows CMD 命令行 | ||
$ cd hexo | ||
$ npm install hexo-algolia | ||
``` | ||
1. 当配置完成,在站点根目录下执行以下命令来更新上传 Index。请注意观察命令的输出。 | ||
``` | ||
$ export HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # 使用 Git Bash | ||
# set HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # 使用 Windows CMD 命令行 | ||
$ hexo clean | ||
@@ -70,6 +70,7 @@ $ hexo algolia | ||
... | ||
# Internal version: 1 | ||
# https://www.algolia.com | ||
algolia_instant_js: https://cdn.jsdelivr.net/npm/instantsearch.js@2.4.1/dist/instantsearch.js | ||
algolia_instant_css: https://cdn.jsdelivr.net/npm/instantsearch.js@2.4.1/dist/instantsearch.min.css | ||
# Algolia Search | ||
# algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js | ||
# instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js | ||
algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js | ||
instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js | ||
... | ||
@@ -76,0 +77,0 @@ ``` |
@@ -48,8 +48,10 @@ <div align="right"> | ||
* 切换到其它主题并检查 bug 是否仍然存在(例如使用默认主题 landscape)。换言之,证明这是 NexT 主题而非来自 Hexo 的 bug; | ||
* 将 NexT 主题升级到最新版; | ||
* 将 Hexo 和 Hexo 插件升级到最新版; | ||
* 卸载不必要的 Hexo 插件。 | ||
* 将 Node.js 和 `npm` 升级到最新版; | ||
* 卸载不必要的 Hexo 插件,或重新通过 `npm install --save` 安装插件。 | ||
如果你得到了来自 Hexo 或浏览器控制台的报错信息,请在 Google / Stackoverflow / GitHub Issue 中搜寻,或在提交 Issue 时报告给我们。 | ||
如果你在使用过程中发现了 Bug,请再次确认 Bug 在 [最新发布版本](https://github.com/theme-next/hexo-theme-next/releases/latest) 中是否重现。如果 Bug 重现,欢迎你到我们的 [主题仓库](https://github.com/theme-next/hexo-theme-next) 中 [反馈 Bug ](#reporting-bugs) 或者 [提交功能需求](#提交功能需求),也更期待您 [提交合并请求](#提交合并请求)。 | ||
如果你在使用过程中发现了 Bug,请再次确认 Bug 在 [最新发布版本](https://github.com/theme-next/hexo-theme-next/releases/latest) 中是否重现。如果 Bug 重现,欢迎你到我们的 [主题仓库](https://github.com/theme-next/hexo-theme-next) 中 [反馈 Bug](#reporting-bugs) 或者 [提交功能需求](#提交功能需求),也更期待您 [提交合并请求](#提交合并请求)。 | ||
@@ -56,0 +58,0 @@ ### 反馈 Bug |
@@ -14,3 +14,3 @@ <h1 align="center">数学公式</h1> | ||
如果你选择使用 MathJax 进行数学公式渲染,你需要使用 [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) 或者 [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed) 这两个渲染器的其中一个。 | ||
如果你选择使用 MathJax 进行数学公式渲染,你需要使用 [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) 或者 [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed) (不推荐)作为 Hexo 的 Markdown 渲染器。 | ||
@@ -44,4 +44,3 @@ 首先,卸载原有的渲染器 `hexo-renderer-marked`,并安装这两种渲染器的**其中一个**: | ||
为了使用这项功能,一般来说,你必须把所使用的 LaTeX 公式放在 `equation` 环境里面,采用旧的方法(也就是说,仅仅把公式的每一边用两个 $ 符号包含起来)是无效的。如何引用公式?你只需要在书写公式的时候给公式一个 `\ | ||
label{}` 标记(tag),然后在正文中,可以使用 `\ref{}` 或者 `\eqref{}` 命令来引用对应的公式。使用 `\eqref{}` 是推荐的方式,因为如果你使用 `\ref{}`,公式在文中的引用编号将没有圆括号包围。下面介绍几种常见的公式编号例子。 | ||
为了使用这项功能,一般来说,你必须把所使用的 LaTeX 公式放在 `equation` 环境里面,采用旧的方法(也就是说,仅仅把公式的每一边用两个 $ 符号包含起来)是无效的。如何引用公式?你只需要在书写公式的时候给公式一个 `\label{}` 标记(tag),然后在正文中,可以使用 `\ref{}` 或者 `\eqref{}` 命令来引用对应的公式。使用 `\eqref{}` 是推荐的方式,因为如果你使用 `\ref{}`,公式在文中的引用编号将没有圆括号包围。下面介绍几种常见的公式编号例子。 | ||
@@ -51,5 +50,5 @@ 对于简单的公式,使用下面的方式给公式一个标记, | ||
```latex | ||
$$\begin{equation} | ||
$$\begin{equation}\label{eq1} | ||
e=mc^2 | ||
\end{equation}\label{eq1}$$ | ||
\end{equation}$$ | ||
``` | ||
@@ -66,3 +65,3 @@ | ||
```latex | ||
$$\begin{equation} | ||
$$\begin{equation}\label{eq2} | ||
\begin{aligned} | ||
@@ -73,3 +72,3 @@ a &= b + c \\ | ||
\end{aligned} | ||
\end{equation}\label{eq2}$$ | ||
\end{equation}$$ | ||
``` | ||
@@ -103,3 +102,3 @@ | ||
如果你想要了解更多信息,请访问 [MathJax 关于公式编号的官方文档](http://docs.mathjax.org/en/latest/tex.html#automatic-equation-numbering)。同时,你也可以访问[这篇博客](https://jdhao.github.io/2018/01/25/hexo-mathjax-equation-number/) 来获取更多细节信息。 | ||
如果你想要了解更多信息,请访问 [MathJax 关于公式编号的官方文档](https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html)。同时,你也可以阅读 [这篇文档](https://theme-next.org/docs/third-party-services/math-equations) 来获取更多细节信息。 | ||
@@ -106,0 +105,0 @@ ### Katex |
@@ -14,3 +14,3 @@ <div align="right"> | ||
<br> | ||
<a href="https://github.com/theme-next/hexo-theme-next/releases"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a> | ||
<a href="https://www.npmjs.com/package/hexo-theme-next"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a> | ||
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E=10.9.0-green?style=flat-square"></a> | ||
@@ -17,0 +17,0 @@ <a href="https://hexo.io"><img src="https://img.shields.io/badge/hexo-%3E=3.5.0-blue?style=flat-square&logo=hexo"></a> |
{ | ||
"name": "hexo-theme-next", | ||
"version": "7.7.1", | ||
"version": "7.7.2", | ||
"description": "Elegant and powerful theme for Hexo.", | ||
@@ -29,3 +29,3 @@ "main": "gulpfile.js", | ||
"gulp-eslint": "^6.0.0", | ||
"gulp-shell": "^0.7.1", | ||
"gulp-shell": "^0.8.0", | ||
"js-yaml": "^3.13.1", | ||
@@ -32,0 +32,0 @@ "stylint": "^2.0.0" |
@@ -14,3 +14,3 @@ <div align="right"> | ||
<br> | ||
<a href="https://github.com/theme-next/hexo-theme-next/releases"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a> | ||
<a href="https://www.npmjs.com/package/hexo-theme-next"><img src="https://img.shields.io/github/package-json/v/theme-next/hexo-theme-next?style=flat-square"></a> | ||
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E=10.9.0-green?style=flat-square"></a> | ||
@@ -17,0 +17,0 @@ <a href="https://hexo.io"><img src="https://img.shields.io/badge/hexo-%3E=3.5.0-blue?style=flat-square&logo=hexo"></a> |
@@ -24,10 +24,5 @@ /** | ||
var result = [`<a class="btn" href="${url}"`]; | ||
title.length > 0 && result.push(` title="${title}"`); | ||
result.push('>'); | ||
icon.length > 0 && result.push(`<i class="fa fa-${icon}"></i>`); | ||
text.length > 0 && result.push(text); | ||
result.push('</a>'); | ||
return result.join(''); | ||
return `<a class="btn" href="${url}"${title.length > 0 ? ` title="${title}"` : ''}> | ||
${icon.length > 0 ? `<i class="fa fa-${icon}"></i>` : ''}${text} | ||
</a>`; | ||
} | ||
@@ -34,0 +29,0 @@ |
@@ -22,3 +22,3 @@ /** | ||
hexo.extend.tag.register('caniuse', caniUse, {async: true}); | ||
hexo.extend.tag.register('can', caniUse, {async: true}); | ||
hexo.extend.tag.register('caniuse', caniUse); | ||
hexo.extend.tag.register('can', caniUse); |
@@ -10,5 +10,5 @@ /** | ||
function centerQuote(args, content) { | ||
return '<blockquote class="blockquote-center">' | ||
+ hexo.render.renderSync({text: content, engine: 'markdown'}) | ||
+ '</blockquote>'; | ||
return `<blockquote class="blockquote-center"> | ||
${hexo.render.renderSync({text: content, engine: 'markdown'})} | ||
</blockquote>`; | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -1,12 +0,12 @@ | ||
/* global instantsearch, CONFIG */ | ||
/* global instantsearch, algoliasearch, CONFIG */ | ||
window.addEventListener('DOMContentLoaded', () => { | ||
const algoliaSettings = CONFIG.algolia; | ||
const { indexName, appID, apiKey } = algoliaSettings; | ||
let search = instantsearch({ | ||
appId : algoliaSettings.appID, | ||
apiKey : algoliaSettings.apiKey, | ||
indexName : algoliaSettings.indexName, | ||
indexName, | ||
searchClient : algoliasearch(appID, apiKey), | ||
searchFunction: helper => { | ||
let searchInput = document.querySelector('#search-input input'); | ||
let searchInput = document.querySelector('.search-input'); | ||
if (searchInput.value) { | ||
@@ -23,6 +23,17 @@ helper.search(); | ||
// Registering Widgets | ||
[ | ||
search.addWidgets([ | ||
instantsearch.widgets.configure({ | ||
hitsPerPage: algoliaSettings.hits.per_page || 10 | ||
}), | ||
instantsearch.widgets.searchBox({ | ||
container : '#search-input', | ||
placeholder: algoliaSettings.labels.input_placeholder | ||
container : '.search-input-container', | ||
placeholder : algoliaSettings.labels.input_placeholder, | ||
// Hide default icons of algolia search | ||
showReset : false, | ||
showSubmit : false, | ||
showLoadingIndicator: false, | ||
cssClasses : { | ||
input: 'search-input' | ||
} | ||
}), | ||
@@ -33,3 +44,3 @@ | ||
templates: { | ||
body: data => { | ||
text: data => { | ||
let stats = algoliaSettings.labels.hits_stats | ||
@@ -48,5 +59,4 @@ .replace(/\$\{hits}/, data.nbHits) | ||
instantsearch.widgets.hits({ | ||
container : '#algolia-hits', | ||
hitsPerPage: algoliaSettings.hits.per_page || 10, | ||
templates : { | ||
container: '#algolia-hits', | ||
templates: { | ||
item: data => { | ||
@@ -68,6 +78,7 @@ let link = data.permalink ? data.permalink : CONFIG.root + data.path; | ||
instantsearch.widgets.pagination({ | ||
container : '#algolia-pagination', | ||
scrollTo : false, | ||
showFirstLast: false, | ||
labels : { | ||
container: '#algolia-pagination', | ||
scrollTo : false, | ||
showFirst: false, | ||
showLast : false, | ||
templates: { | ||
first : '<i class="fa fa-angle-double-left"></i>', | ||
@@ -79,10 +90,10 @@ last : '<i class="fa fa-angle-double-right"></i>', | ||
cssClasses: { | ||
root : 'pagination', | ||
item : 'pagination-item', | ||
link : 'page-number', | ||
active : 'current', | ||
disabled: 'disabled-item' | ||
root : 'pagination', | ||
item : 'pagination-item', | ||
link : 'page-number', | ||
selectedItem: 'current', | ||
disabledItem: 'disabled-item' | ||
} | ||
}) | ||
].forEach(search.addWidget, search); | ||
]); | ||
@@ -92,7 +103,9 @@ search.start(); | ||
// Handle and trigger popup window | ||
document.querySelector('.popup-trigger').addEventListener('click', () => { | ||
document.body.style.overflow = 'hidden'; | ||
document.querySelector('.search-pop-overlay').style.display = 'block'; | ||
document.querySelector('.popup').style.display = 'block'; | ||
document.querySelector('#search-input input').focus(); | ||
document.querySelectorAll('.popup-trigger').forEach(element => { | ||
element.addEventListener('click', () => { | ||
document.body.style.overflow = 'hidden'; | ||
document.querySelector('.search-pop-overlay').style.display = 'block'; | ||
document.querySelector('.popup').style.display = 'block'; | ||
document.querySelector('.search-input').focus(); | ||
}); | ||
}); | ||
@@ -111,3 +124,3 @@ | ||
window.addEventListener('keyup', event => { | ||
if (event.which === 27) { | ||
if (event.key === 'Escape') { | ||
onPopupClose(); | ||
@@ -114,0 +127,0 @@ } |
@@ -16,3 +16,3 @@ /* global CONFIG */ | ||
const path = CONFIG.root + searchPath; | ||
const input = document.getElementById('search-input'); | ||
const input = document.querySelector('.search-input'); | ||
const resultContent = document.getElementById('search-result'); | ||
@@ -268,3 +268,3 @@ | ||
document.querySelector('.popup').style.display = 'block'; | ||
document.getElementById('search-input').focus(); | ||
document.querySelector('.search-input').focus(); | ||
}; | ||
@@ -291,8 +291,6 @@ | ||
// Handle and trigger popup window | ||
document.querySelector('.popup-trigger').addEventListener('click', () => { | ||
if (isfetched === false) { | ||
searchFunc(); | ||
} else { | ||
proceedSearch(); | ||
} | ||
document.querySelectorAll('.popup-trigger').forEach(element => { | ||
element.addEventListener('click', () => { | ||
isfetched ? proceedSearch() : searchFunc(); | ||
}); | ||
}); | ||
@@ -311,3 +309,3 @@ | ||
window.addEventListener('keyup', event => { | ||
if (event.which === 27) { | ||
if (event.key === 'Escape') { | ||
onPopupClose(); | ||
@@ -314,0 +312,0 @@ } |
@@ -7,3 +7,3 @@ /* global NexT, CONFIG, Velocity */ | ||
var SIDEBAR_WIDTH = CONFIG.sidebar.width || 320; | ||
var SIDEBAR_DISPLAY_DURATION = 400; | ||
var SIDEBAR_DISPLAY_DURATION = 200; | ||
var mousePos = {}; | ||
@@ -10,0 +10,0 @@ |
@@ -49,3 +49,3 @@ /* global NexT, CONFIG */ | ||
element.addEventListener('click', event => { | ||
var exturl = event.currentTarget.getAttribute('data-url'); | ||
var exturl = event.currentTarget.dataset.url; | ||
var decurl = decodeURIComponent(escape(window.atob(exturl))); | ||
@@ -325,4 +325,4 @@ window.open(decurl, '_blank', 'noopener'); | ||
var sidebarSchemePadding = (CONFIG.sidebar.padding * 2) + sidebarNavHeight + sidebarb2tHeight; | ||
// Margin of sidebar b2t: 8px -10px -20px, brings a different of 12px. | ||
if (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') sidebarSchemePadding += (sidebarOffset * 2) - 12; | ||
// Margin of sidebar b2t: -4px -10px -18px, brings a different of 22px. | ||
if (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') sidebarSchemePadding += (sidebarOffset * 2) - 22; | ||
// Initialize Sidebar & TOC Height. | ||
@@ -329,0 +329,0 @@ var sidebarWrapperHeight = document.body.offsetHeight - sidebarSchemePadding + 'px'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1135502
4938
298