[build] 4.8.6
This commit is contained in:
parent
f69b8af91a
commit
a97c61d8e5
4 changed files with 75 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
(function () {
|
||||
var INDEXS = {};
|
||||
|
||||
<<<<<<< HEAD
|
||||
var LOCAL_STORAGE = {
|
||||
EXPIRE_KEY: 'docsify.search.expires',
|
||||
INDEX_KEY: 'docsify.search.index'
|
||||
|
|
@ -13,6 +14,8 @@ function resolveIndexKey(namespace) {
|
|||
return namespace ? ((LOCAL_STORAGE.INDEX_KEY) + "/" + namespace) : LOCAL_STORAGE.INDEX_KEY
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> [build] 4.8.6
|
||||
function escapeHtml(string) {
|
||||
var entityMap = {
|
||||
'&': '&',
|
||||
|
|
@ -46,9 +49,15 @@ function getAllPaths(router) {
|
|||
return paths
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
function saveData(maxAge, expireKey, indexKey) {
|
||||
localStorage.setItem(expireKey, Date.now() + maxAge);
|
||||
localStorage.setItem(indexKey, JSON.stringify(INDEXS));
|
||||
=======
|
||||
function saveData(maxAge) {
|
||||
localStorage.setItem('docsify.search.expires', Date.now() + maxAge);
|
||||
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
|
||||
>>>>>>> [build] 4.8.6
|
||||
}
|
||||
|
||||
function genIndex(path, content, router, depth) {
|
||||
|
|
@ -166,6 +175,7 @@ function search(query) {
|
|||
|
||||
function init$1(config, vm) {
|
||||
var isAuto = config.paths === 'auto';
|
||||
<<<<<<< HEAD
|
||||
|
||||
var expireKey = resolveExpireKey(config.namespace);
|
||||
var indexKey = resolveIndexKey(config.namespace);
|
||||
|
|
@ -173,6 +183,11 @@ function init$1(config, vm) {
|
|||
var isExpired = localStorage.getItem(expireKey) < Date.now();
|
||||
|
||||
INDEXS = JSON.parse(localStorage.getItem(indexKey));
|
||||
=======
|
||||
var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
|
||||
|
||||
INDEXS = JSON.parse(localStorage.getItem('docsify.search.index'));
|
||||
>>>>>>> [build] 4.8.6
|
||||
|
||||
if (isExpired) {
|
||||
INDEXS = {};
|
||||
|
|
@ -193,7 +208,11 @@ function init$1(config, vm) {
|
|||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||
.then(function (result) {
|
||||
INDEXS[path] = genIndex(path, result, vm.router, config.depth);
|
||||
<<<<<<< HEAD
|
||||
len === ++count && saveData(config.maxAge, expireKey, indexKey);
|
||||
=======
|
||||
len === ++count && saveData(config.maxAge);
|
||||
>>>>>>> [build] 4.8.6
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -327,8 +346,12 @@ var CONFIG = {
|
|||
paths: 'auto',
|
||||
depth: 2,
|
||||
maxAge: 86400000, // 1 day
|
||||
<<<<<<< HEAD
|
||||
hideOtherSidebarContent: false,
|
||||
namespace: undefined
|
||||
=======
|
||||
hideOtherSidebarContent: false
|
||||
>>>>>>> [build] 4.8.6
|
||||
};
|
||||
|
||||
var install = function (hook, vm) {
|
||||
|
|
@ -344,7 +367,10 @@ var install = function (hook, vm) {
|
|||
CONFIG.noData = opts.noData || CONFIG.noData;
|
||||
CONFIG.depth = opts.depth || CONFIG.depth;
|
||||
CONFIG.hideOtherSidebarContent = opts.hideOtherSidebarContent || CONFIG.hideOtherSidebarContent;
|
||||
<<<<<<< HEAD
|
||||
CONFIG.namespace = opts.namespace || CONFIG.namespace;
|
||||
=======
|
||||
>>>>>>> [build] 4.8.6
|
||||
}
|
||||
|
||||
var isAuto = CONFIG.paths === 'auto';
|
||||
|
|
|
|||
4
lib/plugins/search.min.js
vendored
4
lib/plugins/search.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue