bump 1.2.0

This commit is contained in:
qingwei.li 2016-12-20 21:20:08 +08:00
commit 73456e6fac
2 changed files with 15 additions and 7 deletions

View file

@ -2518,6 +2518,8 @@ var OPTIONS = {
loadSidebar: null, loadSidebar: null,
loadNavbar: null, loadNavbar: null,
router: false, router: false,
homepage: 'README.md',
basePath: '',
auto2top: false auto2top: false
}; };
var script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop(); var script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop();
@ -2540,8 +2542,9 @@ var cacheRoute = null;
var cacheXhr = null; var cacheXhr = null;
var mainRender = function (cb) { var mainRender = function (cb) {
var route = getRoute(); var route = OPTIONS.basePath + getRoute();
if (cacheRoute === route) { return cb() } if (cacheRoute === route) { return cb() }
var wait; var wait;
var basePath = cacheRoute = route; var basePath = cacheRoute = route;
@ -2551,13 +2554,18 @@ var mainRender = function (cb) {
basePath = basePath.match(/(\S*\/)[^\/]+$/)[1]; basePath = basePath.match(/(\S*\/)[^\/]+$/)[1];
} }
var page;
if (!route) {
page = OPTIONS.homepage || 'README.md';
} else if (/\/$/.test(route)) {
page = route + "README.md";
} else {
page = route + ".md";
}
cacheXhr && cacheXhr.abort && cacheXhr.abort(); cacheXhr && cacheXhr.abort && cacheXhr.abort();
// Render markdown file // Render markdown file
cacheXhr = load( cacheXhr = load(page, 'GET', renderLoading);
(!route || /\/$/.test(route)) ? (route + "README.md") : (route + ".md"),
'GET',
renderLoading);
cacheXhr.then(function (result) { cacheXhr.then(function (result) {
renderArticle(result); renderArticle(result);
if (OPTIONS.loadSidebar) { if (OPTIONS.loadSidebar) {

2
lib/docsify.min.js vendored

File diff suppressed because one or more lines are too long