mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 05:16:06 +10:00
fix config initialization and coercion (#861)
* fix: document.currentScript reference * fix: merge config
This commit is contained in:
+18
-20
@@ -1,5 +1,7 @@
|
||||
import {merge, hyphenate, isPrimitive, hasOwn} from './util/core'
|
||||
|
||||
const currentScript = document.currentScript
|
||||
|
||||
export default function () {
|
||||
const config = merge(
|
||||
{
|
||||
@@ -36,7 +38,7 @@ export default function () {
|
||||
)
|
||||
|
||||
const script =
|
||||
document.currentScript ||
|
||||
currentScript ||
|
||||
[].slice
|
||||
.call(document.getElementsByTagName('script'))
|
||||
.filter(n => /docsify\./.test(n.src))[0]
|
||||
@@ -51,26 +53,22 @@ export default function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.loadSidebar === true) {
|
||||
config.loadSidebar = '_sidebar' + config.ext
|
||||
}
|
||||
|
||||
if (config.loadNavbar === true) {
|
||||
config.loadNavbar = '_navbar' + config.ext
|
||||
}
|
||||
|
||||
if (config.coverpage === true) {
|
||||
config.coverpage = '_coverpage' + config.ext
|
||||
}
|
||||
|
||||
if (config.repo === true) {
|
||||
config.repo = ''
|
||||
}
|
||||
|
||||
if (config.name === true) {
|
||||
config.name = ''
|
||||
}
|
||||
if (config.loadSidebar === true) {
|
||||
config.loadSidebar = '_sidebar' + config.ext
|
||||
}
|
||||
if (config.loadNavbar === true) {
|
||||
config.loadNavbar = '_navbar' + config.ext
|
||||
}
|
||||
if (config.coverpage === true) {
|
||||
config.coverpage = '_coverpage' + config.ext
|
||||
}
|
||||
if (config.repo === true) {
|
||||
config.repo = ''
|
||||
}
|
||||
if (config.name === true) {
|
||||
config.name = ''
|
||||
}
|
||||
|
||||
window.$docsify = config
|
||||
|
||||
Reference in New Issue
Block a user