Compare commits

...
7 Commits
Author SHA1 Message Date
qingwei.li aedf16e433 -> v2.2.1 2017-02-11 09:39:44 +08:00
qingwei.li 41e4cb1b04 bump: 2.2.1 2017-02-11 09:39:31 +08:00
qingwei.li 9d3cc89aa9 fix(search): crash when not content, fixed #68 2017-02-11 09:36:48 +08:00
qingwei.li 50f5fc2b22 fix(event): scroll active sidebar 2017-02-11 09:36:48 +08:00
qingwei.li 3941304fda fix(search): not work in mobile 2017-02-11 09:36:48 +08:00
D.Yangandcinwell.li be6a97af92 add showcase of Mybatis-Plus (#69)
add a showcase
2017-02-10 16:56:05 +08:00
qingwei.li 55323a38b8 docs(changelog): update 2017-02-09 22:18:55 +08:00
10 changed files with 38 additions and 17 deletions
+14 -2
View File
@@ -1,13 +1,25 @@
## 2.2.1
> 2017-02-11
### Bug fixes
- fix(search): crash when not content, fixed #68
- fix(event): scroll active sidebar
- fix(search): not work in mobile
## 2.2.0
### Features
- Add `Google Analytics` plugin.
```html
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
```
## 2.1.0
### Features
- Add search plugin
```html
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
```
+1
View File
@@ -60,6 +60,7 @@ These open-source projects are using docsify to generate their sites. Pull reque
- [Samaritan](http://samaritan.stockdb.org) - An Algorithmic Trading Framework for Digital Currency.
- [Vudash](http://vudash.github.io/vudash/) - Powerful, Flexible, Open Source dashboards for anything
- [Trilogy](http://trilogy.js.org) - No-hassle SQLite with a Promise-based, document store style API.
- [Mybatis-Plus](http://mp.baomidou.com/) - An enhanced toolkit of Mybatis to simplify development
## Similar projects
- [docute](https://github.com/egoist/docute) - 📜 Effortlessly documentation done right
+1 -1
View File
@@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>2.2.0</small>
# docsify <small>2.2.1</small>
> A magical documentation site generator.
+4 -3
View File
@@ -199,6 +199,7 @@ function scrollActiveSidebar () {
var hoveredOverSidebar = false;
var anchors = document.querySelectorAll('.anchor');
var sidebar = document.querySelector('.sidebar');
var sidebarContainer = sidebar.querySelector('.sidebar-nav');
var sidebarHeight = sidebar.clientHeight;
var nav = {};
@@ -246,12 +247,12 @@ function scrollActiveSidebar () {
var currentPageOffset = 0;
var currentActiveOffset = active.offsetTop + active.clientHeight + 40;
var currentActiveIsInView = (
active.offsetTop >= sidebar.scrollTop &&
currentActiveOffset <= sidebar.scrollTop + sidebarHeight
active.offsetTop >= sidebarContainer.scrollTop &&
currentActiveOffset <= sidebarContainer.scrollTop + sidebarHeight
);
var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight;
var newScrollTop = currentActiveIsInView
? sidebar.scrollTop
? sidebarContainer.scrollTop
: linkNotFurtherThanSidebarHeight
? currentPageOffset
: currentActiveOffset - sidebarHeight;
+2 -2
View File
File diff suppressed because one or more lines are too long
+5 -2
View File
@@ -80,6 +80,7 @@ var genIndex = function (path, content) {
slug = ("#/" + path + "#" + id).replace(/\/+/, '/');
INDEXS[slug] = { slug: slug, title: text, body: '' };
} else {
if (!slug) { return }
// other html tag
if (!INDEXS[slug]) {
INDEXS[slug] = {};
@@ -127,9 +128,11 @@ SearchComponent.prototype.render = function render (dom) {
SearchComponent.prototype.bindEvent = function bindEvent () {
var this$1 = this;
var input = document.querySelector('.search input');
var panel = document.querySelector('.results-panel');
var search = document.querySelector('.search');
var input = search.querySelector('.search input');
var panel = search.querySelector('.results-panel');
search.addEventListener('click', function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
input.addEventListener('input', function (e) {
var target = e.target;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "2.2.0",
"version": "2.2.1",
"description": "A magical documentation generator.",
"main": "lib/docsify.js",
"files": [
+4 -3
View File
@@ -10,6 +10,7 @@ export function scrollActiveSidebar () {
let hoveredOverSidebar = false
const anchors = document.querySelectorAll('.anchor')
const sidebar = document.querySelector('.sidebar')
const sidebarContainer = sidebar.querySelector('.sidebar-nav')
const sidebarHeight = sidebar.clientHeight
const nav = {}
@@ -57,12 +58,12 @@ export function scrollActiveSidebar () {
const currentPageOffset = 0
const currentActiveOffset = active.offsetTop + active.clientHeight + 40
const currentActiveIsInView = (
active.offsetTop >= sidebar.scrollTop &&
currentActiveOffset <= sidebar.scrollTop + sidebarHeight
active.offsetTop >= sidebarContainer.scrollTop &&
currentActiveOffset <= sidebarContainer.scrollTop + sidebarHeight
)
const linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight
const newScrollTop = currentActiveIsInView
? sidebar.scrollTop
? sidebarContainer.scrollTop
: linkNotFurtherThanSidebarHeight
? currentPageOffset
: currentActiveOffset - sidebarHeight
+5 -2
View File
@@ -76,6 +76,7 @@ const genIndex = function (path, content = '') {
slug = `#/${path}#${id}`.replace(/\/+/, '/')
INDEXS[slug] = { slug, title: text, body: '' }
} else {
if (!slug) return
// other html tag
if (!INDEXS[slug]) {
INDEXS[slug] = {}
@@ -180,9 +181,11 @@ class SearchComponent {
}
bindEvent () {
const input = document.querySelector('.search input')
const panel = document.querySelector('.results-panel')
const search = document.querySelector('.search')
const input = search.querySelector('.search input')
const panel = search.querySelector('.results-panel')
search.addEventListener('click', e => e.target.tagName !== 'A' && e.stopPropagation())
input.addEventListener('input', e => {
const target = e.target