Skip to content

Commit

Permalink
fix: Update getAllPath query selector (#653)
Browse files Browse the repository at this point in the history
Closes #614
  • Loading branch information
cheng-kang authored and QingWei-Li committed Oct 23, 2018
1 parent 50c2434 commit f6f4e32
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
let INDEXS = {}
let helper

function escapeHtml(string) {
const entityMap = {
Expand All @@ -17,7 +16,7 @@ function escapeHtml(string) {
function getAllPaths(router) {
const paths = []

helper.dom.findAll('a:not([data-nosearch])').forEach(node => {
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => {
const href = node.href
const originHref = node.getAttribute('href')
const path = router.parse(href).path
Expand Down Expand Up @@ -149,8 +148,6 @@ export function search(query) {
}

export function init(config, vm) {
helper = Docsify

const isAuto = config.paths === 'auto'
const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()

Expand All @@ -171,7 +168,7 @@ export function init(config, vm) {
return count++
}

helper
Docsify
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
.then(result => {
INDEXS[path] = genIndex(path, result, vm.router, config.depth)
Expand Down

0 comments on commit f6f4e32

Please # to comment.