Compare commits

..
4 Commits
Author SHA1 Message Date
qingwei.li 1fdfaf0b6b -> v1.1.2 2016-12-17 15:18:04 +08:00
qingwei.li fe33e2d506 bump 1.1.2 2016-12-17 15:17:20 +08:00
qingwei.li 6463dd3bae Optimize progress bar again 2016-12-17 15:14:52 +08:00
qingwei.li 299c31dff9 Fix auto2top in mobile 2016-12-17 15:08:44 +08:00
7 changed files with 40 additions and 15 deletions
+5
View File
@@ -1,3 +1,8 @@
## 1.1.2
### Bug fixes
- fix failed `auto2top` in mobile
## 1.1.1
### Bug fixes
- Optimize progress bar
+15 -6
View File
@@ -105,12 +105,16 @@ function getRoute () {
return route
}
function isMobile () {
return /mobile/i.test(navigator.userAgent)
}
/**
* Active sidebar when scroll
* @link https://buble.surge.sh/
*/
function scrollActiveSidebar () {
if (/mobile/i.test(navigator.userAgent)) { return }
if (isMobile()) { return }
var anchors = document.querySelectorAll('.anchor');
var nav = {};
@@ -198,8 +202,11 @@ function bindToggle (dom) {
}
var cacheContentDOM;
function scroll2Top (dom) {
cacheContentDOM = cacheContentDOM || document.querySelector(dom);
function scroll2Top () {
if (!cacheContentDOM) {
var dom = isMobile() ? 'body' : 'section.content';
cacheContentDOM = document.querySelector(dom);
}
cacheContentDOM.scrollTop = 0;
}
@@ -2412,7 +2419,7 @@ function renderArticle (content) {
renderSidebar.rendered = false;
renderNavbar.rendered = false;
if (OPTIONS$1.auto2top) { scroll2Top('section.content'); }
if (OPTIONS$1.auto2top) { scroll2Top(); }
}
/**
@@ -2468,14 +2475,16 @@ function renderLoading (ref) {
CACHE['loading'] = div;
}
CACHE['loading'].style.opacity = 1;
CACHE['loading'].style.width = num + '%';
if (num >= 95) {
clearTimeout(renderLoading.cacheTImeout);
CACHE['loading'].style.width = '100%';
renderLoading.cacheTImeout = setTimeout(function (_) {
CACHE['loading'].style.opacity = 0;
CACHE['loading'].style.width = '0%';
}, 200);
} else {
CACHE['loading'].style.opacity = 1;
CACHE['loading'].style.width = num + '%';
}
}
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "1.1.1",
"version": "1.1.2",
"description": "A magical documentation generator.",
"main": "lib/docsify.js",
"files": [
+7 -3
View File
@@ -1,10 +1,11 @@
import { isMobile } from './util'
/**
* Active sidebar when scroll
* @link https://buble.surge.sh/
*/
export function scrollActiveSidebar () {
if (/mobile/i.test(navigator.userAgent)) return
if (isMobile()) return
const anchors = document.querySelectorAll('.anchor')
const nav = {}
@@ -92,7 +93,10 @@ export function bindToggle (dom) {
}
let cacheContentDOM
export function scroll2Top (dom) {
cacheContentDOM = cacheContentDOM || document.querySelector(dom)
export function scroll2Top () {
if (!cacheContentDOM) {
const dom = isMobile() ? 'body' : 'section.content'
cacheContentDOM = document.querySelector(dom)
}
cacheContentDOM.scrollTop = 0
}
+5 -3
View File
@@ -70,7 +70,7 @@ export function renderArticle (content) {
renderSidebar.rendered = false
renderNavbar.rendered = false
if (OPTIONS.auto2top) scroll2Top('section.content')
if (OPTIONS.auto2top) scroll2Top()
}
/**
@@ -123,14 +123,16 @@ export function renderLoading ({ loaded, total }) {
CACHE['loading'] = div
}
CACHE['loading'].style.opacity = 1
CACHE['loading'].style.width = num + '%'
if (num >= 95) {
clearTimeout(renderLoading.cacheTImeout)
CACHE['loading'].style.width = '100%'
renderLoading.cacheTImeout = setTimeout(_ => {
CACHE['loading'].style.opacity = 0
CACHE['loading'].style.width = '0%'
}, 200)
} else {
CACHE['loading'].style.opacity = 1
CACHE['loading'].style.width = num + '%'
}
}
+5
View File
@@ -95,3 +95,8 @@ export function getRoute () {
return route
}
export function isMobile () {
return /mobile/i.test(navigator.userAgent)
}